summaryrefslogtreecommitdiff
path: root/ext/ereg/tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/ereg/tests
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/ereg/tests')
-rw-r--r--ext/ereg/tests/001.phpt8
-rw-r--r--ext/ereg/tests/002.phpt8
-rw-r--r--ext/ereg/tests/003.phpt9
-rw-r--r--ext/ereg/tests/004.phpt17
-rw-r--r--ext/ereg/tests/005.phpt19
-rw-r--r--ext/ereg/tests/006.phpt9
-rw-r--r--ext/ereg/tests/007.phpt11
-rw-r--r--ext/ereg/tests/008.phpt9
-rw-r--r--ext/ereg/tests/009.phpt18
-rw-r--r--ext/ereg/tests/010.phpt8
-rw-r--r--ext/ereg/tests/011.phpt8
-rw-r--r--ext/ereg/tests/012.phpt8
-rw-r--r--ext/ereg/tests/013.phpt8
-rw-r--r--ext/ereg/tests/014.phpt8
-rw-r--r--ext/ereg/tests/015.phpt7
-rw-r--r--ext/ereg/tests/016.phpt7
-rw-r--r--ext/ereg/tests/ereg_basic_001.phpt153
-rw-r--r--ext/ereg/tests/ereg_basic_002.phpt82
-rw-r--r--ext/ereg/tests/ereg_basic_003.phpt28
-rw-r--r--ext/ereg/tests/ereg_basic_004.phpt44
-rw-r--r--ext/ereg/tests/ereg_error_001.phpt49
-rw-r--r--ext/ereg/tests/ereg_error_002.phpt118
-rw-r--r--ext/ereg/tests/ereg_replace_basic_001.phpt86
-rw-r--r--ext/ereg/tests/ereg_replace_basic_002.phpt41
-rw-r--r--ext/ereg/tests/ereg_replace_error_001.phpt46
-rw-r--r--ext/ereg/tests/ereg_replace_error_002.phpt106
-rw-r--r--ext/ereg/tests/ereg_replace_variation_001.phpt205
-rw-r--r--ext/ereg/tests/ereg_replace_variation_002.phpt193
-rw-r--r--ext/ereg/tests/ereg_replace_variation_003.phpt198
-rw-r--r--ext/ereg/tests/ereg_variation_001.phpt208
-rw-r--r--ext/ereg/tests/ereg_variation_002.phpt198
-rw-r--r--ext/ereg/tests/ereg_variation_003.phpt305
-rw-r--r--ext/ereg/tests/ereg_variation_004.phpt19
-rw-r--r--ext/ereg/tests/eregi_basic.phpt45
-rw-r--r--ext/ereg/tests/eregi_basic_001.phpt153
-rw-r--r--ext/ereg/tests/eregi_basic_002.phpt82
-rw-r--r--ext/ereg/tests/eregi_basic_003.phpt28
-rw-r--r--ext/ereg/tests/eregi_basic_004.phpt40
-rw-r--r--ext/ereg/tests/eregi_error_001.phpt49
-rw-r--r--ext/ereg/tests/eregi_error_002.phpt118
-rw-r--r--ext/ereg/tests/eregi_replace_basic.phpt38
-rw-r--r--ext/ereg/tests/eregi_replace_basic_001.phpt86
-rw-r--r--ext/ereg/tests/eregi_replace_basic_002.phpt37
-rw-r--r--ext/ereg/tests/eregi_replace_error_001.phpt46
-rw-r--r--ext/ereg/tests/eregi_replace_error_002.phpt106
-rw-r--r--ext/ereg/tests/eregi_replace_variation_001.phpt205
-rw-r--r--ext/ereg/tests/eregi_replace_variation_002.phpt193
-rw-r--r--ext/ereg/tests/eregi_replace_variation_003.phpt198
-rw-r--r--ext/ereg/tests/eregi_variation_001.phpt208
-rw-r--r--ext/ereg/tests/eregi_variation_002.phpt198
-rw-r--r--ext/ereg/tests/eregi_variation_003.phpt305
-rw-r--r--ext/ereg/tests/eregi_variation_004.phpt19
-rw-r--r--ext/ereg/tests/regular_expressions.inc24
-rw-r--r--ext/ereg/tests/split_basic_001.phpt155
-rw-r--r--ext/ereg/tests/split_basic_002.phpt253
-rw-r--r--ext/ereg/tests/split_basic_003.phpt59
-rw-r--r--ext/ereg/tests/split_error_001.phpt45
-rw-r--r--ext/ereg/tests/split_error_002.phpt118
-rw-r--r--ext/ereg/tests/split_variation_001.phpt257
-rw-r--r--ext/ereg/tests/split_variation_002.phpt257
-rw-r--r--ext/ereg/tests/split_variation_003.phpt231
-rw-r--r--ext/ereg/tests/split_variation_004.phpt43
-rw-r--r--ext/ereg/tests/spliti_basic_001.phpt155
-rw-r--r--ext/ereg/tests/spliti_basic_002.phpt253
-rw-r--r--ext/ereg/tests/spliti_basic_003.phpt52
-rw-r--r--ext/ereg/tests/spliti_basic_004.phpt52
-rw-r--r--ext/ereg/tests/spliti_error_001.phpt45
-rw-r--r--ext/ereg/tests/spliti_error_002.phpt118
-rw-r--r--ext/ereg/tests/spliti_variation_001.phpt257
-rw-r--r--ext/ereg/tests/spliti_variation_002.phpt257
-rw-r--r--ext/ereg/tests/spliti_variation_003.phpt231
-rw-r--r--ext/ereg/tests/spliti_variation_004.phpt43
-rw-r--r--ext/ereg/tests/sql_regcase_basic_001.phpt27
-rw-r--r--ext/ereg/tests/sql_regcase_error_001.phpt41
-rw-r--r--ext/ereg/tests/sql_regcase_variation_001.phpt196
75 files changed, 7564 insertions, 0 deletions
diff --git a/ext/ereg/tests/001.phpt b/ext/ereg/tests/001.phpt
new file mode 100644
index 0000000..0ba6979
--- /dev/null
+++ b/ext/ereg/tests/001.phpt
@@ -0,0 +1,8 @@
+--TEST--
+RegReplace test 1
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def",$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abcdef
diff --git a/ext/ereg/tests/002.phpt b/ext/ereg/tests/002.phpt
new file mode 100644
index 0000000..6ce12a9
--- /dev/null
+++ b/ext/ereg/tests/002.phpt
@@ -0,0 +1,8 @@
+--TEST--
+RegReplace test 2
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","",$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abc
diff --git a/ext/ereg/tests/003.phpt b/ext/ereg/tests/003.phpt
new file mode 100644
index 0000000..5431349
--- /dev/null
+++ b/ext/ereg/tests/003.phpt
@@ -0,0 +1,9 @@
+--TEST--
+ereg_replace single-quote test
+--FILE--
+<?php $a="\\'test";
+ echo ereg_replace("\\\\'","'",$a)
+?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+'test
diff --git a/ext/ereg/tests/004.phpt b/ext/ereg/tests/004.phpt
new file mode 100644
index 0000000..db16fe1
--- /dev/null
+++ b/ext/ereg/tests/004.phpt
@@ -0,0 +1,17 @@
+--TEST--
+simple ereg test
+--FILE--
+<?php $a="This is a nice and simple string";
+ if (ereg(".*nice and simple.*",$a)) {
+ echo "ok\n";
+ }
+ if (!ereg(".*doesn't exist.*",$a)) {
+ echo "ok\n";
+ }
+?>
+--EXPECTF--
+Deprecated: Function ereg() is deprecated in %s on line %d
+ok
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+ok
diff --git a/ext/ereg/tests/005.phpt b/ext/ereg/tests/005.phpt
new file mode 100644
index 0000000..127ede0
--- /dev/null
+++ b/ext/ereg/tests/005.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test Regular expression register support in ereg
+--FILE--
+<?php $a="This is a nice and simple string";
+ echo ereg(".*(is).*(is).*",$a,$registers);
+ echo "\n";
+ echo $registers[0];
+ echo "\n";
+ echo $registers[1];
+ echo "\n";
+ echo $registers[2];
+ echo "\n";
+?>
+--EXPECTF--
+Deprecated: Function ereg() is deprecated in %s on line %d
+32
+This is a nice and simple string
+is
+is
diff --git a/ext/ereg/tests/006.phpt b/ext/ereg/tests/006.phpt
new file mode 100644
index 0000000..7df88dd
--- /dev/null
+++ b/ext/ereg/tests/006.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test ereg_replace of start-of-line
+--FILE--
+<?php $a="This is a nice and simple string";
+ echo ereg_replace("^This","That",$a);
+?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+That is a nice and simple string
diff --git a/ext/ereg/tests/007.phpt b/ext/ereg/tests/007.phpt
new file mode 100644
index 0000000..3bbd655
--- /dev/null
+++ b/ext/ereg/tests/007.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test empty result buffer in reg_replace
+--FILE--
+<?php
+ $a="abcd";
+ $b=ereg_replace("abcd","",$a);
+ echo "strlen(\$b)=".strlen($b);
+?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+strlen($b)=0
diff --git a/ext/ereg/tests/008.phpt b/ext/ereg/tests/008.phpt
new file mode 100644
index 0000000..ad34ba3
--- /dev/null
+++ b/ext/ereg/tests/008.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test back-references in regular expressions
+--FILE--
+<?php
+ echo ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
+?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+123 abc +-|=
diff --git a/ext/ereg/tests/009.phpt b/ext/ereg/tests/009.phpt
new file mode 100644
index 0000000..513f31a
--- /dev/null
+++ b/ext/ereg/tests/009.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test split()
+--FILE--
+<?php
+ $a=split("[[:space:]]","this is a
+test");
+ echo count($a) . "\n";
+ for ($i = 0; $i < count($a); $i++) {
+ echo $a[$i] . "\n";
+ }
+?>
+--EXPECTF--
+Deprecated: Function split() is deprecated in %s on line %d
+4
+this
+is
+a
+test
diff --git a/ext/ereg/tests/010.phpt b/ext/ereg/tests/010.phpt
new file mode 100644
index 0000000..52a3e3b
--- /dev/null
+++ b/ext/ereg/tests/010.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Long back references
+--FILE--
+<?php $a="abc122222222223";
+ echo ereg_replace("1(2*)3","\\1def\\1",$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abc2222222222def2222222222
diff --git a/ext/ereg/tests/011.phpt b/ext/ereg/tests/011.phpt
new file mode 100644
index 0000000..8bd51b4
--- /dev/null
+++ b/ext/ereg/tests/011.phpt
@@ -0,0 +1,8 @@
+--TEST--
+\0 back reference
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def\\0ghi",$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abcdef123ghi
diff --git a/ext/ereg/tests/012.phpt b/ext/ereg/tests/012.phpt
new file mode 100644
index 0000000..d54ae01
--- /dev/null
+++ b/ext/ereg/tests/012.phpt
@@ -0,0 +1,8 @@
+--TEST--
+nonexisting back reference
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123",'def\1ghi',$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abcdef\1ghi
diff --git a/ext/ereg/tests/013.phpt b/ext/ereg/tests/013.phpt
new file mode 100644
index 0000000..23f6944
--- /dev/null
+++ b/ext/ereg/tests/013.phpt
@@ -0,0 +1,8 @@
+--TEST--
+escapes in replace string
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def\\g\\\\hi\\",$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abcdef\g\\hi\
diff --git a/ext/ereg/tests/014.phpt b/ext/ereg/tests/014.phpt
new file mode 100644
index 0000000..ac68802
--- /dev/null
+++ b/ext/ereg/tests/014.phpt
@@ -0,0 +1,8 @@
+--TEST--
+backreferences not replaced recursively
+--FILE--
+<?php $a="a\\2bxc";
+ echo ereg_replace("a(.*)b(.*)c","\\1",$a)?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+\2
diff --git a/ext/ereg/tests/015.phpt b/ext/ereg/tests/015.phpt
new file mode 100644
index 0000000..edb8e70
--- /dev/null
+++ b/ext/ereg/tests/015.phpt
@@ -0,0 +1,7 @@
+--TEST--
+replace empty matches
+--FILE--
+<?php echo ereg_replace("^","z","abc123")?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+zabc123
diff --git a/ext/ereg/tests/016.phpt b/ext/ereg/tests/016.phpt
new file mode 100644
index 0000000..93dbda7
--- /dev/null
+++ b/ext/ereg/tests/016.phpt
@@ -0,0 +1,7 @@
+--TEST--
+test backslash handling in regular expressions
+--FILE--
+<?php echo ereg_replace('\?',"abc","?123?")?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+abc123abc
diff --git a/ext/ereg/tests/ereg_basic_001.phpt b/ext/ereg/tests/ereg_basic_001.phpt
new file mode 100644
index 0000000..e9dad37
--- /dev/null
+++ b/ext/ereg/tests/ereg_basic_001.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test ereg() function : basic functionality (with $regs)
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with ereg, specifying $regs
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(ereg($pattern, $string, $regs));
+ var_dump($regs);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(6)
+array(3) {
+ [0]=>
+ string(6) "- ab -"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+}
+--> Pattern: '()'; string: ''
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '()'; string: 'abcdef'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(15)
+array(6) {
+ [0]=>
+ string(15) "aaa bbb ccc ddd"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(2) "aa"
+ [3]=>
+ string(3) "bbb"
+ [4]=>
+ string(3) "ccc"
+ [5]=>
+ string(3) "ddd"
+}
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(14)
+array(1) {
+ [0]=>
+ string(14) "\`^.[$()|*+?{'"
+}
+--> Pattern: '\a'; string: 'a'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(2)
+array(1) {
+ [0]=>
+ string(2) "2a"
+}
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(62)
+array(1) {
+ [0]=>
+ string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(5)
+array(1) {
+ [0]=>
+ string(5) "01234"
+}
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(5)
+array(1) {
+ [0]=>
+ string(5) "56789"
+}
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(2)
+array(1) {
+ [0]=>
+ string(2) " "
+}
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(3)
+array(1) {
+ [0]=>
+ string(3) " a "
+}
+Done
diff --git a/ext/ereg/tests/ereg_basic_002.phpt b/ext/ereg/tests/ereg_basic_002.phpt
new file mode 100644
index 0000000..75665fb
--- /dev/null
+++ b/ext/ereg/tests/ereg_basic_002.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test ereg() function : basic functionality (without $regs)
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with ereg, without specifying $regs
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(ereg($pattern, $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '()'; string: ''
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '()'; string: 'abcdef'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '\a'; string: 'a'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+Done
diff --git a/ext/ereg/tests/ereg_basic_003.phpt b/ext/ereg/tests/ereg_basic_003.phpt
new file mode 100644
index 0000000..0cbe079
--- /dev/null
+++ b/ext/ereg/tests/ereg_basic_003.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test ereg() function : basic functionality - long RE
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a long RE with lots of matches
+ */
+
+var_dump(ereg(str_repeat('(.)', 2048), str_repeat('x', 2048)));
+var_dump(ereg(str_repeat('(.)', 2048), str_repeat('x', 2048), $regs));
+var_dump(count($regs));
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(1)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(2048)
+int(2049)
+Done
diff --git a/ext/ereg/tests/ereg_basic_004.phpt b/ext/ereg/tests/ereg_basic_004.phpt
new file mode 100644
index 0000000..20bdf80
--- /dev/null
+++ b/ext/ereg/tests/ereg_basic_004.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test ereg() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$regs = 'original';
+
+var_dump(ereg('A', 'a', $regs));
+var_dump(ereg('[A-Z]', '0', $regs));
+var_dump(ereg('(a){4}', 'aaa', $regs));
+var_dump(ereg('^a', 'ba', $regs));
+var_dump(ereg('b$', 'ba', $regs));
+var_dump(ereg('[:alpha:]', 'x', $regs));
+
+// Ensure $regs is unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function ereg() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+bool(false)
+string(8) "original"
+Done
diff --git a/ext/ereg/tests/ereg_error_001.phpt b/ext/ereg/tests/ereg_error_001.phpt
new file mode 100644
index 0000000..ccb7708
--- /dev/null
+++ b/ext/ereg/tests/ereg_error_001.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test ereg() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test wrong number of args
+ */
+
+echo "*** Testing ereg() : error conditions ***\n";
+
+
+//Test ereg with one more than the expected number of arguments
+echo "\n-- Testing ereg() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$registers = array(1, 2);
+$extra_arg = 10;
+var_dump( ereg($pattern, $string, $registers, $extra_arg) );
+
+// Testing ereg with one less than the expected number of arguments
+echo "\n-- Testing ereg() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( ereg($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : error conditions ***
+
+-- Testing ereg() function with more than expected no. of arguments --
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing ereg() function with less than expected no. of arguments --
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/ereg_error_002.phpt b/ext/ereg/tests/ereg_error_002.phpt
new file mode 100644
index 0000000..707b731
--- /dev/null
+++ b/ext/ereg/tests/ereg_error_002.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test ereg() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing ereg() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(ereg("", "hello"));
+var_dump(ereg("c(d", "hello"));
+var_dump(ereg("a[b", "hello"));
+var_dump(ereg("c(d", "hello"));
+var_dump(ereg("*", "hello"));
+var_dump(ereg("+", "hello"));
+var_dump(ereg("?", "hello"));
+var_dump(ereg("(+?*)", "hello", $regs));
+var_dump(ereg("h{256}", "hello"));
+var_dump(ereg("h|", "hello"));
+var_dump(ereg("h{0}", "hello"));
+var_dump(ereg("h{2,1}", "hello"));
+var_dump(ereg('[a-c-e]', 'd'));
+var_dump(ereg('\\', 'x'));
+var_dump(ereg('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : error conditions ***
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EBRACK in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_ERANGE in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_EESCAPE in %s on line %d
+bool(false)
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+
+Warning: ereg(): REG_ERANGE in %s on line %d
+bool(false)
+string(8) "original"
+Done
diff --git a/ext/ereg/tests/ereg_replace_basic_001.phpt b/ext/ereg/tests/ereg_replace_basic_001.phpt
new file mode 100644
index 0000000..66b056e
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_basic_001.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test ereg_replace() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with ereg_replace
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+$replacement = '[this is a replacement]';
+
+foreach ($expressions as $re) {
+ list($pattern, $match) = $re;
+ echo "--> Pattern: '$pattern'; match: '$match'\n";
+ var_dump(ereg_replace($pattern, $replacement, $match . ' this contains some matches ' . $match));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--"
+--> Pattern: '()'; match: ''
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]"
+--> Pattern: '()'; match: 'abcdef'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]"
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]"
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---"
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '\a'; match: 'a'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]"
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(66) "[this is a replacement]56789 this contains some matches 0123456789"
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(66) "0123456789 this contains some matches 01234[this is a replacement]"
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(163) "
+[this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement]
+[this is a replacement]"
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] "
+Done
diff --git a/ext/ereg/tests/ereg_replace_basic_002.phpt b/ext/ereg/tests/ereg_replace_basic_002.phpt
new file mode 100644
index 0000000..e12612d
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_basic_002.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test ereg_replace() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(ereg_replace('A', $replacement, 'a'));
+var_dump(ereg_replace('[A-Z]', $replacement, '0'));
+var_dump(ereg_replace('(a){4}', $replacement, 'aaa'));
+var_dump(ereg_replace('^a', $replacement, 'ba'));
+var_dump(ereg_replace('b$', $replacement, 'ba'));
+var_dump(ereg_replace('[:alpha:]', $replacement, 'x'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(1) "a"
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(1) "0"
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(3) "aaa"
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(2) "ba"
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(2) "ba"
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+string(1) "x"
+Done
diff --git a/ext/ereg/tests/ereg_replace_error_001.phpt b/ext/ereg/tests/ereg_replace_error_001.phpt
new file mode 100644
index 0000000..d49d87f
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_error_001.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test ereg_replace() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ereg_replace() : error conditions ***\n";
+
+
+//Test ereg_replace with one more than the expected number of arguments
+echo "\n-- Testing ereg_replace() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( ereg_replace($pattern, $replacement, $string, $extra_arg) );
+
+// Testing ereg_replace with one less than the expected number of arguments
+echo "\n-- Testing ereg_replace() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+var_dump( ereg_replace($pattern, $replacement) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : error conditions ***
+
+-- Testing ereg_replace() function with more than expected no. of arguments --
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace() expects exactly 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing ereg_replace() function with less than expected no. of arguments --
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace() expects exactly 3 parameters, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/ereg_replace_error_002.phpt b/ext/ereg/tests/ereg_replace_error_002.phpt
new file mode 100644
index 0000000..b161a0d
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_error_002.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Test ereg_replace() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ereg_replace() : bad REs ***\n";
+var_dump(ereg_replace("", "hello", "some string"));
+var_dump(ereg_replace("c(d", "hello", "some string"));
+var_dump(ereg_replace("a[b", "hello", "some string"));
+var_dump(ereg_replace("c(d", "hello", "some string"));;
+var_dump(ereg_replace("*", "hello", "some string"));
+var_dump(ereg_replace("+", "hello", "some string"));
+var_dump(ereg_replace("?", "hello", "some string"));
+var_dump(ereg_replace("(+?*)", "hello", "some string"));
+var_dump(ereg_replace("h{256}", "hello", "some string"));
+var_dump(ereg_replace("h|", "hello", "some string"));
+var_dump(ereg_replace("h{0}", "hello", "some string"));
+var_dump(ereg_replace("h{2,1}", "hello", "some string"));
+var_dump(ereg_replace('[a-c-e]', 'd', "some string"));
+var_dump(ereg_replace('\\', 'x', "some string"));
+var_dump(ereg_replace('([9-0])', '1', "some string"));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : bad REs ***
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EBRACK in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_ERANGE in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_EESCAPE in %s on line %d
+bool(false)
+
+Deprecated: Function ereg_replace() is deprecated in %s on line %d
+
+Warning: ereg_replace(): REG_ERANGE in %s on line %d
+bool(false)
+Done
diff --git a/ext/ereg/tests/ereg_replace_variation_001.phpt b/ext/ereg/tests/ereg_replace_variation_001.phpt
new file mode 100644
index 0000000..1e16d1c
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_variation_001.phpt
@@ -0,0 +1,205 @@
+--TEST--
+Test ereg_replace() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$replacement = 'new';
+$string = 'original';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg_replace($value, $replacement, $string) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 12345
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value -2345
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 10.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value -10.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 101234567000
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 0.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+Error: 8 - Array to string conversion, %sereg_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace(): REG_EMPTY, %s(74)
+bool(false)
+Done
diff --git a/ext/ereg/tests/ereg_replace_variation_002.phpt b/ext/ereg/tests/ereg_replace_variation_002.phpt
new file mode 100644
index 0000000..afaece6
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_variation_002.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test ereg_replace() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = b'ell';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for replacement
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump(urlencode(ereg_replace($pattern, $value, $string)));
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value 12345
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(6) "h9o%21"
+
+Arg value -2345
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%D7o%21"
+
+Arg value 10.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%0Ao%21"
+
+Arg value -10.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%F6o%21"
+
+Arg value 101234567000
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(%d) "h%so%21"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 0.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+Error: 8 - Array to string conversion, %sereg_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Done \ No newline at end of file
diff --git a/ext/ereg/tests/ereg_replace_variation_003.phpt b/ext/ereg/tests/ereg_replace_variation_003.phpt
new file mode 100644
index 0000000..b189c4e
--- /dev/null
+++ b/ext/ereg/tests/ereg_replace_variation_003.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test ereg_replace() function : usage variations - unexpected type arg 3
+--FILE--
+<?php
+/* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$replacement = 'new value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg_replace($pattern, $replacement, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(1) "0"
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(9) "new value"
+
+Arg value 12345
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(13) "new value2345"
+
+Arg value -2345
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(5) "-2345"
+
+Arg value 10.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(12) "new value0.5"
+
+Arg value -10.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(13) "-new value0.5"
+
+Arg value 101234567000
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(28) "new value0new value234567000"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(29) "new value.0765432new valueE-9"
+
+Arg value 0.5
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(3) "0.5"
+Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(9) "new value"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value 1
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(9) "new value"
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+Error: 2 - ereg_replace() expects parameter 3 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function ereg_replace() is deprecated, %s(74)
+string(0) ""
+Done
diff --git a/ext/ereg/tests/ereg_variation_001.phpt b/ext/ereg/tests/ereg_variation_001.phpt
new file mode 100644
index 0000000..8e28d89
--- /dev/null
+++ b/ext/ereg/tests/ereg_variation_001.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test ereg() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1';
+$registers = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg($value, $string, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(65)
+Error: 8 - Undefined variable: unset_var, %s(68)
+
+Arg value 0
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(75)
+int(1)
+
+Arg value 12345
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value -2345
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value 10.5
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value -10.5
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value 101234567000
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value 1.07654321E-9
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+
+Arg value 0.5
+Error: 8192 - Function ereg() is deprecated, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(75)
+int(1)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(75)
+int(1)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
+Error: 8 - Object of class stdClass to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(75)
+Error: 2 - ereg(): REG_EMPTY, %s(75)
+bool(false)
+Done
diff --git a/ext/ereg/tests/ereg_variation_002.phpt b/ext/ereg/tests/ereg_variation_002.phpt
new file mode 100644
index 0000000..33e0fe1
--- /dev/null
+++ b/ext/ereg/tests/ereg_variation_002.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test ereg() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$registers = array();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg($pattern, $value, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value 12345
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value -2345
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value 10.5
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value -10.5
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value 101234567000
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value 1.07654321E-9
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value 0.5
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(74)
+Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(74)
+Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(74)
+Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(74)
+Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sereg_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function ereg() is deprecated, %s(74)
+Error: 2 - ereg() expects parameter 2 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(74)
+int(1)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+Error: 2 - ereg() expects parameter 2 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(74)
+bool(false)
+Done
diff --git a/ext/ereg/tests/ereg_variation_003.phpt b/ext/ereg/tests/ereg_variation_003.phpt
new file mode 100644
index 0000000..bf898d9
--- /dev/null
+++ b/ext/ereg/tests/ereg_variation_003.phpt
@@ -0,0 +1,305 @@
+--TEST--
+Test ereg() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing ereg() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'h(.*)lo!';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for registers
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( ereg($pattern, $string, $value) );
+ var_dump($value);
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 0
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 12345
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -2345
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 10.5
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -10.5
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 101234567000
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 0.5
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function ereg() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Done
diff --git a/ext/ereg/tests/ereg_variation_004.phpt b/ext/ereg/tests/ereg_variation_004.phpt
new file mode 100644
index 0000000..86f616f
--- /dev/null
+++ b/ext/ereg/tests/ereg_variation_004.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test ereg() function : usage variations - pass non-variable as arg 3, which is pass-by-ref.
+--FILE--
+<?php
+/* Prototype : proto int ereg(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+var_dump(ereg('l{2}', 'hello', str_repeat('x',1)));
+echo "Done";
+?>
+--EXPECTF--
+Strict Standards: Only variables should be passed by reference in %s on line %d
+
+Deprecated: Function ereg() is deprecated in %s on line %d
+int(2)
+Done
diff --git a/ext/ereg/tests/eregi_basic.phpt b/ext/ereg/tests/eregi_basic.phpt
new file mode 100644
index 0000000..14b4b7d
--- /dev/null
+++ b/ext/ereg/tests/eregi_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test eregi() function : basic functionality - confirm case insensitivity
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Case-insensitive regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic funtionality of eregi()
+ */
+
+echo "*** Testing eregi() : basic functionality ***\n";
+$string = <<<END
+UPPERCASE WORDS
+lowercase words
+MIxED CaSe woRdS
+END;
+
+var_dump(eregi('words', $string, $match1));
+var_dump($match1);
+
+var_dump(eregi('[[:lower:]]+[[:space:]]case', $string, $match2)); //character class lower should just match [a-z] but in case insensitive search matches [a-zA-Z]
+var_dump($match2);
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : basic functionality ***
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(5)
+array(1) {
+ [0]=>
+ string(5) "WORDS"
+}
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(10)
+array(1) {
+ [0]=>
+ string(10) "MIxED CaSe"
+}
+Done
diff --git a/ext/ereg/tests/eregi_basic_001.phpt b/ext/ereg/tests/eregi_basic_001.phpt
new file mode 100644
index 0000000..9460b89
--- /dev/null
+++ b/ext/ereg/tests/eregi_basic_001.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test eregi() function : basic functionality (with $regs)
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with eregi, specifying $regs
+ */
+
+echo "*** Testing eregi() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(eregi($pattern, $string, $regs));
+ var_dump($regs);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(6)
+array(3) {
+ [0]=>
+ string(6) "- ab -"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "b"
+}
+--> Pattern: '()'; string: ''
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '()'; string: 'abcdef'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+}
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(15)
+array(6) {
+ [0]=>
+ string(15) "aaa bbb ccc ddd"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(2) "aa"
+ [3]=>
+ string(3) "bbb"
+ [4]=>
+ string(3) "ccc"
+ [5]=>
+ string(3) "ddd"
+}
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(14)
+array(1) {
+ [0]=>
+ string(14) "\`^.[$()|*+?{'"
+}
+--> Pattern: '\a'; string: 'a'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(2)
+array(1) {
+ [0]=>
+ string(2) "2a"
+}
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(62)
+array(1) {
+ [0]=>
+ string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(5)
+array(1) {
+ [0]=>
+ string(5) "01234"
+}
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(5)
+array(1) {
+ [0]=>
+ string(5) "56789"
+}
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(2)
+array(1) {
+ [0]=>
+ string(2) " "
+}
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(3)
+array(1) {
+ [0]=>
+ string(3) " a "
+}
+Done
diff --git a/ext/ereg/tests/eregi_basic_002.phpt b/ext/ereg/tests/eregi_basic_002.phpt
new file mode 100644
index 0000000..f81821a
--- /dev/null
+++ b/ext/ereg/tests/eregi_basic_002.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test eregi() function : basic functionality (without $regs)
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with eregi, without specifying $regs
+ */
+
+echo "*** Testing eregi() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "--> Pattern: '$pattern'; string: '$string'\n";
+ var_dump(eregi($pattern, $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '()'; string: ''
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '()'; string: 'abcdef'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[x]|[^x]'; string: 'abcdef'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{''
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '\a'; string: 'a'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[0-9][^0-9]'; string: '2a'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '^[[:digit:]]{5}'; string: '0123456789'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[[:digit:]]{5}$'; string: '0123456789'
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[[:blank:]]{1,10}'; string: '
+ '
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+--> Pattern: '[[:print:]]{3}'; string: ' a '
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+Done
diff --git a/ext/ereg/tests/eregi_basic_003.phpt b/ext/ereg/tests/eregi_basic_003.phpt
new file mode 100644
index 0000000..f045ad4
--- /dev/null
+++ b/ext/ereg/tests/eregi_basic_003.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test eregi() function : basic functionality - long RE
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a long RE with lots of matches
+ */
+
+var_dump(eregi(str_repeat('(.)', 2048), str_repeat('x', 2048)));
+var_dump(eregi(str_repeat('(.)', 2048), str_repeat('x', 2048), $regs));
+var_dump(count($regs));
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(1)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(2048)
+int(2049)
+Done
diff --git a/ext/ereg/tests/eregi_basic_004.phpt b/ext/ereg/tests/eregi_basic_004.phpt
new file mode 100644
index 0000000..78d8f5e
--- /dev/null
+++ b/ext/ereg/tests/eregi_basic_004.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test eregi() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$regs = 'original';
+
+var_dump(eregi('[A-Z]', '0', $regs));
+var_dump(eregi('(a){4}', 'aaa', $regs));
+var_dump(eregi('^a', 'ba', $regs));
+var_dump(eregi('b$', 'ba', $regs));
+var_dump(eregi('[:alpha:]', 'x', $regs));
+
+// Ensure $regs is unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function eregi() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+bool(false)
+string(8) "original"
+Done
diff --git a/ext/ereg/tests/eregi_error_001.phpt b/ext/ereg/tests/eregi_error_001.phpt
new file mode 100644
index 0000000..fed3a72
--- /dev/null
+++ b/ext/ereg/tests/eregi_error_001.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test eregi() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test wrong number of args
+ */
+
+echo "*** Testing eregi() : error conditions ***\n";
+
+
+//Test eregi with one more than the expected number of arguments
+echo "\n-- Testing eregi() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$registers = array(1, 2);
+$extra_arg = 10;
+var_dump( eregi($pattern, $string, $registers, $extra_arg) );
+
+// Testing eregi with one less than the expected number of arguments
+echo "\n-- Testing eregi() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( eregi($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : error conditions ***
+
+-- Testing eregi() function with more than expected no. of arguments --
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing eregi() function with less than expected no. of arguments --
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/eregi_error_002.phpt b/ext/ereg/tests/eregi_error_002.phpt
new file mode 100644
index 0000000..2764741
--- /dev/null
+++ b/ext/ereg/tests/eregi_error_002.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test eregi() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing eregi() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(eregi("", "hello"));
+var_dump(eregi("c(d", "hello"));
+var_dump(eregi("a[b", "hello"));
+var_dump(eregi("c(d", "hello"));
+var_dump(eregi("*", "hello"));
+var_dump(eregi("+", "hello"));
+var_dump(eregi("?", "hello"));
+var_dump(eregi("(+?*)", "hello", $regs));
+var_dump(eregi("h{256}", "hello"));
+var_dump(eregi("h|", "hello"));
+var_dump(eregi("h{0}", "hello"));
+var_dump(eregi("h{2,1}", "hello"));
+var_dump(eregi('[a-c-e]', 'd'));
+var_dump(eregi('\\', 'x'));
+var_dump(eregi('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : error conditions ***
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EBRACK in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_ERANGE in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_EESCAPE in %s on line %d
+bool(false)
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+
+Warning: eregi(): REG_ERANGE in %s on line %d
+bool(false)
+string(8) "original"
+Done
diff --git a/ext/ereg/tests/eregi_replace_basic.phpt b/ext/ereg/tests/eregi_replace_basic.phpt
new file mode 100644
index 0000000..f965c8f
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test eregi_replace() function : basic functionality - confirm case insensitivity
+--FILE--
+
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Case insensitive replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic functionality of eregi_replace()
+ */
+
+echo "*** Testing eregi_replace() : basic functionality ***\n";
+
+$string = 'UPPERCASE WORDS, lowercase words, MIxED CaSe woRdS';
+
+echo "String Before...\n";
+var_dump($string);
+echo "\nString after...\n";
+
+var_dump(eregi_replace('([[:lower:]]+) word', '\\1_character', $string));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing eregi_replace() : basic functionality ***
+String Before...
+string(50) "UPPERCASE WORDS, lowercase words, MIxED CaSe woRdS"
+
+String after...
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(65) "UPPERCASE_characterS, lowercase_characters, MIxED CaSe_characterS"
+Done
diff --git a/ext/ereg/tests/eregi_replace_basic_001.phpt b/ext/ereg/tests/eregi_replace_basic_001.phpt
new file mode 100644
index 0000000..710e39e
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_basic_001.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test ereg() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple, valid matches with eregi_replace
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+$replacement = '[this is a replacement]';
+
+foreach ($expressions as $re) {
+ list($pattern, $match) = $re;
+ echo "--> Pattern: '$pattern'; match: '$match'\n";
+ var_dump(eregi_replace($pattern, $replacement, $match . ' this contains some matches ' . $match));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--"
+--> Pattern: '()'; match: ''
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]"
+--> Pattern: '()'; match: 'abcdef'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]"
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]"
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---"
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '\a'; match: 'a'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]"
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(74) "[this is a replacement] this contains some matches [this is a replacement]"
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(66) "[this is a replacement]56789 this contains some matches 0123456789"
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(66) "0123456789 this contains some matches 01234[this is a replacement]"
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(163) "
+[this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement]
+[this is a replacement]"
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] "
+Done
diff --git a/ext/ereg/tests/eregi_replace_basic_002.phpt b/ext/ereg/tests/eregi_replace_basic_002.phpt
new file mode 100644
index 0000000..7683e33
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_basic_002.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test eregi_replace() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(eregi_replace('[A-Z]', $replacement, '0'));
+var_dump(eregi_replace('(a){4}', $replacement, 'aaa'));
+var_dump(eregi_replace('^a', $replacement, 'ba'));
+var_dump(eregi_replace('b$', $replacement, 'ba'));
+var_dump(eregi_replace('[:alpha:]', $replacement, 'x'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(1) "0"
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(3) "aaa"
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(2) "ba"
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(2) "ba"
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+string(1) "x"
+Done
diff --git a/ext/ereg/tests/eregi_replace_error_001.phpt b/ext/ereg/tests/eregi_replace_error_001.phpt
new file mode 100644
index 0000000..ff94833
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_error_001.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test eregi_replace() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing eregi_replace() : error conditions ***\n";
+
+
+//Test eregi_replace with one more than the expected number of arguments
+echo "\n-- Testing eregi_replace() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( eregi_replace($pattern, $replacement, $string, $extra_arg) );
+
+// Testing eregi_replace with one less than the expected number of arguments
+echo "\n-- Testing eregi_replace() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+$replacement = 'string_val';
+var_dump( eregi_replace($pattern, $replacement) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : error conditions ***
+
+-- Testing eregi_replace() function with more than expected no. of arguments --
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace() expects exactly 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing eregi_replace() function with less than expected no. of arguments --
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace() expects exactly 3 parameters, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/eregi_replace_error_002.phpt b/ext/ereg/tests/eregi_replace_error_002.phpt
new file mode 100644
index 0000000..32c5861
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_error_002.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Test eregi_replace() function : error conditions - bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing eregi_replace() : bad REs ***\n";
+var_dump(eregi_replace("", "hello", "some string"));
+var_dump(eregi_replace("c(d", "hello", "some string"));
+var_dump(eregi_replace("a[b", "hello", "some string"));
+var_dump(eregi_replace("c(d", "hello", "some string"));;
+var_dump(eregi_replace("*", "hello", "some string"));
+var_dump(eregi_replace("+", "hello", "some string"));
+var_dump(eregi_replace("?", "hello", "some string"));
+var_dump(eregi_replace("(+?*)", "hello", "some string"));
+var_dump(eregi_replace("h{256}", "hello", "some string"));
+var_dump(eregi_replace("h|", "hello", "some string"));
+var_dump(eregi_replace("h{0}", "hello", "some string"));
+var_dump(eregi_replace("h{2,1}", "hello", "some string"));
+var_dump(eregi_replace('[a-c-e]', 'd', "some string"));
+var_dump(eregi_replace('\\', 'x', "some string"));
+var_dump(eregi_replace('([9-0])', '1', "some string"));
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : bad REs ***
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EBRACK in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_ERANGE in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_EESCAPE in %s on line %d
+bool(false)
+
+Deprecated: Function eregi_replace() is deprecated in %s on line %d
+
+Warning: eregi_replace(): REG_ERANGE in %s on line %d
+bool(false)
+Done
diff --git a/ext/ereg/tests/eregi_replace_variation_001.phpt b/ext/ereg/tests/eregi_replace_variation_001.phpt
new file mode 100644
index 0000000..e3d2b65
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_variation_001.phpt
@@ -0,0 +1,205 @@
+--TEST--
+Test eregi_replace() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$replacement = 'new';
+$string = 'original';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi_replace($value, $replacement, $string) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 12345
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value -2345
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 10.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value -10.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 101234567000
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 0.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+Error: 8 - Array to string conversion, %seregi_replace_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "original"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace(): REG_EMPTY, %s(74)
+bool(false)
+Done
diff --git a/ext/ereg/tests/eregi_replace_variation_002.phpt b/ext/ereg/tests/eregi_replace_variation_002.phpt
new file mode 100644
index 0000000..46229e0
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_variation_002.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test eregi_replace() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = b'ell';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for replacement
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump(urlencode(eregi_replace($pattern, $value, $string)));
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value 12345
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(6) "h9o%21"
+
+Arg value -2345
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%D7o%21"
+
+Arg value 10.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%0Ao%21"
+
+Arg value -10.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%F6o%21"
+
+Arg value 101234567000
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(%d) "h%so%21"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 0.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+Error: 8 - Array to string conversion, %seregi_replace_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 8 - Object of class stdClass could not be converted to int, %s(74)
+string(8) "h%01o%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "ho%21"
+Done \ No newline at end of file
diff --git a/ext/ereg/tests/eregi_replace_variation_003.phpt b/ext/ereg/tests/eregi_replace_variation_003.phpt
new file mode 100644
index 0000000..ae9edba
--- /dev/null
+++ b/ext/ereg/tests/eregi_replace_variation_003.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test eregi_replace() function : usage variations - unexpected type arg 3
+--FILE--
+<?php
+/* Prototype : proto string eregi_replace(string pattern, string replacement, string string)
+ * Description: Replace regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi_replace() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$replacement = 'new value';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi_replace($pattern, $replacement, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi_replace() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(1) "0"
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(9) "new value"
+
+Arg value 12345
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(13) "new value2345"
+
+Arg value -2345
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(5) "-2345"
+
+Arg value 10.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(12) "new value0.5"
+
+Arg value -10.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(13) "-new value0.5"
+
+Arg value 101234567000
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(28) "new value0new value234567000"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(29) "new value.0765432new valueE-9"
+
+Arg value 0.5
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(3) "0.5"
+Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_replace_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace() expects parameter 3 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(9) "new value"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value 1
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(9) "new value"
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+Error: 2 - eregi_replace() expects parameter 3 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+
+Arg value
+Error: 8192 - Function eregi_replace() is deprecated, %s(74)
+string(0) ""
+Done
diff --git a/ext/ereg/tests/eregi_variation_001.phpt b/ext/ereg/tests/eregi_variation_001.phpt
new file mode 100644
index 0000000..38c2cba
--- /dev/null
+++ b/ext/ereg/tests/eregi_variation_001.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test eregi() function : usage variations - unexpected type arg 1
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+
+echo "*** Testing eregi() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1';
+$registers = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi($value, $string, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(65)
+Error: 8 - Undefined variable: unset_var, %s(68)
+
+Arg value 0
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(75)
+int(1)
+
+Arg value 12345
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value -2345
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value 10.5
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value -10.5
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value 101234567000
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value 1.07654321E-9
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+
+Arg value 0.5
+Error: 8192 - Function eregi() is deprecated, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 8 - Array to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(75)
+int(1)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(75)
+int(1)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(74)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(75)
+Error: 8 - Object of class stdClass to string conversion, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(75)
+Error: 2 - eregi(): REG_EMPTY, %s(75)
+bool(false)
+Done
diff --git a/ext/ereg/tests/eregi_variation_002.phpt b/ext/ereg/tests/eregi_variation_002.phpt
new file mode 100644
index 0000000..8e803b5
--- /dev/null
+++ b/ext/ereg/tests/eregi_variation_002.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test eregi() function : usage variations - unexpected type arg 2
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = '1';
+$registers = array();
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi($pattern, $value, $registers) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value 12345
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value -2345
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value 10.5
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value -10.5
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value 101234567000
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value 1.07654321E-9
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value 0.5
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+Error: 8 - Array to string conversion, %seregi_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(74)
+Error: 2 - eregi() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(74)
+Error: 2 - eregi() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(74)
+Error: 2 - eregi() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(74)
+Error: 2 - eregi() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %seregi_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function eregi() is deprecated, %s(74)
+Error: 2 - eregi() expects parameter 2 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(74)
+int(1)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+Error: 2 - eregi() expects parameter 2 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(74)
+bool(false)
+Done
diff --git a/ext/ereg/tests/eregi_variation_003.phpt b/ext/ereg/tests/eregi_variation_003.phpt
new file mode 100644
index 0000000..97777e2
--- /dev/null
+++ b/ext/ereg/tests/eregi_variation_003.phpt
@@ -0,0 +1,305 @@
+--TEST--
+Test eregi() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing eregi() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'h(.*)lo!';
+$string = 'hello!';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for registers
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( eregi($pattern, $string, $value) );
+ var_dump($value);
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing eregi() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(61)
+Error: 8 - Undefined variable: unset_var, %s(64)
+
+Arg value 0
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 12345
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -2345
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 10.5
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value -10.5
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 101234567000
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 0.5
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value 1
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value string
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+
+Arg value
+Error: 8192 - Function eregi() is deprecated, %s(71)
+int(6)
+array(2) {
+ [0]=>
+ string(6) "hello!"
+ [1]=>
+ string(2) "el"
+}
+Done
diff --git a/ext/ereg/tests/eregi_variation_004.phpt b/ext/ereg/tests/eregi_variation_004.phpt
new file mode 100644
index 0000000..7378c36
--- /dev/null
+++ b/ext/ereg/tests/eregi_variation_004.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test eregi() function : usage variations - pass non-variable as arg 3, which is pass-by-ref.
+--FILE--
+<?php
+/* Prototype : proto int eregi(string pattern, string string [, array registers])
+ * Description: Regular expression match
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+var_dump(eregi('l{2}', 'hello', str_repeat('x',1)));
+echo "Done";
+?>
+--EXPECTF--
+Strict Standards: Only variables should be passed by reference in %s on line %d
+
+Deprecated: Function eregi() is deprecated in %s on line %d
+int(2)
+Done
diff --git a/ext/ereg/tests/regular_expressions.inc b/ext/ereg/tests/regular_expressions.inc
new file mode 100644
index 0000000..98fae4b
--- /dev/null
+++ b/ext/ereg/tests/regular_expressions.inc
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * POSIX regular expressions each coupled with a string that they match,
+ * based on documentation on http://www.tin.org/bin/man.cgi?section=7&topic=regex .
+ */
+$expressions = array(
+ //array(pattern, string to match)
+ array('..(a|b|c)(a|b|c)..', '--- ab ---'),
+ array('()', ''),
+ array('()', 'abcdef'),
+ array('[x]|[^x]', 'abcdef'),
+ array('(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)', '--- aaa bbb ccc ddd ---'),
+ array('\\\\\`\^\.\[\$\(\)\|\*\+\?\{\\\'', '\\`^.[$()|*+?{\''),
+ array('\\a', 'a'),
+ array('[0-9][^0-9]', '2a'),
+ array('^[[:alnum:]]{62,62}$', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'),
+ array('^[[:digit:]]{5}', '0123456789'),
+ array('[[:digit:]]{5}$', '0123456789'),
+ array('[[:blank:]]{1,10}', "\n \t"),
+ array('[[:print:]]{3}', " a "),
+);
+
+?> \ No newline at end of file
diff --git a/ext/ereg/tests/split_basic_001.phpt b/ext/ereg/tests/split_basic_001.phpt
new file mode 100644
index 0000000..1c11f71
--- /dev/null
+++ b/ext/ereg/tests/split_basic_001.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test split() function : basic functionality - test a number of simple split, specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple split, specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string, 2));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(32) "-- |1| --- ab --- |2| --- ab ---"
+}
+
+--> Pattern: '()'; match: ''
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(27) "bcdef |1| abcdef |2| abcdef"
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'"
+}
+
+--> Pattern: '\a'; match: 'a'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(12) " |1| a |2| a"
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(14) " |1| 2a |2| 2a"
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(35) "56789 |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(15) "|1|
+ |2|
+ "
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(16) " |1| a |2| a "
+}
+Done
diff --git a/ext/ereg/tests/split_basic_002.phpt b/ext/ereg/tests/split_basic_002.phpt
new file mode 100644
index 0000000..443a6b6
--- /dev/null
+++ b/ext/ereg/tests/split_basic_002.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test split() function : basic functionality - test a number of simple split, without specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple split, without specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(9) "-- |1| --"
+ [2]=>
+ string(9) "-- |2| --"
+ [3]=>
+ string(2) "--"
+}
+
+--> Pattern: '()'; match: ''
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(29) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(0) ""
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+ [10]=>
+ string(0) ""
+ [11]=>
+ string(0) ""
+ [12]=>
+ string(0) ""
+ [13]=>
+ string(0) ""
+ [14]=>
+ string(0) ""
+ [15]=>
+ string(0) ""
+ [16]=>
+ string(0) ""
+ [17]=>
+ string(0) ""
+ [18]=>
+ string(0) ""
+ [19]=>
+ string(0) ""
+ [20]=>
+ string(0) ""
+ [21]=>
+ string(0) ""
+ [22]=>
+ string(0) ""
+ [23]=>
+ string(0) ""
+ [24]=>
+ string(0) ""
+ [25]=>
+ string(0) ""
+ [26]=>
+ string(0) ""
+ [27]=>
+ string(0) ""
+ [28]=>
+ string(0) ""
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(13) " --- |1| --- "
+ [2]=>
+ string(13) " --- |2| --- "
+ [3]=>
+ string(4) " ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '\a'; match: 'a'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(6) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(2) " |"
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(2) " |"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(30) " |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(6) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(3) "|1|"
+ [2]=>
+ string(1) "
+"
+ [3]=>
+ string(3) "|2|"
+ [4]=>
+ string(1) "
+"
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) " "
+}
+Done
diff --git a/ext/ereg/tests/split_basic_003.phpt b/ext/ereg/tests/split_basic_003.phpt
new file mode 100644
index 0000000..8767144
--- /dev/null
+++ b/ext/ereg/tests/split_basic_003.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test split() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(split('A', '-- a --'));
+var_dump(split('[A-Z]', '-- 0 --'));
+var_dump(split('(a){4}', '--- aaa ---'));
+var_dump(split('^a', '--- ba ---'));
+var_dump(split('b$', '--- ba ---'));
+var_dump(split('[:alpha:]', '--- x ---'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(7) "-- a --"
+}
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(7) "-- 0 --"
+}
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(11) "--- aaa ---"
+}
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+
+Deprecated: Function split() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(9) "--- x ---"
+}
+Done
diff --git a/ext/ereg/tests/split_error_001.phpt b/ext/ereg/tests/split_error_001.phpt
new file mode 100644
index 0000000..2575717
--- /dev/null
+++ b/ext/ereg/tests/split_error_001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test split() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing split() : error conditions - wrong number of args ***\n";
+
+
+//Test split with one more than the expected number of arguments
+echo "\n-- Testing split() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$limit = 10;
+$extra_arg = 10;
+var_dump( split($pattern, $string, $limit, $extra_arg) );
+
+// Testing split with one less than the expected number of arguments
+echo "\n-- Testing split() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( split($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : error conditions - wrong number of args ***
+
+-- Testing split() function with more than expected no. of arguments --
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing split() function with less than expected no. of arguments --
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/split_error_002.phpt b/ext/ereg/tests/split_error_002.phpt
new file mode 100644
index 0000000..9eaac59
--- /dev/null
+++ b/ext/ereg/tests/split_error_002.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test split() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing split() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(split("", "hello"));
+var_dump(split("c(d", "hello"));
+var_dump(split("a[b", "hello"));
+var_dump(split("c(d", "hello"));
+var_dump(split("*", "hello"));
+var_dump(split("+", "hello"));
+var_dump(split("?", "hello"));
+var_dump(split("(+?*)", "hello", $regs));
+var_dump(split("h{256}", "hello"));
+var_dump(split("h|", "hello"));
+var_dump(split("h{0}", "hello"));
+var_dump(split("h{2,1}", "hello"));
+var_dump(split('[a-c-e]', 'd'));
+var_dump(split('\\', 'x'));
+var_dump(split('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : error conditions ***
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EBRACK in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_ERANGE in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split(): REG_EESCAPE in %s on line %d
+bool(false)
+
+Deprecated: Function split() is deprecated in %s on line %d
+
+Warning: split() expects parameter 3 to be long, string given in %s on line %d
+NULL
+string(8) "original"
+Done
diff --git a/ext/ereg/tests/split_variation_001.phpt b/ext/ereg/tests/split_variation_001.phpt
new file mode 100644
index 0000000..9d9fc9d
--- /dev/null
+++ b/ext/ereg/tests/split_variation_001.phpt
@@ -0,0 +1,257 @@
+--TEST--
+Test split() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1 a 1 Array 1 c ';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( split($value, $string, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(74)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value 12345
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -2345
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 10.5
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -10.5
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 101234567000
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 0.5
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(74)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(74)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 1 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split(): REG_EMPTY, %s(74)
+bool(false)
+Done
diff --git a/ext/ereg/tests/split_variation_002.phpt b/ext/ereg/tests/split_variation_002.phpt
new file mode 100644
index 0000000..b1ea57c
--- /dev/null
+++ b/ext/ereg/tests/split_variation_002.phpt
@@ -0,0 +1,257 @@
+--TEST--
+Test split() function : usage variations - unexpected type for arg 2
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'r|j|E';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( split($pattern, $value, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value 12345
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+
+Arg value -2345
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(5) "-2345"
+}
+
+Arg value 10.5
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+
+Arg value -10.5
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(5) "-10.5"
+}
+
+Arg value 101234567000
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(12) "101234567000"
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function split() is deprecated, %s(74)
+array(2) {
+ [0]=>
+ string(10) "1.07654321"
+ [1]=>
+ string(2) "-9"
+}
+
+Arg value 0.5
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 2 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+Error: 2 - split() expects parameter 2 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Done
diff --git a/ext/ereg/tests/split_variation_003.phpt b/ext/ereg/tests/split_variation_003.phpt
new file mode 100644
index 0000000..edef9cf
--- /dev/null
+++ b/ext/ereg/tests/split_variation_003.phpt
@@ -0,0 +1,231 @@
+--TEST--
+Test split() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+echo "*** Testing split() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = b'[[:space:]]';
+$string = '1 2 3 4 5';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through each element of the array for limit
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( split($pattern, $string, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+
+Arg value 10.5
+Error: 8192 - Function split() is deprecated, %s(73)
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+}
+
+Arg value -10.5
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 0.5
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %ssplit_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, array given, %s(73)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, string given, %s(73)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, string given, %s(73)
+NULL
+
+Arg value string
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, string given, %s(73)
+NULL
+
+Arg value string
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, string given, %s(73)
+NULL
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+Error: 2 - split() expects parameter 3 to be long, object given, %s(73)
+NULL
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function split() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done \ No newline at end of file
diff --git a/ext/ereg/tests/split_variation_004.phpt b/ext/ereg/tests/split_variation_004.phpt
new file mode 100644
index 0000000..1fa71ed
--- /dev/null
+++ b/ext/ereg/tests/split_variation_004.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test split() function : usage variations - out-of-range values for limit
+--FILE--
+<?php
+/* Prototype : proto array split(string pattern, string string [, int limit])
+ * Description: Split string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+echo "*** Testing split() : usage variations ***\n";
+
+$pattern = '[[:space:]]';
+$string = '1 2 3 4 5';
+var_dump(split($pattern, $string, 0));
+var_dump(split($pattern, $string, -10));
+var_dump(split($pattern, $string, 10E20));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing split() : usage variations ***
+Error: 8192 - Function split() is deprecated, %s(16)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 8192 - Function split() is deprecated, %s(17)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 8192 - Function split() is deprecated, %s(18)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done
diff --git a/ext/ereg/tests/spliti_basic_001.phpt b/ext/ereg/tests/spliti_basic_001.phpt
new file mode 100644
index 0000000..743bd66
--- /dev/null
+++ b/ext/ereg/tests/spliti_basic_001.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test spliti() function : basic functionality - test a number of simple spliti, specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple spliti, specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(spliti($pattern, $string . ' |1| ' . $string . ' |2| ' . $string, 2));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(32) "-- |1| --- ab --- |2| --- ab ---"
+}
+
+--> Pattern: '()'; match: ''
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(27) "bcdef |1| abcdef |2| abcdef"
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'"
+}
+
+--> Pattern: '\a'; match: 'a'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(12) " |1| a |2| a"
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(14) " |1| 2a |2| 2a"
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(35) "56789 |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(15) "|1|
+ |2|
+ "
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(16) " |1| a |2| a "
+}
+Done
diff --git a/ext/ereg/tests/spliti_basic_002.phpt b/ext/ereg/tests/spliti_basic_002.phpt
new file mode 100644
index 0000000..df61a42
--- /dev/null
+++ b/ext/ereg/tests/spliti_basic_002.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test spliti() function : basic functionality - test a number of simple spliti, without specifying a limit
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test a number of simple spliti, without specifying a limit
+ */
+
+echo "*** Testing ereg() : basic functionality ***\n";
+
+include(dirname(__FILE__) . '/regular_expressions.inc');
+
+foreach ($expressions as $re) {
+ list($pattern,$string) = $re;
+ echo "\n--> Pattern: '$pattern'; match: '$string'\n";
+ var_dump(spliti($pattern, $string . ' |1| ' . $string . ' |2| ' . $string));
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ereg() : basic functionality ***
+
+--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(2) "--"
+ [1]=>
+ string(9) "-- |1| --"
+ [2]=>
+ string(9) "-- |2| --"
+ [3]=>
+ string(2) "--"
+}
+
+--> Pattern: '()'; match: ''
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '()'; match: 'abcdef'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): Invalid Regular Expression in %s on line %d
+bool(false)
+
+--> Pattern: '[x]|[^x]'; match: 'abcdef'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(29) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(0) ""
+ [7]=>
+ string(0) ""
+ [8]=>
+ string(0) ""
+ [9]=>
+ string(0) ""
+ [10]=>
+ string(0) ""
+ [11]=>
+ string(0) ""
+ [12]=>
+ string(0) ""
+ [13]=>
+ string(0) ""
+ [14]=>
+ string(0) ""
+ [15]=>
+ string(0) ""
+ [16]=>
+ string(0) ""
+ [17]=>
+ string(0) ""
+ [18]=>
+ string(0) ""
+ [19]=>
+ string(0) ""
+ [20]=>
+ string(0) ""
+ [21]=>
+ string(0) ""
+ [22]=>
+ string(0) ""
+ [23]=>
+ string(0) ""
+ [24]=>
+ string(0) ""
+ [25]=>
+ string(0) ""
+ [26]=>
+ string(0) ""
+ [27]=>
+ string(0) ""
+ [28]=>
+ string(0) ""
+}
+
+--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(13) " --- |1| --- "
+ [2]=>
+ string(13) " --- |2| --- "
+ [3]=>
+ string(4) " ---"
+}
+
+--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{''
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '\a'; match: 'a'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) " |1| "
+ [2]=>
+ string(5) " |2| "
+ [3]=>
+ string(0) ""
+}
+
+--> Pattern: '[0-9][^0-9]'; match: '2a'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(6) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(2) " |"
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(2) " |"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+}
+
+--> Pattern: '^[[:digit:]]{5}'; match: '0123456789'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(30) " |1| 0123456789 |2| 0123456789"
+}
+
+--> Pattern: '[[:digit:]]{5}$'; match: '0123456789'
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(35) "0123456789 |1| 0123456789 |2| 01234"
+ [1]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:blank:]]{1,10}'; match: '
+ '
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(6) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(3) "|1|"
+ [2]=>
+ string(1) "
+"
+ [3]=>
+ string(3) "|2|"
+ [4]=>
+ string(1) "
+"
+ [5]=>
+ string(0) ""
+}
+
+--> Pattern: '[[:print:]]{3}'; match: ' a '
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+ [6]=>
+ string(1) " "
+}
+Done
diff --git a/ext/ereg/tests/spliti_basic_003.phpt b/ext/ereg/tests/spliti_basic_003.phpt
new file mode 100644
index 0000000..39bd1dc
--- /dev/null
+++ b/ext/ereg/tests/spliti_basic_003.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test spliti() function : basic functionality - a few non-matches
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(spliti('[A-Z]', '-- 0 --'));
+var_dump(spliti('(a){4}', '--- aaa ---'));
+var_dump(spliti('^a', '--- ba ---'));
+var_dump(spliti('b$', '--- ba ---'));
+var_dump(spliti('[:alpha:]', '--- x ---'));
+
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(7) "-- 0 --"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(11) "--- aaa ---"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(10) "--- ba ---"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(1) {
+ [0]=>
+ string(9) "--- x ---"
+}
+Done
diff --git a/ext/ereg/tests/spliti_basic_004.phpt b/ext/ereg/tests/spliti_basic_004.phpt
new file mode 100644
index 0000000..ed07193
--- /dev/null
+++ b/ext/ereg/tests/spliti_basic_004.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test spliti() function : basic functionality - confirm case insensitivity
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+$replacement = 'r';
+
+var_dump(spliti('[a-z]', '--- A ---'));
+var_dump(spliti('[A-Z]', '--- a ---'));
+var_dump(spliti('[[:lower:]]', '--- A ---'));
+var_dump(spliti('[[:upper:]]', '--- a ---'));
+
+echo "Done";
+?>
+--EXPECTF--
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+array(2) {
+ [0]=>
+ string(4) "--- "
+ [1]=>
+ string(4) " ---"
+}
+Done
diff --git a/ext/ereg/tests/spliti_error_001.phpt b/ext/ereg/tests/spliti_error_001.phpt
new file mode 100644
index 0000000..cd4e6a9
--- /dev/null
+++ b/ext/ereg/tests/spliti_error_001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test spliti() function : error conditions - wrong number of args
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+echo "*** Testing spliti() : error conditions - wrong number of args ***\n";
+
+
+//Test spliti with one more than the expected number of arguments
+echo "\n-- Testing spliti() function with more than expected no. of arguments --\n";
+$pattern = 'string_val';
+$string = 'string_val';
+$limit = 10;
+$extra_arg = 10;
+var_dump( spliti($pattern, $string, $limit, $extra_arg) );
+
+// Testing spliti with one less than the expected number of arguments
+echo "\n-- Testing spliti() function with less than expected no. of arguments --\n";
+$pattern = 'string_val';
+var_dump( spliti($pattern) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : error conditions - wrong number of args ***
+
+-- Testing spliti() function with more than expected no. of arguments --
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing spliti() function with less than expected no. of arguments --
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/spliti_error_002.phpt b/ext/ereg/tests/spliti_error_002.phpt
new file mode 100644
index 0000000..19dd171
--- /dev/null
+++ b/ext/ereg/tests/spliti_error_002.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test spliti() function : error conditions - test bad regular expressions
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+/*
+ * Test bad regular expressions
+ */
+
+echo "*** Testing spliti() : error conditions ***\n";
+
+$regs = 'original';
+
+var_dump(spliti("", "hello"));
+var_dump(spliti("c(d", "hello"));
+var_dump(spliti("a[b", "hello"));
+var_dump(spliti("c(d", "hello"));
+var_dump(spliti("*", "hello"));
+var_dump(spliti("+", "hello"));
+var_dump(spliti("?", "hello"));
+var_dump(spliti("(+?*)", "hello", $regs));
+var_dump(spliti("h{256}", "hello"));
+var_dump(spliti("h|", "hello"));
+var_dump(spliti("h{0}", "hello"));
+var_dump(spliti("h{2,1}", "hello"));
+var_dump(spliti('[a-c-e]', 'd'));
+var_dump(spliti('\\', 'x'));
+var_dump(spliti('([9-0])', '1', $regs));
+
+//ensure $regs unchanged
+var_dump($regs);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : error conditions ***
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EBRACK in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EPAREN in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_BADRPT in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EMPTY in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_BADBR in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_ERANGE in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti(): REG_EESCAPE in %s on line %d
+bool(false)
+
+Deprecated: Function spliti() is deprecated in %s on line %d
+
+Warning: spliti() expects parameter 3 to be long, string given in %s on line %d
+NULL
+string(8) "original"
+Done
diff --git a/ext/ereg/tests/spliti_variation_001.phpt b/ext/ereg/tests/spliti_variation_001.phpt
new file mode 100644
index 0000000..e5493b3
--- /dev/null
+++ b/ext/ereg/tests/spliti_variation_001.phpt
@@ -0,0 +1,257 @@
+--TEST--
+Test spliti() function : usage variations - unexpected type for arg 1
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing spliti() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$string = '1 a 1 Array 1 c ';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for pattern
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( spliti($value, $string, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value 12345
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -2345
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 10.5
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value -10.5
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 101234567000
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+
+Arg value 0.5
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(16) "1 a 1 Array 1 c "
+}
+Error: 8 - Array to string conversion, %sspliti_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 1 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(4) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(3) " a "
+ [2]=>
+ string(7) " Array "
+ [3]=>
+ string(3) " c "
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 1 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti(): REG_EMPTY, %s(74)
+bool(false)
+Done
diff --git a/ext/ereg/tests/spliti_variation_002.phpt b/ext/ereg/tests/spliti_variation_002.phpt
new file mode 100644
index 0000000..752cafc
--- /dev/null
+++ b/ext/ereg/tests/spliti_variation_002.phpt
@@ -0,0 +1,257 @@
+--TEST--
+Test spliti() function : usage variations - unexpected type for arg 2
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing spliti() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = 'r|j|E';
+$limit = 5;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( spliti($pattern, $value, $limit) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(64)
+Error: 8 - Undefined variable: unset_var, %s(67)
+
+Arg value 0
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value 12345
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(5) "12345"
+}
+
+Arg value -2345
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(5) "-2345"
+}
+
+Arg value 10.5
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(4) "10.5"
+}
+
+Arg value -10.5
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(5) "-10.5"
+}
+
+Arg value 101234567000
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(12) "101234567000"
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(2) {
+ [0]=>
+ string(10) "1.07654321"
+ [1]=>
+ string(2) "-9"
+}
+
+Arg value 0.5
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_002.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 2 to be string, array given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Error: 4096 - Object of class stdClass could not be converted to string, %s(73)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+Error: 2 - spliti() expects parameter 2 to be string, object given, %s(74)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(74)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+Done
diff --git a/ext/ereg/tests/spliti_variation_003.phpt b/ext/ereg/tests/spliti_variation_003.phpt
new file mode 100644
index 0000000..3cfeaea
--- /dev/null
+++ b/ext/ereg/tests/spliti_variation_003.phpt
@@ -0,0 +1,231 @@
+--TEST--
+Test spliti() function : usage variations - unexpected type for arg 3
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+echo "*** Testing spliti() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$pattern = b'[[:space:]]';
+$string = '1 2 3 4 5';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through each element of the array for limit
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( spliti($pattern, $string, $value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+
+Arg value 10.5
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ [4]=>
+ string(1) "5"
+}
+
+Arg value -10.5
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1.07654321E-9
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 0.5
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
+NULL
+Error: 8 - Array to string conversion, %sspliti_variation_003.php(%d)
+
+Arg value Array
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, array given, %s(73)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value 1
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
+NULL
+
+Arg value string
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
+NULL
+
+Arg value string
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, string given, %s(73)
+NULL
+Error: 4096 - Object of class stdClass could not be converted to string, %s(72)
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+Error: 2 - spliti() expects parameter 3 to be long, object given, %s(73)
+NULL
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+
+Arg value
+Error: 8192 - Function spliti() is deprecated, %s(73)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done \ No newline at end of file
diff --git a/ext/ereg/tests/spliti_variation_004.phpt b/ext/ereg/tests/spliti_variation_004.phpt
new file mode 100644
index 0000000..b6bf227
--- /dev/null
+++ b/ext/ereg/tests/spliti_variation_004.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test spliti() function : usage variations - out-of-range values for limit
+--FILE--
+<?php
+/* Prototype : proto array spliti(string pattern, string string [, int limit])
+ * Description: spliti string into array by regular expression
+ * Source code: ext/standard/reg.c
+ * Alias to functions:
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+echo "*** Testing spliti() : usage variations ***\n";
+
+$pattern = '[[:space:]]';
+$string = '1 2 3 4 5';
+var_dump(spliti($pattern, $string, 0));
+var_dump(spliti($pattern, $string, -10));
+var_dump(spliti($pattern, $string, 10E20));
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing spliti() : usage variations ***
+Error: 8192 - Function spliti() is deprecated, %s(16)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 8192 - Function spliti() is deprecated, %s(17)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Error: 8192 - Function spliti() is deprecated, %s(18)
+array(1) {
+ [0]=>
+ string(9) "1 2 3 4 5"
+}
+Done
diff --git a/ext/ereg/tests/sql_regcase_basic_001.phpt b/ext/ereg/tests/sql_regcase_basic_001.phpt
new file mode 100644
index 0000000..5a04724
--- /dev/null
+++ b/ext/ereg/tests/sql_regcase_basic_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test sql_regcase() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto string sql_regcase(string string)
+ * Description: Make regular expression for case insensitive match
+ * Source code: ext/standard/reg.c
+ * Alias to functions: msql_regcase
+ */
+
+echo "*** Testing sql_regcase() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$string = 'string_Val-0';
+
+// Calling sql_regcase() with all possible arguments
+var_dump( sql_regcase($string) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sql_regcase() : basic functionality ***
+
+Deprecated: Function sql_regcase() is deprecated in %s on line %d
+string(39) "[Ss][Tt][Rr][Ii][Nn][Gg]_[Vv][Aa][Ll]-0"
+Done
diff --git a/ext/ereg/tests/sql_regcase_error_001.phpt b/ext/ereg/tests/sql_regcase_error_001.phpt
new file mode 100644
index 0000000..6ac71f2
--- /dev/null
+++ b/ext/ereg/tests/sql_regcase_error_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sql_regcase() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto string sql_regcase(string string)
+ * Description: Make regular expression for case insensitive match
+ * Source code: ext/standard/reg.c
+ * Alias to functions: msql_regcase
+ */
+
+echo "*** Testing sql_regcase() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing sql_regcase() function with Zero arguments --\n";
+var_dump( sql_regcase() );
+
+//Test sql_regcase with one more than the expected number of arguments
+echo "\n-- Testing sql_regcase() function with more than expected no. of arguments --\n";
+$string = 'string_val';
+$extra_arg = 10;
+var_dump( sql_regcase($string, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sql_regcase() : error conditions ***
+
+-- Testing sql_regcase() function with Zero arguments --
+
+Deprecated: Function sql_regcase() is deprecated in %s on line %d
+
+Warning: sql_regcase() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing sql_regcase() function with more than expected no. of arguments --
+
+Deprecated: Function sql_regcase() is deprecated in %s on line %d
+
+Warning: sql_regcase() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/ereg/tests/sql_regcase_variation_001.phpt b/ext/ereg/tests/sql_regcase_variation_001.phpt
new file mode 100644
index 0000000..0efbe92
--- /dev/null
+++ b/ext/ereg/tests/sql_regcase_variation_001.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test sql_regcase() function : usage variations - unexpected arg type
+--FILE--
+<?php
+/* Prototype : proto string sql_regcase(string string)
+ * Description: Make regular expression for case insensitive match
+ * Source code: ext/standard/reg.c
+ * Alias to functions: msql_regcase
+ */
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+}
+set_error_handler('test_error_handler');
+
+echo "*** Testing sql_regcase() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new stdclass(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+);
+
+// loop through each element of the array for string
+
+foreach($values as $value) {
+ echo "\nArg value $value \n";
+ var_dump( sql_regcase($value) );
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sql_regcase() : usage variations ***
+Error: 8 - Undefined variable: undefined_var, %s(62)
+Error: 8 - Undefined variable: unset_var, %s(65)
+
+Arg value 0
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(1) "0"
+
+Arg value 1
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(1) "1"
+
+Arg value 12345
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(5) "12345"
+
+Arg value -2345
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(5) "-2345"
+
+Arg value 10.5
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(4) "10.5"
+
+Arg value -10.5
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(5) "-10.5"
+
+Arg value 101234567000
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(12) "101234567000"
+
+Arg value 1.07654321E-9
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(16) "1.07654321[Ee]-9"
+
+Arg value 0.5
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(3) "0.5"
+Error: 8 - Array to string conversion, %ssql_regcase_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
+NULL
+Error: 8 - Array to string conversion, %ssql_regcase_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
+NULL
+Error: 8 - Array to string conversion, %ssql_regcase_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
+NULL
+Error: 8 - Array to string conversion, %ssql_regcase_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
+NULL
+Error: 8 - Array to string conversion, %ssql_regcase_variation_001.php(%d)
+
+Arg value Array
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+Error: 2 - sql_regcase() expects parameter 1 to be string, array given, %s(72)
+NULL
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+
+Arg value 1
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(1) "1"
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+
+Arg value 1
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(1) "1"
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+Error: 4096 - Object of class stdClass could not be converted to string, %s(71)
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+Error: 2 - sql_regcase() expects parameter 1 to be string, object given, %s(72)
+NULL
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+
+Arg value
+Error: 8192 - Function sql_regcase() is deprecated, %s(72)
+string(0) ""
+Done