Skip to content

Commit 86660c6

Browse files
committed
MFH
1 parent b429a84 commit 86660c6

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

ext/standard/php_incomplete_class.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
if (Z_OBJ_HT_P(struc)->get_class_entry && \
3232
Z_OBJCE_P(struc) == BG(incomplete_class)) { \
3333
class_name = php_lookup_class_name(struc, &name_len); \
34+
if (!class_name) { \
35+
name_len = sizeof(INCOMPLETE_CLASS) - 1; \
36+
class_name = estrndup(INCOMPLETE_CLASS, name_len); \
37+
} \
3438
free_class_name = 1; \
3539
incomplete_class = 1; \
3640
} else { \
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
(un)serializing __PHP_Incomplete_Class instance
3+
--FILE--
4+
<?php
5+
6+
$d = serialize(new __PHP_Incomplete_Class);
7+
$o = unserialize($d);
8+
var_dump($o);
9+
10+
$o->test = "a";
11+
var_dump($o->test);
12+
var_dump($o->test2);
13+
14+
echo "Done\n";
15+
?>
16+
--EXPECTF--
17+
object(__PHP_Incomplete_Class)#%d (0) {
18+
}
19+
20+
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
21+
22+
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
23+
NULL
24+
25+
Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in %s on line %d
26+
NULL
27+
Done

0 commit comments

Comments
 (0)