#23353 [Opn]: inline variable detection only handles one dereference

From: Date: Sat, 26 Apr 2003 21:03:30 +0000
Subject: #23353 [Opn]: inline variable detection only handles one dereference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38473@lists.php.net to get a copy of this message
ID: 23353 User updated by: spagmoid at yahoo dot com Reported By: spagmoid at yahoo dot com Status: Open Bug Type: *General Issues Operating System: WinXP PHP Version: 4.3.1 New Comment: If the parser accepts $A->B why can't it accept $A->B->C ?? come on. Previous Comments: ------------------------------------------------------------------------ [2003-04-26 16:02:35] spagmoid at yahoo dot com Very well, break the documentation instead of fixing the code: Chapter 7. Types /strings Simple syntax If a dollar sign ($) is encountered, the parser will greedily take as much tokens as possible to form a valid variable name. ------------------------------------------------------------------------ [2003-04-26 15:55:56] pollita@php.net Where are you getting the information that: php is supposed to use "as much text as possible" when detecting variables in strings, but it stops at the first object. Is this in the manual somewhere? If so that page should be updated. For complex variable references in interpolated string you must encapsulate them in curly braces. In your example try: $String = "text {$Obj->Obj->Prop} text"; ------------------------------------------------------------------------ [2003-04-26 15:32:30] spagmoid at yahoo dot com Yes, this is a bug. Try again. ------------------------------------------------------------------------ [2003-04-25 17:22:16] sniper@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. . ------------------------------------------------------------------------ [2003-04-25 17:21:17] spagmoid at yahoo dot com php is supposed to use "as much text as possible" when detecting variables in strings, but it stops at the first object. $Obj->Prop = "purple"; $String = "text $Obj->Prop text"; result: text purple text $Obj->Obj->Prop = "purple"; $String = "text $Obj->Obj->Prop text"; result: text object->Prop text ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23353&edit=1

« previous php.bugs (#38473) next »