php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72283 Invalid example on debug_zval_dump
Submitted: 2016-05-28 17:46 UTC Modified: 2021-03-03 14:35 UTC
From: fernando at null-life dot com Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.6.22 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fernando at null-life dot com
New email:
PHP Version: OS:

 

 [2016-05-28 17:46 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 15:32 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2016-12-30 15:32 UTC] 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.
 [2020-04-29 10:18 UTC] kulakov74 at yandex dot ru
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.
 [2021-03-03 14:35 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC