#42130 [NEW]: Echo / Print Statements using OOP place OOP before string

From: Date: Sat, 28 Jul 2007 02:16:49 +0000
Subject: #42130 [NEW]: Echo / Print Statements using OOP place OOP before string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115510@lists.php.net to get a copy of this message
From: scott at truebluewc dot com Operating system: Linux PHP version: 5.2.3 PHP Bug Type: *General Issues Bug description: Echo / Print Statements using OOP place OOP before string Description: ------------ When using an echo, print or a combination of those statements with an OOP, the OOP function within an echo statement, and using an echo inside that function, causes that function's echo to be first outputed before the echo statement called originally. See below code. Reproduce code: --------------- class file - syrup.php <?php class syrup { function pancakes() { echo "syrup on my pancakes!"; } } ?> main file - index.php <?php function __autoload($classname) { include_once("$classname.php"); } echo "I love ".syrup::pancakes()."<br />"; echo "and I hate ".syrup::pancakes(); echo "<br />Actually.. I can't really decide!"; ?> Expected result: ---------------- I love syrup on my pancakes! and I hate syrup on my pancakes! Actually.. I can't really decide! Actual result: -------------- syrup on my pancakes!I love syrup on my pancakes!and I hate Actually.. I can't really decide! -- Edit bug report at http://bugs.php.net/?id=42130&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42130&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42130&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42130&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42130&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42130&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42130&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42130&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42130&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42130&r=support Expected behavior: http://bugs.php.net/fix.php?id=42130&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42130&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42130&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42130&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42130&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42130&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42130&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42130&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42130&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42130&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42130&r=mysqlcfg

« previous php.bugs (#115510) next »