Skip to content

Commit 5a07c40

Browse files
authored
Merge pull request #1 from nanasess/improve/php8.1
Fix `Serialization of 'DOMDocument' is not allowed
2 parents cea85a8 + 942fbde commit 5a07c40

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "sebastian/global-state",
2+
"name": "php5friends/global-state11",
33
"description": "Snapshotting of global state",
44
"keywords": ["global state"],
5-
"homepage": "http://www.github.com/sebastianbergmann/global-state",
5+
"homepage": "http://www.github.com/php5friends/global-state11",
66
"license": "BSD-3-Clause",
77
"authors": [
88
{
@@ -14,7 +14,10 @@
1414
"php": ">=5.3.3"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "~4.2|~5.0"
17+
"php5friends/phpunit48": "^4.8"
18+
},
19+
"replace": {
20+
"sebastian/global-state": "*"
1821
},
1922
"suggest": {
2023
"ext-uopz": "*"

src/Snapshot.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,14 @@ private function setupSuperGlobalArrays()
402402
*/
403403
private function canBeSerialized($variable)
404404
{
405+
if (PHP_VERSION_ID >= 80100) {
406+
try {
407+
serialize($variable);
408+
} catch (\Exception $e) {
409+
return false;
410+
}
411+
}
412+
405413
if (!is_object($variable)) {
406414
return !is_resource($variable);
407415
}

0 commit comments

Comments
 (0)