php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55754 Only variables should be passed by reference for ZEND_SEND_PREFER_REF params
Submitted: 2011-09-21 12:46 UTC Modified: 2011-10-16 00:34 UTC
From: dk at uw dot no Assigned: stas (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.8 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dk at uw dot no
New email:
PHP Version: OS:

 

 [2011-09-21 12:46 UTC] dk at uw dot no
Description:
------------
Built-in functions where a parameter is defined with ZEND_SEND_PREFER_REF raises a Strict Standards warning if an expression is passed as the argument.

The PREFER part signals the preference of passing by reference, but if the argument is not a variable, it should behave as if the parameter was defined with ZEND_SEND_BY_VAL and keep quiet, just as for regular ZEND_SEND_BY_VAL parameters.

Test script:
---------------
<?php

error_reporting(32767);

current($arr = array(0 => "a")); /* Strict Standards: ... */ 
current(array(0 => "a"));
current($arr);

?>

Actual result:
--------------
Strict Standards: Only variables should be passed by reference in filename on line 5

Patches

bug55754-test-case_v2.patch (last revision 2011-10-06 16:58 UTC by dk at uw dot no)
bug_55754_minimal.patch (last revision 2011-09-23 18:45 UTC by dk at uw dot no)
bug_55754-test-case.patch (last revision 2011-09-23 15:59 UTC by dk at uw dot no)
bug_55754-php5.4-201109231430.patch (last revision 2011-09-23 15:55 UTC by dk at uw dot no)
bug_55754-php5.3-201109231430.patch (last revision 2011-09-23 15:54 UTC by dk at uw dot no)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-16 00:34 UTC] stas@php.net
Automatic comment from SVN on behalf of stas
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=318137
Log: Bug #55754 - Only variables should be passed by reference for ZEND_SEND_PREFER_REF params
 [2011-10-16 00:34 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2011-10-16 00:34 UTC] stas@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Apr 28 23:01:28 2025 UTC