php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29556 inconsistent dereference using multidimensional arrays inside strings
Submitted: 2004-08-06 21:28 UTC Modified: 2004-08-17 00:25 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: ash at aeria dot net Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.8 OS: FreeBSD4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ash at aeria dot net
New email:
PHP Version: OS:

 

 [2004-08-06 21:28 UTC] ash at aeria dot net
Description:
------------
Arrays containing strings may be used inline  as thus:
   $vec = array (1=>"foo",2=>"baz");
   echo "$vec[1]";
Fine. However if you use a multidim array instead, you end with the 'Array' reference string. I think the RE that contcatenates text should have better judgement about where a variables key might stop. The issue is present in all the php version I have access to.

Or mabe this was fixed in .9 and I missed the other bug

This is my php version

PHP 4.3.8 (cli) (built: Jul 30 2004 17:08:10)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
Exit 1


Reproduce code:
---------------
<?
$grid[1][1]= "textstring";
echo "$grid[1][1]"; #this outputs 'Array[1]'
echo $grid[1][1]; #this works
?>


Expected result:
----------------
textstringtextstring

Actual result:
--------------
root@sqee.aeria.net:bin}./php ~/foo.php                               
Array[1]textstring


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-17 00:25 UTC] iliaa@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

If you store arrays inside strings surround them with {} 
ex. echo "{$grid[1][1]}"; 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC