From 09d9dfaaa94c69125ceb388c69bc18237837eec9 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Wed, 24 Feb 2016 23:37:25 +0100 Subject: tests for preg_replace --- tests/executor/preg_replace.phpt | 30 ++++++++++++++++++++++++++++++ tests/executor/preg_replace_error.phpt | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 tests/executor/preg_replace.phpt create mode 100644 tests/executor/preg_replace_error.phpt diff --git a/tests/executor/preg_replace.phpt b/tests/executor/preg_replace.phpt new file mode 100644 index 0000000..64d6671 --- /dev/null +++ b/tests/executor/preg_replace.phpt @@ -0,0 +1,30 @@ +--TEST-- +Testing protection against "\0" in preg_replace() first parameter +--SKIPIF-- + +--INI-- +suhosin.log.sapi=0 +--FILE-- + +--EXPECT-- +string(49) "One little boy with 2 dogs, 3 cats and four birds" +NULL +string(39) "The three cats play with the four birds" +NULL diff --git a/tests/executor/preg_replace_error.phpt b/tests/executor/preg_replace_error.phpt new file mode 100644 index 0000000..3d8244e --- /dev/null +++ b/tests/executor/preg_replace_error.phpt @@ -0,0 +1,32 @@ +--TEST-- +Testing protection against "\0" in preg_replace() first parameter (INCL. SUHOSIN ERROR MESSAGES) +--SKIPIF-- + +--INI-- +suhosin.log.sapi=64 +--FILE-- + +--EXPECTF-- +string(49) "One little boy with 2 dogs, 3 cats and four birds" +ALERT - string termination attack on first preg_replace parameter detected (attacker 'REMOTE_ADDR not set', file '%s', line 14) +NULL +string(39) "The three cats play with the four birds" +ALERT - string termination attack on first preg_replace parameter detected (attacker 'REMOTE_ADDR not set', file '%s', line 16) +NULL -- cgit v1.3