Bug #73916 [Opn->Csd]: zend_print_flat_zval_r doesn't consider reference
Edit report at https://bugs.php.net/bug.php?id=73916&edit=1
ID: 73916
Updated by: laruence@php.net
Reported by: x dot xiang at outlook dot com
Summary: zend_print_flat_zval_r doesn't consider reference
-Status: Open
+Status: Closed
Type: Bug
Package: Output Control
Operating System: ALL
PHP Version: 7.0.14
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=04379bcb1df25a9f9cc1d440f5c12105b9fbaf97
Log: Fixed bug #73916 (zend_print_flat_zval_r doesn't consider reference)
Previous Comments:
------------------------------------------------------------------------
[2017-01-12 08:33:19] x dot xiang at outlook dot com
I realized that zend_print_zval_r_ex dealt with the case of reference.
------------------------------------------------------------------------
[2017-01-12 05:44:28] x dot xiang at outlook dot com
Description:
------------
zend_print_flat_zval_r and zend_print_zval_r_ex doesn't consider reference in php 7.0.x.
The following error may be triggeredï¼
PHP Notice: Array to string conversion;
Catchable fatal error: Object could not be converted to string.
This bug has been fixed in php 7.1, why php 7.0.x is not fixed.
Test script:
---------------
$a = array('a');
class b{};
$b = new b;
$test[] =& $a;
$test[] =& $b;
test($test);
function test() {
debug_print_backtrace();
}
Expected result:
----------------
#0 test(Array ([0] => Array ([0] => a),[1] => b Object ())) called at
[/Users/playcrab/Documents/code/php/test/test7.php:7]
Actual result:
--------------
#0 test(Array ([0] => PHP Notice: Array to string conversion in
/Users/playcrab/Documents/code/php/test/test7.php on line 9
PHP Stack trace:
PHP 1. {main}() /Users/playcrab/Documents/code/php/test/test7.php:0
PHP 2. test() /Users/playcrab/Documents/code/php/test/test7.php:7
PHP 3. debug_print_backtrace() /Users/playcrab/Documents/code/php/test/test7.php:9
PHP Catchable fatal error: Object of class b could not be converted to string in
/Users/playcrab/Documents/code/php/test/test7.php on line 9
PHP Stack trace:
PHP 1. {main}() /Users/playcrab/Documents/code/php/test/test7.php:0
PHP 2. test() /Users/playcrab/Documents/code/php/test/test7.php:7
PHP 3. debug_print_backtrace() /Users/playcrab/Documents/code/php/test/test7.php:9
Notice: Array to string conversion in /Users/playcrab/Documents/code/php/test/test7.php on line 9
Call Stack:
0.0068 353088 1. {main}() /Users/playcrab/Documents/code/php/test/test7.php:0
0.0080 353928 2. test() /Users/playcrab/Documents/code/php/test/test7.php:7
0.0080 353928 3. debug_print_backtrace()
/Users/playcrab/Documents/code/php/test/test7.php:9
Array,[1] =>
Catchable fatal error: Object of class b could not be converted to string in
/Users/playcrab/Documents/code/php/test/test7.php on line 9
Call Stack:
0.0068 353088 1. {main}() /Users/playcrab/Documents/code/php/test/test7.php:0
0.0080 353928 2. test() /Users/playcrab/Documents/code/php/test/test7.php:7
0.0080 353928 3. debug_print_backtrace()
/Users/playcrab/Documents/code/php/test/test7.php:9
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73916&edit=1
Thread (3 messages)