Skip to content

Commit b0f28b6

Browse files
committed
Split variation test into 32 and 64 bits
1 parent f05164b commit b0f28b6

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 1
3+
--SKIPIF--
4+
<?php
5+
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
6+
?>
7+
--FILE--
8+
<?php
9+
/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
10+
* Description: Returns split line
11+
* Source code: ext/standard/string.c
12+
* Alias to functions: none
13+
*/
14+
15+
echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***\n";
16+
17+
$a=str_repeat("B", 65535);
18+
$b=1;
19+
$c=str_repeat("B", 65535);
20+
var_dump(chunk_split($a,$b,$c));
21+
?>
22+
--EXPECTF--
23+
*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***
24+
25+
Fatal error: Possible integer overflow in memory allocation (65536 * 65535 + 65556) in %s on line %d

ext/standard/tests/strings/chunk_split_variation1.phpt renamed to ext/standard/tests/strings/chunk_split_variation1_64bit.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 1
3+
--SKIPIF--
4+
<?php
5+
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6+
?>
37
--FILE--
48
<?php
59
/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 2
3+
--SKIPIF--
4+
<?php
5+
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
6+
?>
7+
--FILE--
8+
<?php
9+
/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
10+
* Description: Returns split line
11+
* Source code: ext/standard/string.c
12+
* Alias to functions: none
13+
*/
14+
15+
echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n";
16+
17+
$a=str_repeat("B", 65537);
18+
$b=1;
19+
$c=str_repeat("B", 65537);
20+
var_dump(chunk_split($a,$b,$c));
21+
?>
22+
--EXPECTF--
23+
*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***
24+
25+
Fatal error: Possible integer overflow in memory allocation (65538 * 65537 + 65556) in %s on line %d

ext/standard/tests/strings/chunk_split_variation2.phpt renamed to ext/standard/tests/strings/chunk_split_variation2_64bit.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 2
3+
--SKIPIF--
4+
<?php
5+
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6+
?>
37
--FILE--
48
<?php
59
/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])

0 commit comments

Comments
 (0)