Skip to content

Commit 828364e

Browse files
committed
add tests
1 parent 54c210d commit 828364e

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Test escapeshellarg() string with \0 bytes
3+
--FILE--
4+
<?php
5+
escapeshellarg("hello\0world");
6+
7+
?>
8+
===DONE===
9+
--EXPECTF--
10+
Fatal error: escapeshellarg(): Input string contains NULL bytes in %s on line %d
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Test escapeshellarg() allowed argument length
3+
--FILE--
4+
<?php
5+
ini_set('memory_limit', -1);
6+
$var_2 = str_repeat('A', 1024*1024*64);
7+
escapeshellarg($var_2);
8+
9+
?>
10+
===DONE===
11+
--EXPECTF--
12+
Fatal error: escapeshellarg(): Argument exceeds the allowed length of %d bytes in %s on line %d
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Test escapeshellcmd() string with \0 bytes
3+
--FILE--
4+
<?php
5+
escapeshellcmd("hello\0world");
6+
7+
?>
8+
===DONE===
9+
--EXPECTF--
10+
Fatal error: escapeshellcmd(): Input string contains NULL bytes in %s on line %d
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Test escapeshellcmd() allowed argument length
3+
--FILE--
4+
<?php
5+
ini_set('memory_limit', -1);
6+
$var_2 = str_repeat('A', 1024*1024*64);
7+
escapeshellcmd($var_2);
8+
9+
?>
10+
===DONE===
11+
--EXPECTF--
12+
Fatal error: escapeshellcmd(): Command exceeds the allowed length of %d bytes in %s on line %d

0 commit comments

Comments
 (0)