Bug #73916 [Opn]: zend_print_flat_zval_r doesn't consider reference

From: Date: Thu, 12 Jan 2017 08:33:20 +0000
Subject: Bug #73916 [Opn]: zend_print_flat_zval_r doesn't consider reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206549@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73916&edit=1 ID: 73916 User updated by: x dot xiang at outlook dot com Reported by: x dot xiang at outlook dot com -Summary: zend_print_flat_zval_r and zend_print_zval_r_ex doesn't consider reference +Summary: zend_print_flat_zval_r doesn't consider reference Status: Open Type: Bug Package: Output Control Operating System: ALL PHP Version: 7.0.14 Block user comment: N Private report: N New Comment: I realized that zend_print_zval_r_ex dealt with the case of reference. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#206549) next »