mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix segfault when unserializing abstract class
This commit is contained in:
parent
b29b846863
commit
0d3da6ac25
2 changed files with 20 additions and 1 deletions
15
ext/standard/tests/serialize/unserialize_abstract_class.phpt
Normal file
15
ext/standard/tests/serialize/unserialize_abstract_class.phpt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--TEST--
|
||||||
|
Unserializing an abstract class should fail
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$payload = 'O:23:"RecursiveFilterIterator":0:{}';
|
||||||
|
try {
|
||||||
|
var_dump(unserialize($payload));
|
||||||
|
} catch (Error $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Cannot instantiate abstract class RecursiveFilterIterator
|
|
@ -1144,7 +1144,11 @@ object ":" uiv ":" ["] {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_init_ex(rval, ce);
|
if (object_init_ex(rval, ce) == FAILURE) {
|
||||||
|
zend_string_release_ex(class_name, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (incomplete_class) {
|
if (incomplete_class) {
|
||||||
php_store_class_name(rval, ZSTR_VAL(class_name), len2);
|
php_store_class_name(rval, ZSTR_VAL(class_name), len2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue