Merge branch 'PHP-7.2' into PHP-7.3

This commit is contained in:
Nikita Popov 2018-10-02 17:48:56 +02:00
commit b8392803f9
3 changed files with 55 additions and 0 deletions

4
NEWS
View file

@ -12,6 +12,10 @@ PHP NEWS
- Mbstring:
. Fixed bug #76958 (Broken UTF7-IMAP conversion). (Nikita)
- Reflection:
. Fixed bug #76936 (Objects cannot access their private attributes while
handling reflection errors). (Nikita)
27 Sep 2018, PHP 7.3.0RC2
- CURL:

View file

@ -1185,6 +1185,7 @@ static ZEND_COLD void zend_error_va_list(int type, const char *format, va_list a
zend_stack loop_var_stack;
zend_stack delayed_oplines_stack;
zend_array *symbol_table;
zend_class_entry *orig_fake_scope;
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
@ -1339,6 +1340,9 @@ static ZEND_COLD void zend_error_va_list(int type, const char *format, va_list a
CG(in_compilation) = 0;
}
orig_fake_scope = EG(fake_scope);
EG(fake_scope) = NULL;
if (call_user_function(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
if (Z_TYPE(retval) == IS_FALSE) {
@ -1351,6 +1355,8 @@ static ZEND_COLD void zend_error_va_list(int type, const char *format, va_list a
zend_error_cb(type, error_filename, error_lineno, format, args);
}
EG(fake_scope) = orig_fake_scope;
if (in_compilation) {
CG(active_class_entry) = saved_class_entry;
RESTORE_STACK(loop_var_stack);

View file

@ -0,0 +1,45 @@
--TEST--
Bug #76936: Objects cannot access their private attributes while handling reflection errors
--FILE--
<?php
class Foo {
public $dummy1;
public $dummy2;
}
class ErrorHandler {
private $private = 'THIS IS PRIVATE'."\n";
function __construct() {
set_error_handler(
function ($errno, $errstr, $errfile, $errline) {
$this->handleError($errno, $errstr, $errfile, $errline);
}
);
}
private function handleError($errno, $errstr, $errfile, $errline, $errmodule = null) {
echo __METHOD__. " dealing with error $errstr\n";
// This attribute is no longer accessible in this object. Same for other
// objects and their private attributes once we reach in this state.
echo $this->private;
}
}
$errorHandler = new ErrorHandler();
$f = new Foo;
unset($f->dummy2);
foreach ((new ReflectionObject($f))->getProperties() as $p) {
echo $p->getName() .' = '. $p->getValue($f) ."\n";
}
?>
--EXPECT--
dummy1 =
ErrorHandler::handleError dealing with error Undefined property: Foo::$dummy2
THIS IS PRIVATE
dummy2 =