note 75649 added to function.sprintf

From: Date: Sun, 10 Jun 2007 17:08:01 +0000
Subject: note 75649 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-127361@lists.php.net to get a copy of this message
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) ---- Server IP: 69.147.83.197 Probable Submitter: 89.32.22.10 ---- Manual Page -- http://www.php.net/manual/en/function.sprintf.php Edit -- https://master.php.net/note/edit/75649 Del: integrated -- https://master.php.net/note/delete/75649/integrated Del: useless -- https://master.php.net/note/delete/75649/useless Del: bad code -- https://master.php.net/note/delete/75649/bad+code Del: spam -- https://master.php.net/note/delete/75649/spam Del: non-english -- https://master.php.net/note/delete/75649/non-english Del: in docs -- https://master.php.net/note/delete/75649/in+docs Del: other reasons-- https://master.php.net/note/delete/75649 Reject -- https://master.php.net/note/reject/75649 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127361) next »