mirror of
https://github.com/php/php-src.git
synced 2024-12-01 22:03:36 +08:00
Merge branch 'PHP-5.4'
* PHP-5.4: Added the intl tests extracted from Symfony. These are making the intl ext crash with ICU at least 4.6, but probably with earlier versions too.
This commit is contained in:
commit
7e2d550e88
49
ext/intl/tests/symfony_format_type_int32_intl1.phpt
Normal file
49
ext/intl/tests/symfony_format_type_int32_intl1.phpt
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// port of Symfony's Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest#testFormatTypeInt32Intl
|
||||||
|
|
||||||
|
|
||||||
|
// Crashes on Windows
|
||||||
|
// Windows note: the popup '...program has stopped working'(AEDebug Popup)
|
||||||
|
// doesn't always show if you're rapidly running this test repeatedly.
|
||||||
|
// regardless of that, the test always crashes every time.
|
||||||
|
// (it will show up the first time, or if you wait a while before running it again.)
|
||||||
|
// (the popup may also be disabled, which can be done with a registry setting.)
|
||||||
|
// you can confirm it crashed by checking the exit code OR
|
||||||
|
// the message this test prints at the very end (expected output for pass).
|
||||||
|
//
|
||||||
|
// Get Exit Code
|
||||||
|
// Linux: echo $?
|
||||||
|
// Windows: echo %ErrorLevel%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
int(1)
|
||||||
|
[2]=>
|
||||||
|
string(1) "1"
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
33
ext/intl/tests/symfony_format_type_int32_intl2.phpt
Normal file
33
ext/intl/tests/symfony_format_type_int32_intl2.phpt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// StubNumberFormatterTest#testFormatTypeInt32Intl is tested many times, each with different args.
|
||||||
|
// there are 7 sets of args that crash PHP (and other args that don't), each of those 7 is now a separate PHPT test
|
||||||
|
// to ensure that each of the 7 args are always tested.
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
float(1.1)
|
||||||
|
[2]=>
|
||||||
|
string(1) "1"
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
32
ext/intl/tests/symfony_format_type_int32_intl3.phpt
Normal file
32
ext/intl/tests/symfony_format_type_int32_intl3.phpt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:14:"-2,147,483,648";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(4) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
float(2147483648)
|
||||||
|
[2]=>
|
||||||
|
string(14) "-2,147,483,648"
|
||||||
|
[3]=>
|
||||||
|
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
30
ext/intl/tests/symfony_format_type_int32_intl4.phpt
Normal file
30
ext/intl/tests/symfony_format_type_int32_intl4.phpt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
int(1)
|
||||||
|
[2]=>
|
||||||
|
string(7) "SFD1.00"
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
30
ext/intl/tests/symfony_format_type_int32_intl5.phpt
Normal file
30
ext/intl/tests/symfony_format_type_int32_intl5.phpt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
float(1.1)
|
||||||
|
[2]=>
|
||||||
|
string(7) "SFD1.00"
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
32
ext/intl/tests/symfony_format_type_int32_intl6.phpt
Normal file
32
ext/intl/tests/symfony_format_type_int32_intl6.phpt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:21:"(SFD2,147,483,648.00)";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(4) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
float(2147483648)
|
||||||
|
[2]=>
|
||||||
|
string(21) "(SFD2,147,483,648.00)"
|
||||||
|
[3]=>
|
||||||
|
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
32
ext/intl/tests/symfony_format_type_int32_intl7.phpt
Normal file
32
ext/intl/tests/symfony_format_type_int32_intl7.phpt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
--TEST--
|
||||||
|
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:19:"SFD2,147,483,647.00";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
|
||||||
|
|
||||||
|
var_dump($unit_test_args);
|
||||||
|
|
||||||
|
// execute the code from #testFormatTypeInt32Intl
|
||||||
|
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
|
||||||
|
|
||||||
|
echo "== didn't crash ==".PHP_EOL;
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
array(4) {
|
||||||
|
[0]=>
|
||||||
|
object(NumberFormatter)#1 (0) {
|
||||||
|
}
|
||||||
|
[1]=>
|
||||||
|
float(-2147483649)
|
||||||
|
[2]=>
|
||||||
|
string(19) "SFD2,147,483,647.00"
|
||||||
|
[3]=>
|
||||||
|
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
|
||||||
|
}
|
||||||
|
== didn't crash ==
|
Loading…
Reference in New Issue
Block a user