php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36552 Setting multiple variables to "" with list results in " Invalid opcode 98/1/1"
Submitted: 2006-02-27 22:11 UTC Modified: 2006-02-28 11:44 UTC
From: stitched at mindspring dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.1.2 OS: Windows 2000
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
22 + 42 = ?
Subscribe to this entry?

 
 [2006-02-27 22:11 UTC] stitched at mindspring dot com
Description:
------------
Setting multiple variables to an empty string "" using list results in the error below and PHP terminates: 

Fatal error: Invalid opcode 98/1/1. in phpfail.php on line 1

I tested with the latest build available for Windows which is PHP 5.1.3-dev (cli) (built: Feb 20 2006 00:29:25).  phpinfo reports that the build command was:

cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"

Reproduce code:
---------------
<?php list($Var1,$Var2) = ""; ?>

Expected result:
----------------
I expected both $Var1 and $Var2 to be set to an empty string.  Setting them individually works as expected.

Actual result:
--------------
Fatal error: Invalid opcode 98/1/1. in phpfail.php on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-28 00:39 UTC] bjori@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

php.net/list: "Note:  list() only works on numerical arrays and assumes the numerical indices start at 0."

use $var1 = $var2 = "";

 [2006-02-28 01:04 UTC] stitched at mindspring dot com
Very sorry for the bogus report then.  FWIW 4.4.2 doesn't complain about that usage at all and it's been working fine for many 4.x versions.

Dave
 [2006-02-28 01:52 UTC] bjori@php.net
(don't know how I managed to change the summary..)

Dave: No, It has never worked as you expected.
list($foo, $bar) = ""; will (in 4.4.3-dev) set $foo and $bar to NULL, not empty string.

- Hannes :)
 [2006-02-28 11:44 UTC] stitched at mindspring dot com
Thank you Hannes.  Whether null or empty string it didn't throw an error and that was the point I was trying to make :)  When I switched to 5 quite a few things "broke" because of my usage of it that way and it surprised me that something rather simple like that suddenly no longer worked and caused a fatal error.

Thanks again for taking the time to respond and clarify what it was really doing.

Dave
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC