From:             paul at santasoft dot com
Operating system: centos (linux)
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  list() with string assignment not as expected

Description:
------------
clarification is needed in the documentation in the case of a one-to-one
assignment using list() and a string.  see reproduction code example 1.  i
understand that in this case, the string is being treated as an array of
characters.  But this was not as expected initially.

Plus, a fatal error is generated if the string is directly provided
instead of returning from a function.  Inconsistent and confusing.

Reproduce code:
---------------
Example 1:

<?php
function bob_dole_is_a_dork() {
        return 'Bob Dole Smells Like Old Socks!';
}
list($bobdole) = bob_dole_is_a_dork();
echo($bobdole);
?>


Example 2:

<?php
list($bobdole) = 'Bob Dole Smells Like Old Socks!';
echo($bobdole);
?>

Expected result:
----------------
Example 1:

Bob Dole Smells Like Old Socks!



Example 2:

Bob Dole Smells Like Old Socks!


Actual result:
--------------
Example 1 gives:

B

Example 2 gives:

Fatal error: Invalid opcode 98/1/1. in /the/path/doesnt/matter/pp.php on
line 2


-- 
Edit bug report at http://bugs.php.net/?id=41205&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41205&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41205&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41205&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41205&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41205&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41205&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41205&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41205&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41205&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41205&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41205&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41205&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41205&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41205&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41205&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41205&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41205&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41205&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41205&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41205&r=mysqlcfg

Reply via email to