<?php
// printf/sprintf/etc broke between PHP 4.2.3 and PHP 4.3.0
// I reported it as bug #22227
// http://bugs.php.net/bug.php?id=22227
// Closed as being the same as #20108
// http://bugs.php.net/bug.php?id=20108
require( "Test.php" );
plan( 3 );
diag( "PHP Version" . phpversion() );
$masks = Array( "%-3.3s", "%.3s", "%-.3s" );
$str = "abcdefg";
foreach ( $masks as $mask ) {
$result = sprintf( "[$mask]", $str );
is( $result, "[abc]", "[$mask]" );
}
test_end();
?>
You'll note the similarities to Perl tests using Test::More. It's not a coincidence.
That first test breaks. It prints "[abcdefg]" instead of "[abc]". It runs fine under 4.2.3.
More importantly, why was someone mucking around with sprintf() such that it would segfault?
it's all too common (Score:1)
The PHP team have quite a history of mucking with the fundamentals and then knocking out a release. For this reason it's usually best to wait a month or so after a new version is released before upgrading.
Also, is your testing system completely homegrown or are you using PHPUnit [php.net] as well? Although some of the stuff that comes out of PEAR [php.net] is rather questionable :-/
broquaint out
Re:it's all too common (Score:2)
Plus, and most importantly for He Who Now Maintains Test::Harness, I want my PHP and Perl tests to run under the same harness.
--
xoa