#22227 [NEW]: printf() field limiters broke between 4.2.3 and 4.3.0

From: Date: Fri, 14 Feb 2003 23:59:22 +0000
Subject: #22227 [NEW]: printf() field limiters broke between 4.2.3 and 4.3.0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33209@lists.php.net to get a copy of this message
From: andy@petdance.com Operating system: Linux PHP version: 4.3.0 PHP Bug Type: Output Control Bug description: printf() field limiters broke between 4.2.3 and 4.3.0 Witness the following code: printf( "PHP Version=%s\n", phpversion() ); print "Output should be [abc] in all cases\n"; $masks = Array( "%-3.3s", "%.3s", "%-.3s" ); $str = "abcdefg"; foreach ( $masks as $mask ) { printf( "[$mask] <-- %s\n", $str, $mask ); } Under 4.2.3 we get: PHP Version=4.2.3 Output should be [abc] in all cases [abc] <-- %-3.3s [abc] <-- %.3s [abc] <-- %-.3s Under 4.3.0 we get: PHP Version=4.3.0 Output should be [abc] in all cases [abcdefg] <-- %-3.3s [abc] <-- %.3s [abc] <-- %-.3s This breaks a TON of column-formatting code for our application. We're reverting to 4.2.3 until this is fixed. The test suite in ext/standard/tests/general_functions/001.phpt does not test that specific combination of width & precision. -- Edit bug report at http://bugs.php.net/?id=22227&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22227&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22227&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22227&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22227&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22227&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22227&r=support Expected behavior: http://bugs.php.net/fix.php?id=22227&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22227&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22227&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22227&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22227&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22227&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22227&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22227&r=gnused

« previous php.bugs (#33209) next »