Doc #72283 [Com]: Invalid example on debug_zval_dump
| From: | kulakov74 at yandex dot ru | Date: | Wed, 29 Apr 2020 10:18:19 +0000 |
| Subject: | Doc #72283 [Com]: Invalid example on debug_zval_dump | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17529@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72283&edit=1
ID: 72283
Comment by: kulakov74 at yandex dot ru
Reported by: fernando at null-life dot com
Summary: Invalid example on debug_zval_dump
Status: Verified
Type: Documentation Problem
Package: Documentation problem
Operating System: *
PHP Version: 5.6.22
Block user comment: N
Private report: N
New Comment:
I confirm the issue, the example on the manual page https://www.php.net/manual/en/function.debug-zval-dump.php
is incorrect, PHP 7.4.5 now displays
Parse error: syntax error, unexpected '&'
And indeed, the function itself seems of little use. If I make a real reference, it does not display
refcount=2. For strings, refcount is always 1, for integers it's not displayed at all.
Previous Comments:
------------------------------------------------------------------------
[2017-03-21 04:36:55] requinix@php.net
Related To: Bug #74279
------------------------------------------------------------------------
[2016-12-30 15:32:37] cmb@php.net
Not only is the first example invalid as of PHP 5.4.0, but also
the third example is broken as of PHP 7.0.0, and there appear more
issues, see
<http://marc.info/?l=php-internals&m=143778859216287&w=2>ff.
------------------------------------------------------------------------
[2016-05-28 17:46:59] fernando at null-life dot com
Description:
------------
---
From manual page: http://www.php.net/function.debug-zval-dump
---
First example is invalid now because call-time pass by reference is removed.
Fatal error: Call-time pass-by-reference has been removed in
/Users/fmunozs/dev/php-fuzz/phuzzer/x.php on line 7
Test script:
---------------
<?php
$var1 = 'Hello World';
$var2 = '';
$var2 =& $var1;
debug_zval_dump(&$var1);
?>
Expected result:
----------------
Working example
Actual result:
--------------
Fatal error: Call-time pass-by-reference has been removed in
/Users/fmunozs/dev/php-fuzz/phuzzer/x.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72283&edit=1