#41776 [Opn]: Class static variables not parsed inside heredoc

From: Date: Fri, 22 Jun 2007 06:47:16 +0000
Subject: #41776 [Opn]: Class static variables not parsed inside heredoc
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114071@lists.php.net to get a copy of this message
ID: 41776 User updated by: singlarahul21 at gmail dot com Reported By: singlarahul21 at gmail dot com Status: Open Bug Type: Scripting Engine problem Operating System: Windows PHP Version: 5.2.3 New Comment: Update: It seems like class static variables are not parsed inside any quoted string. And because heredoc is practically a quoted string, they are not parsed inside heredoc too!!! Previous Comments: ------------------------------------------------------------------------ [2007-06-22 05:53:24] singlarahul21 at gmail dot com Description: ------------ A class static variable is not recognized & parsed inside heredoc. Instead the class name & scope resolution operator is passed in the string variable & the static variable name is tried to be parsed as a Independent local variable. Reproduce code: --------------- <?php class config { public static $Image="/images"; } class layout { public function writeLogo() { $text = <<<ABC <img class="Logo" title="My Logo" alt="Logo" src="{config::$Image}/Logo.gif" /> ABC; echo($text); } } $sample = new layout(); $sample->writeLogo(); ?> Expected result: ---------------- I expect the following tag to be outputted: <img class="Logo" title="My Logo" alt="Logo" src="/images/Logo.gif" /> Actual result: -------------- <img class="Logo" title="My Logo" alt="Logo" src="config::/Logo.gif" /> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41776&edit=1

« previous php.bugs (#114071) next »