Skip to content

Commit b5de04b

Browse files
committed
add support for explicit unserialize options + retrive Object as original instead of __PHP_Incomplete_Class
1 parent 6c64759 commit b5de04b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Normalizers/NormalizeSerialize.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function run()
6262
if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
6363
//options added @ v 7.0 which allow no evaluating for classes
6464
//object will be instantiated as __PHP_Incomplete_Class
65-
$decoded = @unserialize($this->value, false);
65+
$decoded = @unserialize($this->value, []);
6666
} else {
6767
$decoded = false; //don't serialize it might be danger
6868
}
@@ -79,6 +79,12 @@ public function run()
7979
$decoded = $arrayValue;
8080
}
8181

82+
//Object of class __PHP_Incomplete_Class
83+
if(gettype($decoded) === 'object'){
84+
//object serialize must be the same
85+
return $this->value;
86+
}
87+
8288
return $decoded;
8389
}
8490
}

0 commit comments

Comments
 (0)