Doc #80804 [Opn]: debug_zval_dump example does not compile (Parse error: syntax error is shown)

From: Date: Sat, 27 Feb 2021 21:22:04 +0000
Subject: Doc #80804 [Opn]: debug_zval_dump example does not compile (Parse error: syntax error is shown)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18607@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80804&edit=1 ID: 80804 Updated by: requinix@php.net Reported by: forkik at gmail dot com Summary: debug_zval_dump example does not compile (Parse error: syntax error is shown) Status: Open Type: Documentation Problem Package: *General Issues PHP Version: 8.0Git-2021-02-26 (Git) Block user comment: N Private report: N New Comment: Discussion: https://externals.io/message/113298 Previous Comments: ------------------------------------------------------------------------ [2021-02-26 16:47:42] requinix@php.net As pointed out in the comments, the example requires call-time pass-by-reference which was removed from PHP a while back. The unfortunate truth is that debug_zval_dump is essentially useless now... ------------------------------------------------------------------------ [2021-02-26 16:42:01] forkik at gmail dot com Description: ------------ --- From manual page: https://php.net/function.debug-zval-dump --- Test script: --------------- <?php $var1 = 'Hello World'; $var2 = ''; $var2 =& $var1; debug_zval_dump(&$var1); ?> Actual result: -------------- Parse error: syntax error, unexpected token "&" in /tmp/tester.php on line 7 Checked at https://extendsclass.com/php.html with PHP versions: 8.0.0 and 7.4.8 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80804&edit=1

« previous php.doc.bugs (#18607) next »