#22227 [Opn->Ver]: printf() field limiters broke between 4.2.3 and 4.3.0

From: Date: Sat, 15 Feb 2003 15:27:56 +0000
Subject: #22227 [Opn->Ver]: printf() field limiters broke between 4.2.3 and 4.3.0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33230@lists.php.net to get a copy of this message
ID: 22227 Updated by: moriyoshi@php.net Reported By: andy@petdance.com -Status: Open +Status: Verified Bug Type: Output Control Operating System: Linux -PHP Version: 4.3.0 +PHP Version: 4.3.0 / 4CVS-2003-02-16 / 5CVS-2003-02-16 New Comment: Related to bug #20108 Previous Comments: ------------------------------------------------------------------------ [2003-02-14 17:59:22] andy@petdance.com 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 this bug report at http://bugs.php.net/?id=22227&edit=1

« previous php.bugs (#33230) next »