note 75649 rejected from function.sprintf by nlopess

From: Date: Fri, 26 Oct 2007 20:59:34 +0000
Subject: note 75649 rejected from function.sprintf by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-131761@lists.php.net to get a copy of this message
Note Submitter: Igor Butuc ---- I don't know if this is a bug or a limitation, but I got in trouble using inside sprintf a call to a class method (being inside the class), like this: <?php class MyClass{ ... public function Render(){ ... $strToReturn = sprintf('<table><tr><td>%s</td></tr></table>', $this->getControlHTML()); ... } } ?> The context was too complex to explain here and I didn't try to recreate the error in a simple context, but working with this code, I even got Apache crash (because sprintf did not return the right(expected) result). All trouble was gone when I changed to: <?php class MyClass{ ... public function Render(){ ... $controlHTML = $this->getControlHTML(); $strToReturn = sprintf('<table><tr><td>%s</td></tr></table>', $controlHTML ); ... } } ?> I didn't find any notes/comments here on this limitation, and no related bug. (I use PHP 5.1.6 and Apache 2.2.3 on WinXP32)

« previous php.notes (#131761) next »