Merge branch 'PHP-7.2' into PHP-7.3

* PHP-7.2:
  Fixed bug #77494 (Disabling class causes segfault on member access)
This commit is contained in:
Dmitry Stogov 2019-01-24 13:07:31 +03:00
commit aa9a8dbda3
3 changed files with 30 additions and 0 deletions

3
NEWS
View file

@ -1,6 +1,9 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.3
-Core:
. Fixed bug #77494 (Disabling class causes segfault on member access).
(Dmitry)
- Opcache:
. Fixed bug #77287 (Opcache literal compaction is incompatible with EXT

16
Zend/tests/bug77494.phpt Normal file
View file

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

View file

@ -2861,6 +2861,17 @@ static zend_object *display_disabled_class(zend_class_entry *class_type) /* {{{
zend_object *intern;
intern = zend_objects_new(class_type);
/* Initialize default properties */
if (EXPECTED(class_type->default_properties_count != 0)) {
zval *p = intern->properties_table;
zval *end = p + class_type->default_properties_count;
do {
ZVAL_UNDEF(p);
p++;
} while (p != end);
}
zend_error(E_WARNING, "%s() has been disabled for security reasons", ZSTR_VAL(class_type->name));
return intern;
}