Bug #65635 [Com]: cannot dereference array

From: Date: Sun, 08 Sep 2013 21:31:40 +0000
Subject: Bug #65635 [Com]: cannot dereference array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-181466@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65635&edit=1

 ID:                 65635
 Comment by:         cmbecker69 at gmx dot de
 Reported by:        TorrAB at Yahoo dot com
 Summary:            cannot dereference array
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Windows XP
 PHP Version:        5.5.3
 Block user comment: N
 Private report:     N

 New Comment:

> Apparently, the parser cannot dereference $Apt['Color'].

No.  The parser won't just accept this syntax.  See the manual[1]
on how to use array indexes in strings.

IMHO, this is not a bug.

[1]  
<http://www.php.net/manual/en/language.types.string.php#language.types.string.pars
ing.simple>


Previous Comments:
------------------------------------------------------------------------
[2013-09-08 18:57:46] TorrAB at Yahoo dot com

Description:
------------
Parse error: syntax error, unexpected "(T_ENCAPSED_AND_WHITESPACE), expecting identifier
(T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING).
Apparently, the parser cannot dereference $Apt['Color']. May be linked to bug 23022. But
why the <unexpected ">?

Test script:
---------------
<?php
#No error, using intermediate var $Colo:
	forEach ($GLOBALS['Aps'] as $GLOBALS['X'] => $Apt){
		$Colo=$Apt['Color'];
		echo "<div class='row' style=\"background-color: $Colo\">";
		echo '</div>';}

#Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting
identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in
C:\Apache24\htdocs\GoodBadB.php on line 10:
	forEach ($GLOBALS['Aps'] as $GLOBALS['X'] => $Apt){
		echo "<div class='row' style=\"background-color:
$Apt['Color']\">";
#Apparently, the parser cannot dereference $Apt['Color']. May be linked to bug 23022. But
why the <unexpected ">?
		echo '</div>';}
?>



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65635&edit=1


Thread (3 messages)

« previous php.bugs (#181466) next »