Bug #72137 [NEW]: Backward variable handling ain't working accourding to doc
| From: | dutchprogrammer at gmail dot com | Date: | Mon, 02 May 2016 07:53:54 +0000 |
| Subject: | Bug #72137 [NEW]: Backward variable handling ain't working accourding to doc | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-13440@lists.php.net to get a copy of this message | ||
From: dutchprogrammer at gmail dot com
Operating system: centos 7 (linux)
PHP version: 7.0.6
Package: Documentation problem
Bug Type: Bug
Bug description:Backward variable handling ain't working accourding to doc
Description:
------------
Accourding to the 'Changes to variable handling'
(http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect),
arrays that i want to pass as function name i have to write as
($foo->$bar)['baz']()
In my case i have an api that check the url wich class and function
needed to be loaded for example (in short):
url: users/getData
i split the url with explode on '/' and then pass the second url key [1]
as a function:
$url = 'users/getData';
$urlSplit = explode('/', $url, 2);
($class->$urlSplit)[1]($param1, $params2);
It's weird to write it like this but this ainât working.
I need to save the function to a new variable to fix it like this:
$function = $urlSplit[1];
$class->$function($param1, $params2);
Test script:
---------------
Explained in the description above
--
Edit bug report at https://bugs.php.net/bug.php?id=72137&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72137&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72137&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72137&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72137&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72137&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72137&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72137&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72137&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72137&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72137&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72137&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72137&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72137&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72137&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72137&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72137&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72137&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72137&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72137&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72137&r=mysqlcfg