From:             nepto at platon dot sk
Operating system: Gentoo Linux
PHP version:      4.3.6
PHP Bug Type:     Arrays related
Bug description:  string to array variable transformation

Description:
------------
Transformation of string variable to array variable does not work as
expected when prticular assignment is used.

It can be also bug in the var_dump(), but I do not suppose this.

Reproduce code:
---------------
<?php

/*
 * string-to-array.php
 *
 * Developed by Ondrej Jombik <[EMAIL PROTECTED]>
 * Copyright (c) 2004 Platon SDG, http://platon.sk/
 * Licensed under terms of GNU General Public License.
 * All rights reserved.
 *
 * Changelog:
 * 2004-05-10 - created
 *
 */

/* $Platon$ */

$str = 'string';

$ar['key'] = $str;
var_dump($ar['key']); // string(6) "string"

$ar['key']['sub-key'] = $ar['key'];
var_dump($ar['key']); /*  string(6) "string"
                          but expected is:
                                array(1) {
                                      ["sub-key"]=>
                                            string(6) "string"
                                }
*/

$ar['key'] = array('sub-key' => $ar['key']);
var_dump($ar['key']); /* now OK:
                            array(1) {
                                  ["sub-key"]=>
                                        string(6) "string"
                            }
*/

/* Modeline for ViM {{{
 * vim: set ts=4:
 * vim600: fdm=marker fdl=0 fdc=0:
 * }}} */

?>

Expected result:
----------------
Written in the code.

Actual result:
--------------
Written in the code as well.

-- 
Edit bug report at http://bugs.php.net/?id=28476&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28476&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28476&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28476&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28476&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28476&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28476&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28476&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28476&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28476&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28476&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28476&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28476&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28476&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28476&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28476&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28476&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28476&r=float

Reply via email to