Skip to content

Commit aa9a8db

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fixed bug #77494 (Disabling class causes segfault on member access)
2 parents e0f97ae + 73f222d commit aa9a8db

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.3
4+
-Core:
5+
. Fixed bug #77494 (Disabling class causes segfault on member access).
6+
(Dmitry)
47

58
- Opcache:
69
. Fixed bug #77287 (Opcache literal compaction is incompatible with EXT

Zend/tests/bug77494.phpt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #77494 (Disabling class causes segfault on member access)
3+
--SKIPIF--
4+
<?php if (!extension_loaded("curl")) exit("skip curl extension not loaded"); ?>
5+
--INI--
6+
disable_classes=CURLFile
7+
--FILE--
8+
<?php
9+
$a = new CURLFile();
10+
var_dump($a->name);
11+
?>
12+
--EXPECTF--
13+
Warning: CURLFile() has been disabled for security reasons in %sbug77494.php on line 2
14+
15+
Notice: Undefined property: CURLFile::$name in %sbug77494.php on line 3
16+
NULL

Zend/zend_API.c

+11
Original file line numberDiff line numberDiff line change
@@ -2861,6 +2861,17 @@ static zend_object *display_disabled_class(zend_class_entry *class_type) /* {{{
28612861
zend_object *intern;
28622862

28632863
intern = zend_objects_new(class_type);
2864+
2865+
/* Initialize default properties */
2866+
if (EXPECTED(class_type->default_properties_count != 0)) {
2867+
zval *p = intern->properties_table;
2868+
zval *end = p + class_type->default_properties_count;
2869+
do {
2870+
ZVAL_UNDEF(p);
2871+
p++;
2872+
} while (p != end);
2873+
}
2874+
28642875
zend_error(E_WARNING, "%s() has been disabled for security reasons", ZSTR_VAL(class_type->name));
28652876
return intern;
28662877
}

0 commit comments

Comments
 (0)