Skip to content

Commit 45fdd03

Browse files
committed
Properly resolve magic method of preloaded classes inherited from internal ones.
1 parent 34645ae commit 45fdd03

File tree

1 file changed

+52
-13
lines changed

1 file changed

+52
-13
lines changed

ext/opcache/zend_persist.c

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -989,43 +989,82 @@ static int zend_update_parent_ce(zval *zv)
989989

990990
/* update methods */
991991
if (ce->constructor) {
992-
ce->constructor = zend_shared_alloc_get_xlat_entry(ce->constructor);
992+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->constructor);
993+
if (tmp != NULL) {
994+
ce->constructor = tmp;
995+
}
993996
}
994997
if (ce->destructor) {
995-
ce->destructor = zend_shared_alloc_get_xlat_entry(ce->destructor);
998+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->destructor);
999+
if (tmp != NULL) {
1000+
ce->destructor = tmp;
1001+
}
9961002
}
9971003
if (ce->clone) {
998-
ce->clone = zend_shared_alloc_get_xlat_entry(ce->clone);
1004+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->clone);
1005+
if (tmp != NULL) {
1006+
ce->clone = tmp;
1007+
}
9991008
}
10001009
if (ce->__get) {
1001-
ce->__get = zend_shared_alloc_get_xlat_entry(ce->__get);
1010+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__get);
1011+
if (tmp != NULL) {
1012+
ce->__get = tmp;
1013+
}
10021014
}
10031015
if (ce->__set) {
1004-
ce->__set = zend_shared_alloc_get_xlat_entry(ce->__set);
1016+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__set);
1017+
if (tmp != NULL) {
1018+
ce->__set = tmp;
1019+
}
10051020
}
10061021
if (ce->__call) {
1007-
ce->__call = zend_shared_alloc_get_xlat_entry(ce->__call);
1022+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__call);
1023+
if (tmp != NULL) {
1024+
ce->__call = tmp;
1025+
}
10081026
}
10091027
if (ce->serialize_func) {
1010-
ce->serialize_func = zend_shared_alloc_get_xlat_entry(ce->serialize_func);
1028+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->serialize_func);
1029+
if (tmp != NULL) {
1030+
ce->serialize_func = tmp;
1031+
}
10111032
}
10121033
if (ce->unserialize_func) {
1013-
ce->unserialize_func = zend_shared_alloc_get_xlat_entry(ce->unserialize_func);
1034+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->unserialize_func);
1035+
if (tmp != NULL) {
1036+
ce->unserialize_func = tmp;
1037+
}
10141038
}
10151039
if (ce->__isset) {
1016-
ce->__isset = zend_shared_alloc_get_xlat_entry(ce->__isset);
1040+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__isset);
1041+
if (tmp != NULL) {
1042+
ce->__isset = tmp;
1043+
}
10171044
}
10181045
if (ce->__unset) {
1019-
ce->__unset = zend_shared_alloc_get_xlat_entry(ce->__unset);
1046+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__unset);
1047+
if (tmp != NULL) {
1048+
ce->__unset = tmp;
1049+
}
10201050
}
10211051
if (ce->__tostring) {
1022-
ce->__tostring = zend_shared_alloc_get_xlat_entry(ce->__tostring);
1052+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__tostring);
1053+
if (tmp != NULL) {
1054+
ce->__tostring = tmp;
1055+
}
10231056
}
10241057
if (ce->__callstatic) {
1025-
ce->__callstatic = zend_shared_alloc_get_xlat_entry(ce->__callstatic);
1058+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__callstatic);
1059+
if (tmp != NULL) {
1060+
ce->__callstatic = tmp;
1061+
}
10261062
}
10271063
if (ce->__debugInfo) {
1028-
ce->__debugInfo = zend_shared_alloc_get_xlat_entry(ce->__debugInfo);
1064+
zend_function *tmp = zend_shared_alloc_get_xlat_entry(ce->__debugInfo);
1065+
if (tmp != NULL) {
1066+
ce->__debugInfo = tmp;
1067+
}
10291068
}
10301069
// zend_hash_apply(&ce->properties_info, (apply_func_t) zend_update_property_info_ce);
10311070
return 0;

0 commit comments

Comments
 (0)