Home » Console » Console_Getargs » Bug #6219
Reference behaviour error
Details
| Submitted | 2005-12-11 13:44 UTC |
|---|---|
| From | hn at ondskap dot net |
| Assigned | wenz |
| Status | Closed |
| Package | Console_Getargs |
| PHP Version | 5.0.5 |
| OS | Linux 2.6.12 |
| Roadmaps | (Not assigned) |
Comments
[2005-12-11 13:44 UTC] hn at ondskap dot net
Description:
------------
At line 418 of Getargs.php:
$long = reset(explode('|', $long));
You try to reset() a result ov explode(). The
explode()-result is not bound to any variable, so this
fails.
mixed reset ( array &array )
as reset() is working on the reference.
See the patch below.
Test script:
---------------
--- /usr/share/php/Console/Getargs.php 2005-12-11
14:17:33.000000000 +0100
+++ /usr/share/php/Console/Getargs2.php 2005-12-11
14:37:23.000000000 +0100
@@ -415,7 +415,8 @@
foreach ($config as $long => $def) {
// We only really care about the first option
name.
- $long = reset(explode('|', $long));
+ $long = explode('|', $long);
+ $long = reset( $long );
// Treat the "parameters" specially.
if ($long == CONSOLE_GETARGS_PARAMS) {
@@ -1059,4 +1060,4 @@
* c-basic-offset: 4
* End:
*/
-?>
\ No newline at end of file
+?>
Expected result:
----------------
Fatal error: Only variables can be passed by reference
in /usr/share/php/Console/Getargs.php on line 418