Bug #71622 [NEW]: Strings used in pass-as-reference cannot be used to invoke $callable()

From: Date: Thu, 18 Feb 2016 09:53:32 +0000
Subject: Bug #71622 [NEW]: Strings used in pass-as-reference cannot be used to invoke $callable()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199315@lists.php.net to get a copy of this message
From:             mblarsen at gmail dot com
Operating system: Ubuntu 14.04.4 LTS, Trusty Tahr
PHP version:      7.0.3
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Strings used in pass-as-reference cannot be used to invoke $callable()

Description:
------------
If you pass a string-variable to a method that accepts the variable by
reference, then the same variable in the calling context no longer
behaves like a normal string when it comes to invoking callables on
self:: (and like other contexts) but instead produces the error:
Function name must be a string, despite the variable is a valid string.

The test script below show different cases. Notably is the last case
where the value of the "damaged" variable is passed to a new variable to
achieve the desired result with success, thus the content is fine, but
the variable is "damaged".

Test script:
---------------
http://sandbox.onlinephpfunctions.com/code/5fa7c924f4e8514d6020b180decd96e5969d4014

In the linked sandbox you can see that it works in 5.6.x but not in
either of the released 7 versions: 7.0.3, 7.0.1, etc.

Expected result:
----------------
Test scripts shows the bug under difference circumstances. 


-- 
Edit bug report at https://bugs.php.net/bug.php?id=71622&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71622&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71622&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71622&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71622&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71622&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71622&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71622&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71622&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71622&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71622&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71622&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71622&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71622&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71622&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71622&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71622&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71622&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71622&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71622&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71622&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#199315) next »