Skip to content

Commit 08c5679

Browse files
committed
Merge remote-tracking branch 'php-src/PHP-7.2' into PHP-7.2
2 parents cce2e33 + 73f222d commit 08c5679

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ PHP NEWS
44

55
- Core:
66
. Fixed bug #77339 (__callStatic may get incorrect arguments). (Dmitry)
7+
. Fixed bug #77494 (Disabling class causes segfault on member access).
8+
(Dmitry)
79

810
- Curl:
911
. Fixed bug #76675 (Segfault with H2 server push). (Pedro Magalhães)

Zend/tests/bug77494.phpt

Lines changed: 16 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,6 +2855,17 @@ static zend_object *display_disabled_class(zend_class_entry *class_type) /* {{{
28552855
zend_object *intern;
28562856

28572857
intern = zend_objects_new(class_type);
2858+
2859+
/* Initialize default properties */
2860+
if (EXPECTED(class_type->default_properties_count != 0)) {
2861+
zval *p = intern->properties_table;
2862+
zval *end = p + class_type->default_properties_count;
2863+
do {
2864+
ZVAL_UNDEF(p);
2865+
p++;
2866+
} while (p != end);
2867+
}
2868+
28582869
zend_error(E_WARNING, "%s() has been disabled for security reasons", ZSTR_VAL(class_type->name));
28592870
return intern;
28602871
}

0 commit comments

Comments
 (0)