summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/general_functions')
-rw-r--r--ext/standard/tests/general_functions/001.phpt67
-rw-r--r--ext/standard/tests/general_functions/002.phpt11
-rw-r--r--ext/standard/tests/general_functions/003.phpt58
-rw-r--r--ext/standard/tests/general_functions/004.data4
-rw-r--r--ext/standard/tests/general_functions/004.phpt16
-rw-r--r--ext/standard/tests/general_functions/005.phpt24
-rw-r--r--ext/standard/tests/general_functions/006.phpt11
-rw-r--r--ext/standard/tests/general_functions/007.phpt24
-rw-r--r--ext/standard/tests/general_functions/008.phpt40
-rw-r--r--ext/standard/tests/general_functions/009.phpt24
-rw-r--r--ext/standard/tests/general_functions/010.phpt19
-rw-r--r--ext/standard/tests/general_functions/bug25038.phpt32
-rw-r--r--ext/standard/tests/general_functions/bug27678.phpt16
-rw-r--r--ext/standard/tests/general_functions/bug29038.phpt74
-rw-r--r--ext/standard/tests/general_functions/bug31190.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug32647.phpt61
-rw-r--r--ext/standard/tests/general_functions/bug34794.phpt34
-rw-r--r--ext/standard/tests/general_functions/bug35229.phpt30
-rw-r--r--ext/standard/tests/general_functions/bug36011.phpt46
-rw-r--r--ext/standard/tests/general_functions/bug39322.phpt45
-rw-r--r--ext/standard/tests/general_functions/bug40398.phpt84
-rw-r--r--ext/standard/tests/general_functions/bug40752.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug41037.phpt23
-rw-r--r--ext/standard/tests/general_functions/bug41445.phpt75
-rw-r--r--ext/standard/tests/general_functions/bug41445_1.phpt54
-rw-r--r--ext/standard/tests/general_functions/bug41518.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug41970.phpt27
-rw-r--r--ext/standard/tests/general_functions/bug42272.phpt11
-rw-r--r--ext/standard/tests/general_functions/bug43293_1.phpt25
-rw-r--r--ext/standard/tests/general_functions/bug43293_2.phpt13
-rw-r--r--ext/standard/tests/general_functions/bug43293_3.phpt30
-rw-r--r--ext/standard/tests/general_functions/bug44295-win.phpt29
-rw-r--r--ext/standard/tests/general_functions/bug44295.phpt29
-rw-r--r--ext/standard/tests/general_functions/bug44394.phpt18
-rw-r--r--ext/standard/tests/general_functions/bug44394_2.phpt35
-rw-r--r--ext/standard/tests/general_functions/bug44461.phpt18
-rw-r--r--ext/standard/tests/general_functions/bug44487.phpt24
-rw-r--r--ext/standard/tests/general_functions/bug44667.phpt33
-rw-r--r--ext/standard/tests/general_functions/bug46587.phpt16
-rw-r--r--ext/standard/tests/general_functions/bug47027.phpt12
-rw-r--r--ext/standard/tests/general_functions/bug47857.phpt23
-rw-r--r--ext/standard/tests/general_functions/bug47859.phpt42
-rw-r--r--ext/standard/tests/general_functions/bug48660.phpt58
-rw-r--r--ext/standard/tests/general_functions/bug48768.phpt31
-rw-r--r--ext/standard/tests/general_functions/bug49056.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug49692.ini4
-rw-r--r--ext/standard/tests/general_functions/bug49692.phpt20
-rw-r--r--ext/standard/tests/general_functions/bug49847.phpt26
-rw-r--r--ext/standard/tests/general_functions/bug50690.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug50732.phpt12
-rw-r--r--ext/standard/tests/general_functions/bug52138.data11
-rw-r--r--ext/standard/tests/general_functions/bug52138.phpt37
-rw-r--r--ext/standard/tests/general_functions/bug55371.phpt10
-rw-r--r--ext/standard/tests/general_functions/bug60227_1.phpt20
-rw-r--r--ext/standard/tests/general_functions/bug60227_2.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug60227_3.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug60227_4.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug60723.phpt19
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt59
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt208
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt210
-rw-r--r--ext/standard/tests/general_functions/call_user_func_return.phpt44
-rw-r--r--ext/standard/tests/general_functions/call_user_method.phpt20
-rw-r--r--ext/standard/tests/general_functions/call_user_method_002.phpt12
-rw-r--r--ext/standard/tests/general_functions/callbacks_001.phpt108
-rw-r--r--ext/standard/tests/general_functions/callbacks_002.phpt16
-rw-r--r--ext/standard/tests/general_functions/closures_001.phpt11
-rw-r--r--ext/standard/tests/general_functions/closures_002.phpt25
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_b.phptbin0 -> 5004 bytes
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phptbin0 -> 5004 bytes
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_e.phpt23
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_o.phpt841
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_v.phpt204
-rw-r--r--ext/standard/tests/general_functions/dl-cve-2007-4887.phpt12
-rw-r--r--ext/standard/tests/general_functions/error_get_last.phpt43
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt31
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_basic.phpt31
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_error.phpt73
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt140
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_variation1.phpt140
-rw-r--r--ext/standard/tests/general_functions/escapeshellcmd-win32.phpt49
-rw-r--r--ext/standard/tests/general_functions/floatval.phpt207
-rw-r--r--ext/standard/tests/general_functions/floatval_basic.phpt172
-rw-r--r--ext/standard/tests/general_functions/floatval_error.phpt40
-rw-r--r--ext/standard/tests/general_functions/floatval_variation1.phpt154
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_basic.phpt24
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_error.phpt27
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation1.phpt46
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation2.phpt35
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation3.phpt42
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation4.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation5.phpt35
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation6.phpt44
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation7.phpt39
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation8.phpt17
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation9.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_defined_constants_basic.phpt39
-rw-r--r--ext/standard/tests/general_functions/get_defined_constants_error.phpt25
-rw-r--r--ext/standard/tests/general_functions/get_defined_vars_basic.phpt152
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_basic.phpt23
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_error.phpt40
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_variation.phpt137
-rw-r--r--ext/standard/tests/general_functions/get_include_path_basic.phpt37
-rw-r--r--ext/standard/tests/general_functions/get_included_files.phpt63
-rw-r--r--ext/standard/tests/general_functions/get_included_files_inc1.inc3
-rw-r--r--ext/standard/tests/general_functions/get_included_files_inc2.inc4
-rw-r--r--ext/standard/tests/general_functions/get_included_files_inc3.inc4
-rw-r--r--ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt23
-rw-r--r--ext/standard/tests/general_functions/get_loaded_extensions_error.phpt26
-rw-r--r--ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt26
-rw-r--r--ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt27
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_basic.phpt20
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_error.phpt34
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_variation1.phpt74
-rw-r--r--ext/standard/tests/general_functions/getmypid_basic.phpt20
-rw-r--r--ext/standard/tests/general_functions/getopt.phpt24
-rw-r--r--ext/standard/tests/general_functions/getopt_002.phpt42
-rw-r--r--ext/standard/tests/general_functions/getopt_003.phpt57
-rw-r--r--ext/standard/tests/general_functions/getopt_004.phpt29
-rw-r--r--ext/standard/tests/general_functions/getopt_005.phpt32
-rw-r--r--ext/standard/tests/general_functions/getrusage.phpt23
-rw-r--r--ext/standard/tests/general_functions/getrusage_basic.phpt33
-rw-r--r--ext/standard/tests/general_functions/getrusage_error.phpt73
-rw-r--r--ext/standard/tests/general_functions/getrusage_variation1.phpt142
-rw-r--r--ext/standard/tests/general_functions/getservbyname_basic.phpt31
-rw-r--r--ext/standard/tests/general_functions/getservbyname_error.phpt21
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation1.phpt40
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation10.phpt42
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation11.phpt30
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation12.phpt29
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation13.phpt38
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation14.phpt33
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation2.phpt29
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation3.phpt36
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation4.phpt31
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation5.phpt29
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation6.phpt38
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation7.phpt33
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation8.phpt40
-rw-r--r--ext/standard/tests/general_functions/getservbyname_variation9.phpt34
-rw-r--r--ext/standard/tests/general_functions/getservbyport_basic.phpt27
-rw-r--r--ext/standard/tests/general_functions/getservbyport_error.phpt21
-rw-r--r--ext/standard/tests/general_functions/getservbyport_variation1.phpt40
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt906
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_error.phpt56
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation1.phpt589
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation2.phpt1005
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation3.phpt1002
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation4.phpt1201
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation5.phpt714
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation6.phpt846
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation7.phpt844
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation8.phpt595
-rw-r--r--ext/standard/tests/general_functions/head.phpt53
-rw-r--r--ext/standard/tests/general_functions/highlight_heredoc.phpt21
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt76
-rw-r--r--ext/standard/tests/general_functions/import_request1.phpt101
-rw-r--r--ext/standard/tests/general_functions/import_request2.phpt27
-rw-r--r--ext/standard/tests/general_functions/import_request3.phpt27
-rw-r--r--ext/standard/tests/general_functions/include_path.phpt75
-rw-r--r--ext/standard/tests/general_functions/ini_get_all.phpt64
-rw-r--r--ext/standard/tests/general_functions/intval.phpt306
-rw-r--r--ext/standard/tests/general_functions/intval_variation1.phpt203
-rw-r--r--ext/standard/tests/general_functions/intval_variation2.phpt195
-rw-r--r--ext/standard/tests/general_functions/is_array.phpt213
-rw-r--r--ext/standard/tests/general_functions/is_bool.phpt294
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic1.phpt109
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic2.phpt787
-rw-r--r--ext/standard/tests/general_functions/is_callable_error.phpt35
-rw-r--r--ext/standard/tests/general_functions/is_callable_variation1.phpt208
-rw-r--r--ext/standard/tests/general_functions/is_callable_variation2.phpt154
-rw-r--r--ext/standard/tests/general_functions/is_float.phpt440
-rw-r--r--ext/standard/tests/general_functions/is_float_64bit.phpt437
-rw-r--r--ext/standard/tests/general_functions/is_int.phpt465
-rw-r--r--ext/standard/tests/general_functions/is_int_64bit.phpt462
-rw-r--r--ext/standard/tests/general_functions/is_null.phpt296
-rw-r--r--ext/standard/tests/general_functions/is_numeric.phpt387
-rw-r--r--ext/standard/tests/general_functions/is_object.phpt227
-rw-r--r--ext/standard/tests/general_functions/is_resource.phpt10
-rw-r--r--ext/standard/tests/general_functions/is_resource_basic.phpt92
-rw-r--r--ext/standard/tests/general_functions/is_resource_error.phpt34
-rw-r--r--ext/standard/tests/general_functions/is_scalar.phpt240
-rw-r--r--ext/standard/tests/general_functions/is_string.phpt303
-rw-r--r--ext/standard/tests/general_functions/isset_basic1.phpt66
-rw-r--r--ext/standard/tests/general_functions/isset_basic2.phpt60
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_basic.phpt42
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_error.phpt32
-rw-r--r--ext/standard/tests/general_functions/ob_get_length_basic.phpt51
-rw-r--r--ext/standard/tests/general_functions/ob_start_closures.phpt39
-rw-r--r--ext/standard/tests/general_functions/parse_ini_basic.data132
-rw-r--r--ext/standard/tests/general_functions/parse_ini_basic.phpt283
-rw-r--r--ext/standard/tests/general_functions/parse_ini_booleans.data27
-rw-r--r--ext/standard/tests/general_functions/parse_ini_booleans.phpt69
-rw-r--r--ext/standard/tests/general_functions/parse_ini_file.phpt218
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_001.phpt479
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_002.phpt168
-rw-r--r--ext/standard/tests/general_functions/php_uname_basic.phpt35
-rw-r--r--ext/standard/tests/general_functions/php_uname_error.phpt56
-rw-r--r--ext/standard/tests/general_functions/php_uname_variation1.phpt112
-rw-r--r--ext/standard/tests/general_functions/phpcredits.phpt54
-rw-r--r--ext/standard/tests/general_functions/phpcredits2.phpt30
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt76
-rw-r--r--ext/standard/tests/general_functions/phpinfo2.phpt31
-rw-r--r--ext/standard/tests/general_functions/print_r.phpt1736
-rw-r--r--ext/standard/tests/general_functions/print_r_64bit.phpt1737
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic.phpt31
-rw-r--r--ext/standard/tests/general_functions/proc_nice_error.phpt28
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation1.phpt48
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation2.phpt37
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation3.phpt48
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation5.phpt40
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation6.phpt56
-rw-r--r--ext/standard/tests/general_functions/proc_nice_variation7.phpt49
-rw-r--r--ext/standard/tests/general_functions/proc_open.phpt28
-rw-r--r--ext/standard/tests/general_functions/proc_open02.phpt72
-rw-r--r--ext/standard/tests/general_functions/putenv.phpt28
-rw-r--r--ext/standard/tests/general_functions/rand.phpt63
-rw-r--r--ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt46
-rw-r--r--ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt37
-rw-r--r--ext/standard/tests/general_functions/sleep_basic.phpt44
-rw-r--r--ext/standard/tests/general_functions/sleep_error.phpt44
-rw-r--r--ext/standard/tests/general_functions/strval.phpt317
-rw-r--r--ext/standard/tests/general_functions/sys_getloadavg.phpt27
-rw-r--r--ext/standard/tests/general_functions/type.phpt351
-rw-r--r--ext/standard/tests/general_functions/uniqid_basic.phpt72
-rw-r--r--ext/standard/tests/general_functions/uniqid_error.phpt46
-rw-r--r--ext/standard/tests/general_functions/usleep_basic.phpt43
-rw-r--r--ext/standard/tests/general_functions/usleep_error.phpt45
-rw-r--r--ext/standard/tests/general_functions/var_dump.phpt1574
-rw-r--r--ext/standard/tests/general_functions/var_dump_64bit.phpt1574
-rw-r--r--ext/standard/tests/general_functions/var_export-locale.phpt1061
-rw-r--r--ext/standard/tests/general_functions/var_export_basic1.phpt141
-rw-r--r--ext/standard/tests/general_functions/var_export_basic2.phpt76
-rw-r--r--ext/standard/tests/general_functions/var_export_basic3.phpt175
-rw-r--r--ext/standard/tests/general_functions/var_export_basic4.phpt147
-rw-r--r--ext/standard/tests/general_functions/var_export_basic5.phpt277
-rw-r--r--ext/standard/tests/general_functions/var_export_basic6.phpt310
-rw-r--r--ext/standard/tests/general_functions/var_export_basic7.phpt59
-rw-r--r--ext/standard/tests/general_functions/var_export_basic8.phpt71
-rw-r--r--ext/standard/tests/general_functions/var_export_basic9.phpt11
-rw-r--r--ext/standard/tests/general_functions/var_export_error1.phpt38
-rw-r--r--ext/standard/tests/general_functions/var_export_error2.phpt19
-rw-r--r--ext/standard/tests/general_functions/var_export_error3.phpt19
243 files changed, 33581 insertions, 0 deletions
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
new file mode 100644
index 0000000..bfd82e5
--- /dev/null
+++ b/ext/standard/tests/general_functions/001.phpt
@@ -0,0 +1,67 @@
+--TEST--
+sprintf() function
+--FILE--
+<?php
+
+$agent = sprintf("%.5s", "James Bond, 007");
+
+echo("sprintf string truncate test: ");
+if ($agent == "James") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf padding and align test: ");
+$test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33);
+if ($test == "abc0020 fisketur !") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf octal and hex test: ");
+$test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925);
+if ($test == " 200 400 BFFF 0034c385") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf octal binary test: ");
+$test = sprintf("%b", 3457925);
+if ($test == "1101001100001110000101") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf float test: ");
+$test = sprintf("%0"."06.2f", 10000/3.0);
+if ($test == "003333.33") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo sprintf("%.2f\n", "99.00");
+echo sprintf("%.2f\n", 99.00);
+
+echo sprintf("%e\n", 1.234E-18);
+echo sprintf("%e\n", 1.234E+18);
+echo sprintf("%e\n", 9843243.12);
+echo sprintf("%e\n", -9843243.12);
+
+?>
+--EXPECT--
+sprintf string truncate test: passed
+sprintf padding and align test: passed
+sprintf octal and hex test: passed
+sprintf octal binary test: passed
+sprintf float test: passed
+99.00
+99.00
+1.234000e-18
+1.234000e+18
+9.843243e+6
+-9.843243e+6
diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt
new file mode 100644
index 0000000..58528da
--- /dev/null
+++ b/ext/standard/tests/general_functions/002.phpt
@@ -0,0 +1,11 @@
+--TEST--
+quoted_printable_decode() function test
+--FILE--
+<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=cf=D2=C7=CF=D7=D9=C5=
+=20=
+=D0=
+=D2=CF=C5=CB=D4=D9"); ?>
+--EXPECT--
+úwow-factorÁÐÕÝÅÎÎÙÅ
+ ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt
new file mode 100644
index 0000000..7ad90c8
--- /dev/null
+++ b/ext/standard/tests/general_functions/003.phpt
@@ -0,0 +1,58 @@
+--TEST--
+levenshtein() function test
+--FILE--
+<?php
+
+function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) {
+
+ if($cost1==0)
+ $result=levenshtein($text1,$text2);
+ else
+ $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
+
+ if($result==$expect) return 0;
+
+ echo "$title: result is $result instead of $expect ";
+ echo "for '$text1'/'$text2' ";
+ if($cost1) echo "($cost1:$cost2:$cost3)";
+ echo "\n";
+
+ return 1;
+}
+
+$n=0;
+
+$n += test_me("equal" , 0, "12345", "12345");
+$n += test_me("1st empty" , 3, "", "xzy");
+$n += test_me("2nd empty" , 3, "xzy", "");
+$n += test_me("both empty" , 0, "", "");
+$n += test_me("1 char" , 1, "1", "2");
+$n += test_me("2 char swap", 2, "12", "21");
+
+$n += test_me("inexpensive delete", 2, "2121", "11", 2, 1, 1);
+$n += test_me("expensive delete" , 10, "2121", "11", 2, 1, 5);
+$n += test_me("inexpensive insert", 2, "11", "2121", 1, 1, 1);
+$n += test_me("expensive insert" , 10, "11", "2121", 5, 1, 1);
+
+$n += test_me("expensive replace" , 3, "111", "121", 2, 3, 2);
+$n += test_me("very expensive replace", 4, "111", "121", 2, 9, 2);
+
+$n += test_me("bug #7368", 2, "13458", "12345");
+$n += test_me("bug #7368", 2, "1345", "1234");
+
+$n += test_me("bug #6562", 1, "debugg", "debug");
+$n += test_me("bug #6562", 1, "ddebug", "debug");
+$n += test_me("bug #6562", 2, "debbbug", "debug");
+$n += test_me("bug #6562", 1, "debugging", "debuging");
+
+$n += test_me("bug #16473", 2, "a", "bc");
+$n += test_me("bug #16473", 2, "xa", "xbc");
+$n += test_me("bug #16473", 2, "xax", "xbcx");
+$n += test_me("bug #16473", 2, "ax", "bcx");
+
+
+echo ($n==0)?"all passed\n":"$n failed\n";
+
+?>
+--EXPECT--
+all passed
diff --git a/ext/standard/tests/general_functions/004.data b/ext/standard/tests/general_functions/004.data
new file mode 100644
index 0000000..5dd0832
--- /dev/null
+++ b/ext/standard/tests/general_functions/004.data
@@ -0,0 +1,4 @@
+name value comment
+true 1 boolean true
+false 0 boolean false
+empty nothing
diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt
new file mode 100644
index 0000000..40b47cc
--- /dev/null
+++ b/ext/standard/tests/general_functions/004.phpt
@@ -0,0 +1,16 @@
+--TEST--
+fgetcsv() with tab delimited fields (BUG #8258)
+--FILE--
+<?php
+chdir(dirname(__FILE__));
+$fp=fopen("004.data","r");
+while($a=fgetcsv($fp,100,"\t")) {
+ echo join(",",$a)."\n";
+}
+fclose($fp);
+?>
+--EXPECT--
+name,value,comment
+true,1,boolean true
+false,0,boolean false
+empty,,nothing
diff --git a/ext/standard/tests/general_functions/005.phpt b/ext/standard/tests/general_functions/005.phpt
new file mode 100644
index 0000000..027d124
--- /dev/null
+++ b/ext/standard/tests/general_functions/005.phpt
@@ -0,0 +1,24 @@
+--TEST--
+is_scalar() function test
+--FILE--
+<?php
+class foo {}
+var_dump (is_scalar (TRUE));
+var_dump (is_scalar (1));
+var_dump (is_scalar (1.0));
+var_dump (is_scalar ("Hi!"));
+var_dump (is_scalar (NULL));
+var_dump (is_scalar (array ()));
+var_dump (is_scalar (new foo()));
+var_dump (is_scalar (opendir('.')));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt
new file mode 100644
index 0000000..6852286
--- /dev/null
+++ b/ext/standard/tests/general_functions/006.phpt
@@ -0,0 +1,11 @@
+--TEST--
+quoted_printable_decode() function test with CR/LF
+--FILE--
+<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=CF=D2=C7=CF=D7=D9=C5=
+=20=
+=D0=
+=D2=CF=C5=CB=D4=D9"); ?>
+--EXPECT--
+úwow-factorÁÐÕÝÅÎÎÙÅ
+ ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ
diff --git a/ext/standard/tests/general_functions/007.phpt b/ext/standard/tests/general_functions/007.phpt
new file mode 100644
index 0000000..f755ab4
--- /dev/null
+++ b/ext/standard/tests/general_functions/007.phpt
@@ -0,0 +1,24 @@
+--TEST--
+MD5 / Base64
+--FILE--
+<?php
+function test($str) {
+ $res = md5(base64_decode(base64_encode($str)))."\n";
+ return $res;
+}
+echo test("");
+echo test("a");
+echo test("abc");
+echo test("message digest");
+echo test("abcdefghijklmnopqrstuvwxyz");
+echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
+?>
+--EXPECT--
+d41d8cd98f00b204e9800998ecf8427e
+0cc175b9c0f1b6a831c399e269772661
+900150983cd24fb0d6963f7d28e17f72
+f96b697d7cb7938d525a2f31aaf161d0
+c3fcd3d76192e4007dfb496cca67e13b
+d174ab98d277d9f5a5611c2c9f419d9f
+57edf4a22be3c955ac49da2e2107b67a
diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt
new file mode 100644
index 0000000..f76c735
--- /dev/null
+++ b/ext/standard/tests/general_functions/008.phpt
@@ -0,0 +1,40 @@
+--TEST--
+var_dump float test
+--INI--
+precision=12
+--FILE--
+<?php
+// this checks f,g,G conversion for snprintf/spprintf
+var_dump(array(ini_get('precision'),.012,-.012,.12,-.12,1.2,-1.2,12.,-12.,0.000123,.0000123,123456789012.0,1234567890123.0,12345678901234567890.0));
+?>
+--EXPECT--
+array(14) {
+ [0]=>
+ string(2) "12"
+ [1]=>
+ float(0.012)
+ [2]=>
+ float(-0.012)
+ [3]=>
+ float(0.12)
+ [4]=>
+ float(-0.12)
+ [5]=>
+ float(1.2)
+ [6]=>
+ float(-1.2)
+ [7]=>
+ float(12)
+ [8]=>
+ float(-12)
+ [9]=>
+ float(0.000123)
+ [10]=>
+ float(1.23E-5)
+ [11]=>
+ float(123456789012)
+ [12]=>
+ float(1.23456789012E+12)
+ [13]=>
+ float(1.23456789012E+19)
+} \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt
new file mode 100644
index 0000000..e80d361
--- /dev/null
+++ b/ext/standard/tests/general_functions/009.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SHA1
+--FILE--
+<?php
+function test($str) {
+ $res = sha1($str)."\n";
+ return $res;
+}
+echo test("");
+echo test("a");
+echo test("abc");
+echo test("message digest");
+echo test("abcdefghijklmnopqrstuvwxyz");
+echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
+?>
+--EXPECT--
+da39a3ee5e6b4b0d3255bfef95601890afd80709
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
+a9993e364706816aba3e25717850c26c9cd0d89d
+c12252ceda8be8994d5fa0290a47231c1d16aae3
+32d10c7b8cf96570ca04ce37f2a19d84240d3a89
+761c457bf73b14d27e9e9265c46f4b4dda11f940
+50abf5706a150990a08b2c5ea40fa0e585554732
diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt
new file mode 100644
index 0000000..f576c7e
--- /dev/null
+++ b/ext/standard/tests/general_functions/010.phpt
@@ -0,0 +1,19 @@
+--TEST--
+register_shutdown_function() & __call
+--FILE--
+<?php
+class test {
+ function _foo() {
+ throw new Exception('test');
+ }
+ function __call($name=null, $args=null) {
+ return test::_foo();
+ }
+}
+
+var_dump(register_shutdown_function(array("test","__call")));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d
diff --git a/ext/standard/tests/general_functions/bug25038.phpt b/ext/standard/tests/general_functions/bug25038.phpt
new file mode 100644
index 0000000..52fe032
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug25038.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #25038 (call_user_func issues warning if function throws exception)
+--FILE--
+<?php
+
+function bar($x='no argument')
+{
+ throw new Exception("This is an exception from bar({$x}).");
+}
+try
+{
+ bar('first try');
+}
+catch (Exception $e)
+{
+ print $e->getMessage()."\n";
+}
+try
+{
+ call_user_func('bar','second try');
+}
+catch (Exception $e)
+{
+ print $e->getMessage()."\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+This is an exception from bar(first try).
+This is an exception from bar(second try).
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug27678.phpt b/ext/standard/tests/general_functions/bug27678.phpt
new file mode 100644
index 0000000..6f95509
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug27678.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #27678 (number_format() crashes with large numbers)
+--FILE--
+<?php
+
+number_format(1e80, 0, '', ' ');
+number_format(1e300, 0, '', ' ');
+number_format(1e320, 0, '', ' ');
+$num = number_format(1e1000, 0, '', ' ');
+var_dump(strlen($num) == 3); // $num == 'inf'
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+Done
diff --git a/ext/standard/tests/general_functions/bug29038.phpt b/ext/standard/tests/general_functions/bug29038.phpt
new file mode 100644
index 0000000..0f79229
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug29038.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings)
+--FILE--
+<?php
+function f1() {
+ $c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f2() {
+ $a = 1;
+ $c = extract(array("a" => 1),EXTR_PREFIX_SAME,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f3() {
+ $a = 1;
+ $c = extract(array("a" => 1),EXTR_PREFIX_ALL,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f4() {
+ $c = extract(array("" => 1),EXTR_PREFIX_ALL,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+function f5() {
+ $c = extract(array("111" => 1),EXTR_PREFIX_ALL,"prefix");
+ echo "Extracted:";
+ var_dump($c);
+ print_r(get_defined_vars());
+}
+
+f1();
+f2();
+f3();
+f4();
+f5();
+?>
+--EXPECT--
+Extracted:int(0)
+Array
+(
+ [c] => 0
+)
+Extracted:int(1)
+Array
+(
+ [a] => 1
+ [prefix_a] => 1
+ [c] => 1
+)
+Extracted:int(1)
+Array
+(
+ [a] => 1
+ [prefix_a] => 1
+ [c] => 1
+)
+Extracted:int(0)
+Array
+(
+ [c] => 0
+)
+Extracted:int(1)
+Array
+(
+ [prefix_111] => 1
+ [c] => 1
+)
diff --git a/ext/standard/tests/general_functions/bug31190.phpt b/ext/standard/tests/general_functions/bug31190.phpt
new file mode 100644
index 0000000..7d15470
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug31190.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #31190 (exception in call_user_func_array())
+--FILE--
+<?php
+
+class test {
+ function throwException() { throw new Exception("Hello World!\n");
+} }
+
+$array = array(new test(), 'throwException');
+try {
+ call_user_func($array, 1, 2);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+try {
+ call_user_func_array($array, array(1, 2));
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Hello World!
+Hello World!
+
diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt
new file mode 100644
index 0000000..8508597
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug32647.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP)
+--INI--
+error_reporting=4095
+display_errors=1
+--FILE--
+<?php
+
+function foo()
+{
+ echo "foo!\n";
+}
+
+class bar
+{
+ function barfoo ()
+ { echo "bar!\n"; }
+}
+
+unset($obj);
+register_shutdown_function(array($obj,"")); // Invalid
+register_shutdown_function(array($obj,"some string")); // Invalid
+register_shutdown_function(array(0,"")); // Invalid
+register_shutdown_function(array('bar','foo')); // Invalid
+register_shutdown_function(array(0,"some string")); // Invalid
+register_shutdown_function('bar'); // Invalid
+register_shutdown_function('foo'); // Valid
+register_shutdown_function(array('bar','barfoo')); // Invalid
+
+$obj = new bar;
+register_shutdown_function(array($obj,'foobar')); // Invalid
+register_shutdown_function(array($obj,'barfoo')); // Valid
+
+?>
+--EXPECTF--
+Notice: Undefined variable: obj in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Notice: Undefined variable: obj in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foo' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d
+
+Strict Standards: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d
+
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
+foo!
+
+Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
+
+Strict Standards: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
+bar!
+bar!
diff --git a/ext/standard/tests/general_functions/bug34794.phpt b/ext/standard/tests/general_functions/bug34794.phpt
new file mode 100644
index 0000000..1b25bc2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug34794.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #34794 (proc_close() hangs when used with two processes)
+--SKIPIF--
+<?php
+if (!is_executable('/bin/cat')) echo 'skip cat not found';
+?>
+--FILE--
+<?php
+echo "Opening process 1\n";
+$process1 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes1);
+
+echo "Opening process 2\n";
+$process2 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes2);
+
+
+echo "Closing process 1\n";
+fclose($pipes1[0]);
+fclose($pipes1[1]);
+proc_close($process1);
+
+echo "Closing process 2\n";
+fclose($pipes2[0]);
+fclose($pipes2[1]);
+proc_close($process2);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Opening process 1
+Opening process 2
+Closing process 1
+Closing process 2
+Done
diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt
new file mode 100644
index 0000000..c3c273d
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug35229.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #35229 (call_user_func() crashes when argument stack is nearly full)
+--FILE--
+<?php
+class test2 {
+ static function use_stack() {
+ echo "OK\n";
+ }
+}
+
+function __autoload($class)
+{
+ eval('class test1 extends test2 {}');
+
+ test1::use_stack(
+ 1,2,3,4,5,6,7,8,9,10,
+ 11,12,13,14,15,16,17,18,19,20,
+ 21,22,23,24,25,26,27,28,29,30
+ );
+}
+
+call_user_func(array('test1', 'use_stack'),
+ 1,2,3,4,5,6,7,8,9,10,
+ 11,12,13,14,15,16,17,18,19,20,
+ 21,22,23,24,25,26,27,28,29,30
+);
+?>
+--EXPECT--
+OK
+OK
diff --git a/ext/standard/tests/general_functions/bug36011.phpt b/ext/standard/tests/general_functions/bug36011.phpt
new file mode 100644
index 0000000..08a4501
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug36011.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Bug #36011 (Strict errormsg wrong for call_user_func() and the likes)
+--FILE--
+<?php
+
+class TestClass
+{
+ static function test()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function whee()
+ {
+ array_map(array('TestClass', 'test'), array('array_value'));
+ }
+
+ function whee4()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+
+ static function whee5()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+}
+
+TestClass::test();
+
+$a = new TestClass();
+$a->whee();
+$a->whee4();
+$a->whee5();
+
+TestClass::whee5();
+
+?>
+===DONE===
+--EXPECTF--
+TestClass::test()
+TestClass::test()
+TestClass::test()
+TestClass::test()
+TestClass::test()
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug39322.phpt b/ext/standard/tests/general_functions/bug39322.phpt
new file mode 100644
index 0000000..a9f83c7
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug39322.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #39322 (proc_terminate() loosing process resource)
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (!is_executable('/bin/sleep')) echo 'skip sleep not found';
+?>
+--FILE--
+<?php
+$descriptors = array(
+ 0 => array('pipe', 'r'),
+ 1 => array('pipe', 'w'),
+ 2 => array('pipe', 'w'));
+
+$pipes = array();
+
+$process = proc_open('/bin/sleep 120', $descriptors, $pipes);
+
+proc_terminate($process, 9);
+sleep(1); // wait a bit to let the process finish
+var_dump(proc_get_status($process));
+
+echo "Done!\n";
+
+?>
+--EXPECTF--
+array(8) {
+ ["command"]=>
+ string(14) "/bin/sleep 120"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(false)
+ ["signaled"]=>
+ bool(true)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(9)
+ ["stopsig"]=>
+ int(0)
+}
+Done!
diff --git a/ext/standard/tests/general_functions/bug40398.phpt b/ext/standard/tests/general_functions/bug40398.phpt
new file mode 100644
index 0000000..11fdde2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug40398.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Bug #40398 (parent and self callback functions erroneously called statically)
+--FILE--
+<?php
+
+class Base
+{
+ function __construct($msg)
+ {
+ echo __METHOD__ . "($msg)\n";
+ }
+}
+
+class Derived_1 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'Base::__construct'), $args);
+ }
+}
+
+class Derived_2 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'parent::__construct'), $args);
+ }
+}
+
+class Derived_3 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('Base::__construct', $args);
+ }
+}
+
+class Derived_4 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('parent::__construct', $args);
+ }
+}
+
+class Derived_5 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('Base', '__construct'), $args);
+ }
+}
+
+class Derived_6 extends Base
+{
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('parent', '__construct'), $args);
+ }
+}
+
+new Derived_1('1');
+new Derived_2('2');
+new Derived_3('3');
+new Derived_4('4');
+new Derived_5('5');
+new Derived_6('6');
+
+?>
+===DONE===
+--EXPECTF--
+Base::__construct(1)
+Base::__construct(2)
+Base::__construct(3)
+Base::__construct(4)
+Base::__construct(5)
+Base::__construct(6)
+===DONE===
diff --git a/ext/standard/tests/general_functions/bug40752.phpt b/ext/standard/tests/general_functions/bug40752.phpt
new file mode 100644
index 0000000..30ed8a4
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug40752.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #40752 (parse_ini_file() segfaults when a scalar setting is redeclared as an array)
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug40752.ini";
+file_put_contents($file, '
+foo = 1;
+foo[] = 1;
+');
+
+var_dump(parse_ini_file($file));
+
+file_put_contents($file, '
+foo[] = 1;
+foo = 1;
+');
+
+var_dump(parse_ini_file($file));
+
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(1) {
+ ["foo"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+}
+array(1) {
+ ["foo"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt
new file mode 100644
index 0000000..eab2c33
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41037.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #41037 (unregister_tick_function() inside the tick function crash PHP)
+--FILE--
+<?php
+
+function a() {
+ echo "hello";
+ unregister_tick_function('a');
+}
+
+declare (ticks=1);
+register_tick_function('a');
+
+echo "Done\n";
+?>
+--EXPECTF--
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+Done
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
diff --git a/ext/standard/tests/general_functions/bug41445.phpt b/ext/standard/tests/general_functions/bug41445.phpt
new file mode 100644
index 0000000..23888df
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41445.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Bug #41445 (parse_ini_file() function parses octal numbers in section names)
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug41445.ini";
+
+$data = <<<DATA
+[001099030277]
+option1 = yes
+
+[011099030277]
+option2 = yes
+DATA;
+
+file_put_contents($file, $data);
+
+var_dump(parse_ini_file($file, TRUE));
+var_dump(parse_ini_file($file));
+
+$data = <<<DATA
+[23.44]
+option1 = yes
+
+[9633337363542736472364]
+option2 = yes
+DATA;
+
+file_put_contents($file, $data);
+
+var_dump(parse_ini_file($file, TRUE));
+var_dump(parse_ini_file($file));
+
+@unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(2) {
+ ["001099030277"]=>
+ array(1) {
+ ["option1"]=>
+ string(1) "1"
+ }
+ ["011099030277"]=>
+ array(1) {
+ ["option2"]=>
+ string(1) "1"
+ }
+}
+array(2) {
+ ["option1"]=>
+ string(1) "1"
+ ["option2"]=>
+ string(1) "1"
+}
+array(2) {
+ ["23.44"]=>
+ array(1) {
+ ["option1"]=>
+ string(1) "1"
+ }
+ ["9633337363542736472364"]=>
+ array(1) {
+ ["option2"]=>
+ string(1) "1"
+ }
+}
+array(2) {
+ ["option1"]=>
+ string(1) "1"
+ ["option2"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41445_1.phpt b/ext/standard/tests/general_functions/bug41445_1.phpt
new file mode 100644
index 0000000..e65e7af
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41445_1.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #41445 (parse_ini_file() function parses octal numbers in section names) - 2
+--FILE--
+<?php
+
+$file = dirname(__FILE__)."/bug41445.ini";
+
+$data = <<<DATA
+[2454.33]
+09 = yes
+
+[9876543]
+098765434567876543 = yes
+
+[09876543]
+987654345678765432456798765434567876543 = yes
+DATA;
+
+file_put_contents($file, $data);
+
+var_dump(parse_ini_file($file, TRUE));
+var_dump(parse_ini_file($file));
+
+@unlink($file);
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(3) {
+ ["2454.33"]=>
+ array(1) {
+ ["09"]=>
+ string(1) "1"
+ }
+ [9876543]=>
+ array(1) {
+ ["098765434567876543"]=>
+ string(1) "1"
+ }
+ ["09876543"]=>
+ array(1) {
+ ["987654345678765432456798765434567876543"]=>
+ string(1) "1"
+ }
+}
+array(3) {
+ ["09"]=>
+ string(1) "1"
+ ["098765434567876543"]=>
+ string(1) "1"
+ ["987654345678765432456798765434567876543"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/standard/tests/general_functions/bug41518.phpt b/ext/standard/tests/general_functions/bug41518.phpt
new file mode 100644
index 0000000..26e2413
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41518.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #41518 (file_exists() warns of open_basedir restriction on non-existent file)
+--SKIPIF--
+<?php
+$tmp_dir = __DIR__ . '/bug41518';
+mkdir($tmp_dir);
+if (!is_dir($tmp_dir)) {
+ die("skip");
+}
+@unlink($tmp_dir);
+?>
+--INI--
+open_basedir=.
+--FILE--
+<?php
+
+$tmp_dir = __DIR__ . "/bug41518/";
+@mkdir($tmp_dir);
+$tmp_file = $tmp_dir."/bug41418.tmp";
+
+touch($tmp_file);
+var_dump(file_exists($tmp_file)); //exists
+var_dump(file_exists($tmp_file."nosuchfile")); //doesn't exist
+
+@unlink($tmp_file);
+@rmdir($tmp_dir);
+echo "Done\n";
+?>
+--CLEAN--
+<?php
+$tmp_dir = __DIR__ . "/bug41518/";
+@unlink($tmp_dir);
+?>
+--EXPECT--
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt
new file mode 100644
index 0000000..4bce3ac
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug41970.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #41970 (call_user_func_*() leaks on failure)
+--FILE--
+<?php
+
+$a = array(4,3,2);
+
+var_dump(call_user_func_array("sort", array($a)));
+var_dump(call_user_func_array("strlen", array($a)));
+var_dump(call_user_func("sort", $a));
+var_dump(call_user_func("strlen", $a));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5
+NULL
+
+Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6
+NULL
+
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7
+NULL
+
+Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/bug42272.phpt b/ext/standard/tests/general_functions/bug42272.phpt
new file mode 100644
index 0000000..8b8c248
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug42272.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #42272 (var_export() incorrectly escapes char(0))
+--FILE--
+<?php
+$foo = var_export("\0", true );
+echo $foo, "\n";
+var_export("a\0b");
+?>
+--EXPECT--
+'' . "\0" . ''
+'a' . "\0" . 'b'
diff --git a/ext/standard/tests/general_functions/bug43293_1.phpt b/ext/standard/tests/general_functions/bug43293_1.phpt
new file mode 100644
index 0000000..d2c7f10
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_1.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #43293 (Multiple segfaults in getopt())
+--INI--
+register_argc_argv=Off
+--FILE--
+<?php
+$argv = array(1, 2, 3);
+var_dump(getopt("abcd"));
+var_dump($argv);
+$argv = null;
+var_dump(getopt("abcd"));
+?>
+--EXPECT--
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(false)
+
diff --git a/ext/standard/tests/general_functions/bug43293_2.phpt b/ext/standard/tests/general_functions/bug43293_2.phpt
new file mode 100644
index 0000000..76a5956
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #43293 (Multiple segfaults in getopt())
+--INI--
+register_argc_argv=Off
+--FILE--
+<?php
+$argv = array(true, false);
+var_dump(getopt("abcd"));
+?>
+--EXPECT--
+array(0) {
+}
+
diff --git a/ext/standard/tests/general_functions/bug43293_3.phpt b/ext/standard/tests/general_functions/bug43293_3.phpt
new file mode 100644
index 0000000..6cf6529
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug43293_3.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #43293 (Multiple segfaults in getopt())
+--ARGS--
+-f --f
+--INI--
+register_argc_argv=On
+--FILE--
+<?php
+$args = array(true, false, "f");
+var_dump(getopt("f", $args), $args);
+?>
+--EXPECT--
+array(1) {
+ ["f"]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+array(3) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ string(1) "f"
+}
+
diff --git a/ext/standard/tests/general_functions/bug44295-win.phpt b/ext/standard/tests/general_functions/bug44295-win.phpt
new file mode 100644
index 0000000..d210a54
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44295-win.phpt
@@ -0,0 +1,29 @@
+--TEST--
+user defined error handler + set_error_handling(EH_THROW)
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows only");
+ if (!extension_loaded("spl") || is_dir('c:\\not\\exists\\here')) die("skip");
+?>
+--FILE--
+<?php
+$dir = 'c:\\not\\exists\\here';
+
+set_error_handler('my_error_handler');
+function my_error_handler() {$a = func_get_args(); print "in error handler\n"; }
+
+try {
+ print "before\n";
+ $iter = new DirectoryIterator($dir);
+ print get_class($iter) . "\n";
+ print "after\n";
+} catch (Exception $e) {
+ print "in catch: ".$e->getMessage()."\n";
+}
+?>
+==DONE==
+<?php exit(0); ?>
+--EXPECT--
+before
+in catch: DirectoryIterator::__construct(c:\not\exists\here,c:\not\exists\here): The system cannot find the path specified. (code: 3)
+==DONE==
diff --git a/ext/standard/tests/general_functions/bug44295.phpt b/ext/standard/tests/general_functions/bug44295.phpt
new file mode 100644
index 0000000..a184719
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44295.phpt
@@ -0,0 +1,29 @@
+--TEST--
+user defined error handler + set_error_handling(EH_THROW)
+--SKIPIF--
+<?php
+ if(substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows");
+ if (!extension_loaded("spl") || is_dir('/this/path/does/not/exist')) die("skip");
+?>
+--FILE--
+<?php
+$dir = '/this/path/does/not/exist';
+
+set_error_handler('my_error_handler');
+function my_error_handler() {$a = func_get_args(); print "in error handler\n"; }
+
+try {
+ print "before\n";
+ $iter = new DirectoryIterator($dir);
+ print get_class($iter) . "\n";
+ print "after\n";
+} catch (Exception $e) {
+ print "in catch: ".$e->getMessage()."\n";
+}
+?>
+==DONE==
+<?php exit(0); ?>
+--EXPECT--
+before
+in catch: DirectoryIterator::__construct(/this/path/does/not/exist): failed to open dir: No such file or directory
+==DONE==
diff --git a/ext/standard/tests/general_functions/bug44394.phpt b/ext/standard/tests/general_functions/bug44394.phpt
new file mode 100644
index 0000000..26351a2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44394.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #44394 (Last two bytes missing from output)
+--FILE--
+<?php
+
+$string = "<a href='a?q=1'>asd</a>";
+
+output_add_rewrite_var('a', 'b');
+
+echo $string;
+
+ob_flush();
+
+ob_end_clean();
+
+?>
+--EXPECT--
+<a href='a?q=1&a=b'>asd</a>
diff --git a/ext/standard/tests/general_functions/bug44394_2.phpt b/ext/standard/tests/general_functions/bug44394_2.phpt
new file mode 100644
index 0000000..3ca5397
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44394_2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #44394 (Last two bytes missing from output) with session.use_trans_id
+--SKIPIF--
+<?php if (!extension_loaded("session")) print "skip"; ?>
+--INI--
+session.name=PHPSESSID
+session.use_only_cookies=0
+--FILE--
+<?php
+
+ini_set('session.use_trans_sid', 1);
+session_save_path(__DIR__);
+session_start();
+
+ob_start();
+
+$string = "<a href='a?q=1'>asd</a>";
+
+output_add_rewrite_var('a', 'b');
+
+echo $string;
+
+ob_flush();
+
+ob_end_clean();
+
+?>
+--CLEAN--
+<?php
+foreach (glob(__DIR__ . '/sess_*') as $filename) {
+ unlink($filename);
+}
+?>
+--EXPECTF--
+<a href='a?q=1&PHPSESSID=%s&a=b'>asd</a>
diff --git a/ext/standard/tests/general_functions/bug44461.phpt b/ext/standard/tests/general_functions/bug44461.phpt
new file mode 100644
index 0000000..6fa73ee
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44461.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #44461 (parse_ini_file crashes)
+--FILE--
+<?php
+file_put_contents(__DIR__ . 'bug44461.ini', <<<EOF
+[attachments]
+zip = "application/zip" ; MIME-type for ZIP files
+EOF
+);
+parse_ini_file(__DIR__ . 'bug44461.ini', true);
+?>
+===DONE===
+--CLEAN--
+<?php
+unlink(__DIR__ . 'bug44461.ini');
+?>
+--EXPECT--
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/bug44487.phpt b/ext/standard/tests/general_functions/bug44487.phpt
new file mode 100644
index 0000000..10c52c6
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44487.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #44487 (call_user_method_array issues a warning when throwing an exception)
+--INI--
+error_reporting = E_ALL & ~E_DEPRECATED
+--FILE--
+<?php
+
+class Foo
+{
+ public function test()
+ {
+ print 'test';
+ throw new Exception();
+ }
+}
+
+try {
+ $bar = new Foo();
+ call_user_method_array('test', $bar, array()) ;
+} catch (Exception $e) {
+}
+?>
+--EXPECT--
+test
diff --git a/ext/standard/tests/general_functions/bug44667.phpt b/ext/standard/tests/general_functions/bug44667.phpt
new file mode 100644
index 0000000..49183cc
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug44667.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly)
+--SKIPIF--
+<?php if (!is_executable('/bin/cat')) echo 'skip cat not found'; ?>
+--FILE--
+<?php
+
+$pipes = array();
+
+$descriptor_spec = array(
+ 0 => array('pipe', 'rb'),
+ 1 => array('pipe', 'wb'),
+);
+
+$proc = proc_open('cat', $descriptor_spec, $pipes);
+
+fwrite($pipes[0], 'Hello', 5);
+fflush($pipes[0]);
+fclose($pipes[0]);
+
+$result = fread($pipes[1], 5);
+fclose($pipes[1]);
+
+proc_close($proc);
+
+echo "Result is: ", $result, "\n";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Result is: Hello
+Done
diff --git a/ext/standard/tests/general_functions/bug46587.phpt b/ext/standard/tests/general_functions/bug46587.phpt
new file mode 100644
index 0000000..becbde9
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug46587.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #46587 (mt_rand() does not check that max is greater than min).
+--FILE--
+<?php
+
+var_dump(mt_rand(3,8));
+var_dump(mt_rand(8,3));
+
+echo "Done.\n";
+?>
+--EXPECTF--
+int(%d)
+
+Warning: mt_rand(): max(3) is smaller than min(8) in %s on line %d
+bool(false)
+Done.
diff --git a/ext/standard/tests/general_functions/bug47027.phpt b/ext/standard/tests/general_functions/bug47027.phpt
new file mode 100644
index 0000000..e4f5aae
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug47027.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #47027 (var_export doesn't show numeric indices on ArrayObject)
+--FILE--
+<?php
+$ao = new ArrayObject(array (2 => "foo", "bar" => "baz"));
+var_export ($ao);
+?>
+--EXPECT--
+ArrayObject::__set_state(array(
+ 2 => 'foo',
+ 'bar' => 'baz',
+))
diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt
new file mode 100644
index 0000000..3bdf1c2
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug47857.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #47851 (is_callable throws fatal error)
+--FILE--
+<?php
+class foo {
+ function bar() {
+ echo "ok\n";
+ }
+}
+var_dump(is_callable(array('foo','bar')));
+foo::bar();
+var_dump(is_callable(array('Exception','getMessage')));
+Exception::getMessage();
+?>
+--EXPECTF--
+bool(true)
+
+Strict Standards: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d
+ok
+bool(false)
+
+Fatal error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php on line %d
+
diff --git a/ext/standard/tests/general_functions/bug47859.phpt b/ext/standard/tests/general_functions/bug47859.phpt
new file mode 100644
index 0000000..458a116
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug47859.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #47859 (parse_ini_file() does not like asterisk (*) in key in the beginning)
+--FILE--
+<?php
+var_dump(parse_ini_string('*key = "*value"'));
+var_dump(parse_ini_string('-key = "-value"'));
+var_dump(parse_ini_string('_key = "_value"'));
+
+var_dump(parse_ini_string('key* = "value*"'));
+var_dump(parse_ini_string('key.*.* = "value.*.*"'));
+var_dump(parse_ini_string('*.*.key = "*.*.value"'));
+var_dump(parse_ini_string('k*e*y = "v*a*lue"'));
+?>
+--EXPECT--
+array(1) {
+ ["*key"]=>
+ string(6) "*value"
+}
+array(1) {
+ ["-key"]=>
+ string(6) "-value"
+}
+array(1) {
+ ["_key"]=>
+ string(6) "_value"
+}
+array(1) {
+ ["key*"]=>
+ string(6) "value*"
+}
+array(1) {
+ ["key.*.*"]=>
+ string(9) "value.*.*"
+}
+array(1) {
+ ["*.*.key"]=>
+ string(9) "*.*.value"
+}
+array(1) {
+ ["k*e*y"]=>
+ string(7) "v*a*lue"
+}
diff --git a/ext/standard/tests/general_functions/bug48660.phpt b/ext/standard/tests/general_functions/bug48660.phpt
new file mode 100644
index 0000000..4c1492a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug48660.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Bug #48660 (parse_ini_*(): dollar sign as last character of value fails)
+--FILE--
+<?php
+
+$ini_location = dirname(__FILE__) . '/bug48660.tmp';
+
+// Build ini data
+$ini_data = '
+[cases]
+
+Case.a = avalue
+Case.b = "$dollar_sign"
+Case.c = "dollar_sign$"
+Case.d = "$dollar_sign$"
+Case.e = 10
+';
+
+// Save ini data to file
+file_put_contents($ini_location, $ini_data);
+
+var_dump(parse_ini_file($ini_location, true, INI_SCANNER_RAW));
+var_dump(parse_ini_file($ini_location, true, INI_SCANNER_NORMAL));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48660.tmp'); ?>
+--EXPECTF--
+array(1) {
+ ["cases"]=>
+ array(5) {
+ ["Case.a"]=>
+ string(6) "avalue"
+ ["Case.b"]=>
+ string(12) "$dollar_sign"
+ ["Case.c"]=>
+ string(12) "dollar_sign$"
+ ["Case.d"]=>
+ string(13) "$dollar_sign$"
+ ["Case.e"]=>
+ string(2) "10"
+ }
+}
+array(1) {
+ ["cases"]=>
+ array(5) {
+ ["Case.a"]=>
+ string(6) "avalue"
+ ["Case.b"]=>
+ string(12) "$dollar_sign"
+ ["Case.c"]=>
+ string(12) "dollar_sign$"
+ ["Case.d"]=>
+ string(13) "$dollar_sign$"
+ ["Case.e"]=>
+ string(2) "10"
+ }
+}
diff --git a/ext/standard/tests/general_functions/bug48768.phpt b/ext/standard/tests/general_functions/bug48768.phpt
new file mode 100644
index 0000000..ae8329a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug48768.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #48768 (parse_ini_*() crashes with INI_SCANNER_RAW)
+--FILE--
+<?php
+
+$ini_location = dirname(__FILE__) . '/bug48768.tmp';
+
+// Build ini data
+$ini_data = <<< EOT
+equal = "="
+
+EOT;
+
+// Save ini data to file
+file_put_contents($ini_location, $ini_data);
+
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_RAW));
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_NORMAL));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48768.tmp'); ?>
+--EXPECT--
+array(1) {
+ ["equal"]=>
+ string(1) "="
+}
+array(1) {
+ ["equal"]=>
+ string(1) "="
+}
diff --git a/ext/standard/tests/general_functions/bug49056.phpt b/ext/standard/tests/general_functions/bug49056.phpt
new file mode 100644
index 0000000..208766c
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49056.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #49056 (parse_ini_*() regression in 5.3.0 when using non-ASCII strings as option keys)
+--FILE--
+<?php
+
+$string = <<<EOT
+Cooking_furniture="Küchen Möbel (en)"
+Küchen_Möbel="Cooking furniture (en)"
+EOT;
+
+$filename = dirname(__FILE__) . '/bug49056.tmp';
+
+file_put_contents( $filename, $string);
+
+var_dump(parse_ini_file($filename));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug49056.tmp'); ?>
+--EXPECT--
+array(2) {
+ ["Cooking_furniture"]=>
+ string(23) "Küchen Möbel (en)"
+ ["Küchen_Möbel"]=>
+ string(22) "Cooking furniture (en)"
+}
diff --git a/ext/standard/tests/general_functions/bug49692.ini b/ext/standard/tests/general_functions/bug49692.ini
new file mode 100644
index 0000000..5def69a
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49692.ini
@@ -0,0 +1,4 @@
+//my.ini file
+[sitemap]
+/home = default:index
+/info = default:info
diff --git a/ext/standard/tests/general_functions/bug49692.phpt b/ext/standard/tests/general_functions/bug49692.phpt
new file mode 100644
index 0000000..80a1612
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49692.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #49692: parse_ini_file() throws errors when key contains '/' (forward slash)
+--CREDITS--
+Rafael Dohms <rdohms [at] gmail [dot] com>
+--FILE--
+<?php
+
+var_dump(parse_ini_file('bug49692.ini', true));
+
+?>
+--EXPECTF--
+array(1) {
+ ["sitemap"]=>
+ array(2) {
+ ["/home"]=>
+ string(13) "default:index"
+ ["/info"]=>
+ string(12) "default:info"
+ }
+}
diff --git a/ext/standard/tests/general_functions/bug49847.phpt b/ext/standard/tests/general_functions/bug49847.phpt
new file mode 100644
index 0000000..112592d
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug49847.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #49847 (exec() fails on lines larger then 4095 bytes)
+--FILE--
+<?php
+$iswin = substr(PHP_OS, 0, 3) == "WIN";
+
+if ($iswin) {
+ $f = dirname(__FILE__) . '\\bug49847.tmp';
+ $s = str_repeat(' ', 4097);
+ $s .= '1';
+ file_put_contents($f, $s);
+ exec('type ' . $f, $output);
+} else {
+ exec("printf %4098d 1", $output);
+}
+var_dump($output);
+if ($iswin) {
+ unlink($f);
+}
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(4098) "%s 1"
+}
+
diff --git a/ext/standard/tests/general_functions/bug50690.phpt b/ext/standard/tests/general_functions/bug50690.phpt
new file mode 100644
index 0000000..4d9f0dc
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug50690.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+<?php
+putenv("foo=ab");
+putenv("bar=c");
+var_dump(getenv("foo"));
+var_dump(getenv("bar"));
+var_dump(getenv("thisvardoesnotexist"));
+?>
+--EXPECT--
+string(2) "ab"
+string(1) "c"
+bool(false)
diff --git a/ext/standard/tests/general_functions/bug50732.phpt b/ext/standard/tests/general_functions/bug50732.phpt
new file mode 100644
index 0000000..ed8341d
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug50732.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #50732 (exec() adds single byte twice to $output array)
+--FILE--
+<?php
+exec("echo x", $output);
+var_dump($output);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(1) "x"
+}
diff --git a/ext/standard/tests/general_functions/bug52138.data b/ext/standard/tests/general_functions/bug52138.data
new file mode 100644
index 0000000..4ce82e0
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug52138.data
@@ -0,0 +1,11 @@
+[MYCONST]
+MYCONST = MYCONST
+
+[M_PI]
+FOO=M_PI " test"
+
+[foo::bar]
+A=1
+B=A "A" A
+
+[MYCONST M_PI]
diff --git a/ext/standard/tests/general_functions/bug52138.phpt b/ext/standard/tests/general_functions/bug52138.phpt
new file mode 100644
index 0000000..d4f3873
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug52138.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #52138 (Constants are parsed into the ini file for section names)
+--FILE--
+<?php
+
+define('MYCONST', 1);
+define('A', 'B');
+
+$ini_file = dirname(__FILE__)."/bug52138.data";
+
+$ret = parse_ini_file($ini_file, true);
+var_dump($ret);
+
+?>
+--EXPECTF--
+array(4) {
+ ["MYCONST"]=>
+ array(1) {
+ ["MYCONST"]=>
+ string(1) "1"
+ }
+ ["M_PI"]=>
+ array(1) {
+ ["FOO"]=>
+ string(%d) "3.%d test"
+ }
+ ["foo::bar"]=>
+ array(2) {
+ ["A"]=>
+ string(1) "1"
+ ["B"]=>
+ string(3) "BAB"
+ }
+ ["MYCONST M_PI"]=>
+ array(0) {
+ }
+}
diff --git a/ext/standard/tests/general_functions/bug55371.phpt b/ext/standard/tests/general_functions/bug55371.phpt
new file mode 100644
index 0000000..179da01
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug55371.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning)
+--FILE--
+<?php
+
+get_magic_quotes_gpc();
+get_magic_quotes_runtime();
+
+?>
+--EXPECT--
diff --git a/ext/standard/tests/general_functions/bug60227_1.phpt b/ext/standard/tests/general_functions/bug60227_1.phpt
new file mode 100644
index 0000000..8efe222
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_1.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR)
+--FILE--
+<?php
+header("X-Foo1: a");
+header("X-Foo2: b\n ");
+header("X-Foo3: c\r\n ");
+header("X-Foo4: d\r ");
+header("X-Foo5: e\rSet-Cookie: ID=123");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected in %s on line %d
+foo
+--EXPECTHEADERS--
+X-Foo1: a
+X-Foo2: b
+X-Foo3: c
+X-Foo4: d
+
diff --git a/ext/standard/tests/general_functions/bug60227_2.phpt b/ext/standard/tests/general_functions/bug60227_2.phpt
new file mode 100644
index 0000000..995c364
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_2.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), \r before \n
+--FILE--
+<?php
+header("X-foo: e\n foo");
+header("X-Foo6: e\rSet-Cookie: ID=123\n d");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+foo
diff --git a/ext/standard/tests/general_functions/bug60227_3.phpt b/ext/standard/tests/general_functions/bug60227_3.phpt
new file mode 100644
index 0000000..8cba9b8
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_3.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), \0 before \n
+--FILE--
+<?php
+header("X-foo: e\n foo");
+header("X-Foo6: e\0Set-Cookie: ID=\n123\n d");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain NUL bytes in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+foo
diff --git a/ext/standard/tests/general_functions/bug60227_4.phpt b/ext/standard/tests/general_functions/bug60227_4.phpt
new file mode 100644
index 0000000..d5e2573
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60227_4.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #60227 (header() cannot detect the multi-line header with CR), CRLF
+--FILE--
+<?php
+header("X-foo: e\r\n foo");
+header("X-foo: e\r\nfoo");
+echo 'foo';
+?>
+--EXPECTF--
+Warning: Header may not contain more than a single header, new line detected in %s on line %d
+foo
+--EXPECTHEADERS--
+X-foo: e
+ foo
diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt
new file mode 100644
index 0000000..07b801b
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #60723 (error_log error time has changed to UTC ignoring default timezo)
+--INI--
+date.timezone=ASIA/Chongqing
+log_errors=On
+--FILE--
+<?php
+$dir = dirname(__FILE__);
+$log = $dir . "/tmp.err";
+ini_set("error_log", $log);
+echo $aa;
+error_log("dummy");
+readfile($log);
+unlink($log);
+?>
+--EXPECTF--
+Notice: Undefined variable: aa in %sbug60723.php on line %d
+[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d
+[%s ASIA/Chongqing] dummy
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
new file mode 100644
index 0000000..c05a329
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
@@ -0,0 +1,59 @@
+--TEST--
+call_user_func_array() passes by reference if the array element is referenced, regardless of function signature.
+--FILE--
+<?php
+
+function by_val($arg) {
+ $arg = 'changed';
+}
+
+function by_ref(&$arg) {
+ $arg = 'changed';
+}
+
+echo "------ Calling by_val() with unreferenced argument ------\n";
+$arg = array('original');
+call_user_func_array('by_val', $arg);
+var_dump($arg);
+
+echo "------ Calling by_ref() with unreferenced argument ------\n";
+$arg = array('original');
+call_user_func_array('by_ref', $arg);
+var_dump($arg);
+
+echo "------ Calling by_val() with referenced argument ------\n";
+$arg = array('original');
+$ref = &$arg[0];
+call_user_func_array('by_val', $arg);
+var_dump($arg);
+
+echo "------ Calling by_ref() with referenced argument ------\n";
+$arg = array('original');
+$ref = &$arg[0];
+call_user_func_array('by_ref', $arg);
+var_dump($arg);
+
+?>
+--EXPECTF--
+------ Calling by_val() with unreferenced argument ------
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+------ Calling by_ref() with unreferenced argument ------
+
+Warning: Parameter 1 to by_ref() expected to be a reference, value given in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+------ Calling by_val() with referenced argument ------
+array(1) {
+ [0]=>
+ &string(8) "original"
+}
+------ Calling by_ref() with referenced argument ------
+array(1) {
+ [0]=>
+ &string(7) "changed"
+}
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt
new file mode 100644
index 0000000..4a4845a
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_002.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test call_user_func_array() function : first parameter variation
+--FILE--
+<?php
+/* Prototype : mixed call_user_func_array(string function_name, array parameters)
+ * Description: Call a user function which is the first parameter with the arguments contained in array
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing call_user_func_array() : usage variation ***\n";
+
+// Define error handler
+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');
+
+// Initialise function arguments not being substituted (if any)
+$parameters = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for function_name
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( call_user_func_array($value, $parameters) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing call_user_func_array() : usage variation ***
+
+--int 0--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--empty array--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--lowercase null--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--lowercase true--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+
+--unset var--
+Error: 2 - call_user_func_array() expects parameter 1 to be a valid callback, no array or string given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt
new file mode 100644
index 0000000..077d4f8
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_003.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test call_user_func_array() function : second parameter variation
+--FILE--
+<?php
+/* Prototype : mixed call_user_func_array(string function_name, array parameters)
+ * Description: Call a user function which is the first parameter with the arguments contained in array
+ * Source code: ext/standard/basic_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing call_user_func_array() : usage variation ***\n";
+
+// Define error handler
+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');
+
+// Initialise function arguments not being substituted (if any)
+function test_func() {
+}
+$function_name = 'test_func';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for parameters
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( call_user_func_array($function_name, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing call_user_func_array() : usage variation ***
+
+--int 0--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--int 1--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--int 12345--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--int -12345--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, integer given, %s(%d)
+NULL
+
+--float 10.5--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float -10.5--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float 12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float -12.3456789000e10--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--float .5--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, double given, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+
+--lowercase null--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+
+--lowercase true--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--lowercase false--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--uppercase TRUE--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--uppercase FALSE--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, boolean given, %s(%d)
+NULL
+
+--empty string DQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, object given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+
+--unset var--
+Error: 2 - call_user_func_array() expects parameter 2 to be array, null given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_func_return.phpt b/ext/standard/tests/general_functions/call_user_func_return.phpt
new file mode 100644
index 0000000..929fdd7
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_func_return.phpt
@@ -0,0 +1,44 @@
+--TEST--
+call_user_func() and return value
+--FILE--
+<?php
+
+$t1 = 'test1';
+
+function test1($arg1, $arg2)
+{
+ global $t1;
+ echo "$arg1 $arg2\n";
+ return $t1;
+}
+
+$t2 = 'test2';
+
+function & test2($arg1, $arg2)
+{
+ global $t2;
+ echo "$arg1 $arg2\n";
+ return $t2;
+}
+
+function test($func)
+{
+ debug_zval_dump($func('Direct', 'Call'));
+ debug_zval_dump(call_user_func_array($func, array('User', 'Func')));
+}
+
+test('test1');
+test('test2');
+
+?>
+===DONE===
+--EXPECTF--
+Direct Call
+string(5) "test1" refcount(1)
+User Func
+string(5) "test1" refcount(1)
+Direct Call
+string(5) "test2" refcount(2)
+User Func
+string(5) "test2" refcount(1)
+===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_method.phpt b/ext/standard/tests/general_functions/call_user_method.phpt
new file mode 100644
index 0000000..cc54ff9
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_method.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Basic behaviour of call_user_method() test
+--CREDITS--
+Sebastian Schürmann
+sebs@php.net
+Testfest 2009 Munich
+--FILE--
+<?php
+class a {
+ static function b() {
+ return true;
+ }
+}
+$a = new a();
+$res = call_user_method('b', $a);
+var_dump($res);
+?>
+--EXPECTF--
+Deprecated: Function call_user_method() is deprecated in %s on line 8
+bool(true)
diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt
new file mode 100644
index 0000000..054bc3e
--- /dev/null
+++ b/ext/standard/tests/general_functions/call_user_method_002.phpt
@@ -0,0 +1,12 @@
+--TEST--
+call_user_method() Invalid free
+--FILE--
+<?php
+
+call_user_method("1", $arr1);
+
+?>
+--EXPECTF--
+Deprecated: Function call_user_method() is deprecated in %s on line %d
+
+Warning: call_user_method(): Second argument is not an object or class name in %s on line %d
diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt
new file mode 100644
index 0000000..a58f19d
--- /dev/null
+++ b/ext/standard/tests/general_functions/callbacks_001.phpt
@@ -0,0 +1,108 @@
+--TEST--
+ZE2 Callbacks of static functions
+--FILE--
+<?php
+class A {
+ public static function who() {
+ echo "A\n";
+ }
+ public static function who2() {
+ echo "A\n";
+ }
+}
+
+class B extends A {
+ public static function who() {
+ echo "B\n";
+ }
+}
+
+class C extends B {
+ public function call($cb) {
+ echo join('|', $cb) . "\n";
+ call_user_func($cb);
+ }
+ public function test() {
+ $this->call(array('parent', 'who'));
+ $this->call(array('C', 'parent::who'));
+ $this->call(array('B', 'parent::who'));
+ $this->call(array('E', 'parent::who'));
+ $this->call(array('A', 'who'));
+ $this->call(array('C', 'who'));
+ $this->call(array('B', 'who2'));
+ }
+}
+
+class D {
+ public static function who() {
+ echo "D\n";
+ }
+}
+
+class E extends D {
+ public static function who() {
+ echo "E\n";
+ }
+}
+
+$o = new C;
+$o->test();
+
+class O {
+ public function who() {
+ echo "O\n";
+ }
+}
+
+class P extends O {
+ function __toString() {
+ return '$this';
+ }
+ public function who() {
+ echo "P\n";
+ }
+ public function call($cb) {
+ echo join('|', $cb) . "\n";
+ call_user_func($cb);
+ }
+ public function test() {
+ $this->call(array('parent', 'who'));
+ $this->call(array('P', 'parent::who'));
+ $this->call(array($this, 'O::who'));
+ $this->call(array($this, 'B::who'));
+ }
+}
+
+echo "===FOREIGN===\n";
+
+$o = new P;
+$o->test();
+
+?>
+===DONE===
+--EXPECTF--
+parent|who
+B
+C|parent::who
+B
+B|parent::who
+A
+E|parent::who
+D
+A|who
+A
+C|who
+B
+B|who2
+A
+===FOREIGN===
+parent|who
+O
+P|parent::who
+O
+$this|O::who
+O
+$this|B::who
+
+Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt
new file mode 100644
index 0000000..22130c5
--- /dev/null
+++ b/ext/standard/tests/general_functions/callbacks_002.phpt
@@ -0,0 +1,16 @@
+--TEST--
+call_user_func(): Wrong parameters
+--FILE--
+<?php
+
+call_user_func(array('Foo', 'bar'));
+call_user_func(array(NULL, 'bar'));
+call_user_func(array('stdclass', NULL));
+
+?>
+--EXPECTF--
+Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d
+
+Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
+
+Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d
diff --git a/ext/standard/tests/general_functions/closures_001.phpt b/ext/standard/tests/general_functions/closures_001.phpt
new file mode 100644
index 0000000..b4fc898
--- /dev/null
+++ b/ext/standard/tests/general_functions/closures_001.phpt
@@ -0,0 +1,11 @@
+--TEST--
+register_shutdown_function() & closure
+--FILE--
+<?php
+register_shutdown_function(function () { echo "Hello World!\n"; });
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done
+Hello World!
diff --git a/ext/standard/tests/general_functions/closures_002.phpt b/ext/standard/tests/general_functions/closures_002.phpt
new file mode 100644
index 0000000..6df389b
--- /dev/null
+++ b/ext/standard/tests/general_functions/closures_002.phpt
@@ -0,0 +1,25 @@
+--TEST--
+register_tick_function() & closure
+--FILE--
+<?php
+
+declare (ticks = 1);
+
+$i = 0;
+register_tick_function(function () use (&$i) { $i++; });
+
+echo "Test\n";
+echo "$i\n";
+echo "$i\n";
+var_dump ($i != 0);
+echo "$i\n";
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test
+%d
+%d
+bool(true)
+%d
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt
new file mode 100644
index 0000000..e83cdbf
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt
Binary files differ
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt
new file mode 100644
index 0000000..d6d8ae2
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt
Binary files differ
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_e.phpt b/ext/standard/tests/general_functions/debug_zval_dump_e.phpt
new file mode 100644
index 0000000..4929362
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_e.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test debug_zval_dump() function : error conditions
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value
+ to output.
+*/
+
+echo "*** Testing error conditions ***\n";
+
+/* passing zero argument */
+debug_zval_dump();
+
+echo "Done\n";
+
+?>
+
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: debug_zval_dump() expects at least %d parameter, %d given in %s on line %d
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
new file mode 100644
index 0000000..78f0f03
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
@@ -0,0 +1,841 @@
+--TEST--
+Test debug_zval_dump() function : working on objects
+--SKIPIF--
+<?php if (PHP_ZTS) { print "skip only for no-zts build"; }
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value to output.
+*/
+
+/* Prototype: void zval_dump( $value );
+ Description: use debug_zval_dump() to display the objects and its
+ reference count */
+function zval_dump( $values ) {
+ $counter = 1;
+ foreach( $values as $value ) {
+ echo "-- Iteration $counter --\n";
+ debug_zval_dump( $value );
+ $counter++;
+ }
+}
+
+/* checking on objects type */
+echo "*** Testing debug_zval_dump() on objects ***\n";
+class object_class {
+ var $value1 = 1;
+ private $value2 = 10;
+ protected $value3 = 20;
+ public $value4 = 30;
+
+ private function foo1() {
+ echo "function foo1\n";
+ }
+ protected function foo2() {
+ echo "function foo2\n";
+ }
+ public function foo3() {
+ echo "function foo3\n";
+ }
+ public $array_var = array( "key1" => 1, "key2 " => 3);
+
+ function object_class () {
+ $this->value1 = 5;
+ $this->object_class1 = $this;
+ }
+}
+
+class no_member_class{
+//no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ protected $p1 = 40;
+ private $p2 = 50;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* creating new object $obj */
+$obj = new contains_object_class();
+$obj1 = & $obj; //object $obj1 references object $obj
+$obj2 = & $obj;
+$obj3 = & $obj2;
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ @$temp_class_obj, //undefined object
+ $obj2->class_object1,
+ $obj3->class_object2,
+ $obj2->class_object1->value4,
+ @$unset_obj
+);
+/* using zval_dump() to dump out the objects and its reference count */
+zval_dump($objects);
+
+$int_var = 500;
+$obj = $int_var; //$obj is lost, $obj1,$obj2,$obj3,$obj4 = 500
+echo "\n-- Testing debug_zval_dump() on overwritten object variables --\n";
+debug_zval_dump($obj, $obj1, $obj2, $obj3);
+
+echo "\n-- Testing debug_zval_dump() on objects having circular reference --\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+debug_zval_dump($recursion_obj2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing debug_zval_dump() on objects ***
+-- Iteration 1 --
+object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(5){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 2 --
+object(no_member_class)#%d (0) refcount(4){
+}
+-- Iteration 3 --
+object(contains_object_class)#%d (9) refcount(4){
+ ["p"]=>
+ long(30) refcount(2)
+ ["p1":protected]=>
+ long(40) refcount(2)
+ ["p2":"contains_object_class":private]=>
+ long(50) refcount(2)
+ ["class_object1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object4":protected]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) refcount(3){
+ }
+ ["class_object5"]=>
+ object(contains_object_class)#%d (9) refcount(1){
+ ["p"]=>
+ long(30) refcount(2)
+ ["p1":protected]=>
+ long(40) refcount(2)
+ ["p2":"contains_object_class":private]=>
+ long(50) refcount(2)
+ ["class_object1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object2"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["class_object4":protected]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(7){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#%d (0) refcount(3){
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 4 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 5 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 6 --
+object(no_member_class)#%d (0) refcount(5){
+}
+-- Iteration 7 --
+NULL refcount(1)
+-- Iteration 8 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 9 --
+object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (6) refcount(9){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(5)
+ ["value3":protected]=>
+ long(20) refcount(5)
+ ["value4"]=>
+ long(30) refcount(7)
+ ["array_var"]=>
+ array(2) refcount(5){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ }
+}
+-- Iteration 10 --
+long(30) refcount(9)
+-- Iteration 11 --
+NULL refcount(1)
+
+-- Testing debug_zval_dump() on overwritten object variables --
+long(500) refcount(1)
+long(500) refcount(1)
+long(500) refcount(1)
+long(500) refcount(1)
+
+-- Testing debug_zval_dump() on objects having circular reference --
+object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ object(object_class)#%d (7) refcount(1){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ &object(object_class)#%d (7) refcount(2){
+ ["value1"]=>
+ long(5) refcount(1)
+ ["value2":"object_class":private]=>
+ long(10) refcount(7)
+ ["value3":protected]=>
+ long(20) refcount(7)
+ ["value4"]=>
+ long(30) refcount(8)
+ ["array_var"]=>
+ array(2) refcount(7){
+ ["key1"]=>
+ long(1) refcount(1)
+ ["key2 "]=>
+ long(3) refcount(1)
+ }
+ ["object_class1"]=>
+ *RECURSION*
+ ["obj"]=>
+ *RECURSION*
+ }
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
new file mode 100644
index 0000000..82ee2a6
--- /dev/null
+++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
@@ -0,0 +1,204 @@
+--TEST--
+Test debug_zval_dump() function : usage variations
+--FILE--
+<?php
+/* Prototype: void debug_zval_dump ( mixed $variable );
+ Description: Dumps a string representation of an internal zend value
+ to output.
+*/
+
+echo "*** Testing debug_zval_dump() on functions ***\n";
+echo "--- Variation 1: global variable inside a function ---\n";
+$global_var = 10; //declaring global variable
+
+/* function to dump reference count of global variable,$global_var
+ and local variable,$local_var */
+function dump_globalvar( &$local_var ) {
+ global $global_var;
+ echo "\n-- Value of local variable inside dump_globalvar() --\n";
+ debug_zval_dump( $local_var );
+ echo "\n-- Value of global variable inside dump_globalvar() --\n";
+ debug_zval_dump( $global_var );
+}
+/* dump value and reference count of $global_var using debug_zval_dump() */
+echo "\n-- Value of global variable, before calling dump_globalvar() --\n";
+debug_zval_dump( $global_var );
+
+/* calling function dump_globalvar() to check the reference count of local
+ and global variables inside the function */
+dump_globalvar( $global_var );
+
+/* dump value and reference count of $global_var after exiting function
+ dump_globalvar();
+ expected: reference count of $global_var should remain the same as
+ before calling dump_globalvar() function */
+echo "\n-- Value of global variable, after exiting dump_globalvar() --\n";
+debug_zval_dump( $global_var );
+
+echo "\n--- Variation 2: one variable references another ---\n";
+$first_var = 10;
+/* dump value and reference count of $first_var */
+echo "\n-- Value of \$first_var: --\n";
+debug_zval_dump($first_var);
+
+/* $ref_first_var references $first_var */
+$ref_first_var = &$var_1;
+
+echo "\n-- Value of \$ref_first_var --\n";
+debug_zval_dump($ref_first_var);
+echo "\n-- Value of \$first_var --\n";
+debug_zval_dump($first_var);
+
+unset($ref_first_var);
+
+/* dump value and reference count of $first_var, $ref_first_var
+ here $ref_first_var is unset */
+echo "\n-- Value of \$ref_first_var --\n";
+debug_zval_dump($ref_first_var);
+echo "\n-- Value of \$first_var --\n";
+debug_zval_dump($first_var);
+
+echo "\n--- Variation 3: multiple references of variables ---\n";
+$var_1 = 10;
+$var_2 = &$var_1;
+$var_3 = &$var_2;
+echo "\n-- Value of \$var_1: (before referencing) --\n";
+debug_zval_dump($var_1);
+echo "\n-- Value of \$var_2: (referencing var_1) --\n";
+debug_zval_dump($var_2);
+echo "\n-- Value of \$var_3: (referencing var_2) --\n";
+debug_zval_dump($var_3);
+
+/* unsetting $var_3 */
+unset($var_3);
+echo "\n-- Value of \$var_3: (after unsetting var_3) --\n";
+debug_zval_dump($var_3);
+echo "\n-- Value of \$var_2: --\n";
+debug_zval_dump($var_2);
+echo "\n-- Value of \$var_3: --\n";
+debug_zval_dump($var_1);
+
+/* unsetting $var_1 */
+unset($var_1);
+echo "\n-- Value of \$var_1: (after unsetting variable_1) --\n";
+debug_zval_dump($var_1);
+echo "\n-- Value of \$var_2: --\n";
+debug_zval_dump($var_2);
+
+echo "\n*** Testing debug_zval_dump() on miscelleneous input arguments ***\n";
+/* unset a variable */
+$unset_var = 10.5;
+unset($unset_var);
+
+$misc_values = array (
+ /* nulls */
+ NULL,
+ null,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* undefined variable */
+ @$undef_var,
+
+ /* mixed types */
+ @TRUE123,
+ "123string",
+ "string123",
+ "NULLstring"
+);
+/* loop to display the variables and its reference count using
+ debug_zval_dump() */
+$counter = 1;
+foreach( $misc_values as $value ) {
+ echo "-- Iteration $counter --\n";
+ debug_zval_dump( $value );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+
+--EXPECTF--
+*** Testing debug_zval_dump() on functions ***
+--- Variation 1: global variable inside a function ---
+
+-- Value of global variable, before calling dump_globalvar() --
+long(10) refcount(2)
+
+-- Value of local variable inside dump_globalvar() --
+long(10) refcount(1)
+
+-- Value of global variable inside dump_globalvar() --
+long(10) refcount(1)
+
+-- Value of global variable, after exiting dump_globalvar() --
+long(10) refcount(2)
+
+--- Variation 2: one variable references another ---
+
+-- Value of $first_var: --
+long(10) refcount(2)
+
+-- Value of $ref_first_var --
+NULL refcount(1)
+
+-- Value of $first_var --
+long(10) refcount(2)
+
+-- Value of $ref_first_var --
+
+Notice: Undefined variable: ref_first_var in %s on line %d
+NULL refcount(1)
+
+-- Value of $first_var --
+long(10) refcount(2)
+
+--- Variation 3: multiple references of variables ---
+
+-- Value of $var_1: (before referencing) --
+long(10) refcount(1)
+
+-- Value of $var_2: (referencing var_1) --
+long(10) refcount(1)
+
+-- Value of $var_3: (referencing var_2) --
+long(10) refcount(1)
+
+-- Value of $var_3: (after unsetting var_3) --
+
+Notice: Undefined variable: var_3 in %s on line %d
+NULL refcount(1)
+
+-- Value of $var_2: --
+long(10) refcount(1)
+
+-- Value of $var_3: --
+long(10) refcount(1)
+
+-- Value of $var_1: (after unsetting variable_1) --
+
+Notice: Undefined variable: var_1 in %s on line %d
+NULL refcount(1)
+
+-- Value of $var_2: --
+long(10) refcount(2)
+
+*** Testing debug_zval_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL refcount(3)
+-- Iteration 2 --
+NULL refcount(3)
+-- Iteration 3 --
+NULL refcount(1)
+-- Iteration 4 --
+NULL refcount(1)
+-- Iteration 5 --
+string(7) "TRUE123" refcount(3)
+-- Iteration 6 --
+string(9) "123string" refcount(3)
+-- Iteration 7 --
+string(9) "string123" refcount(3)
+-- Iteration 8 --
+string(10) "NULLstring" refcount(3)
+Done
diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
new file mode 100644
index 0000000..e242d45
--- /dev/null
+++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
@@ -0,0 +1,12 @@
+--TEST--
+dl() filename length checks (CVE-2007-4887)
+--INI--
+enable_dl=1
+--FILE--
+<?php
+var_dump(dl(str_repeat("a", 8376757)));
+?>
+--EXPECTF--
+
+Warning: dl(): File name exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt
new file mode 100644
index 0000000..95a6cf4
--- /dev/null
+++ b/ext/standard/tests/general_functions/error_get_last.phpt
@@ -0,0 +1,43 @@
+--TEST--
+error_get_last() tests
+--FILE--
+<?php
+
+var_dump(error_get_last());
+var_dump(error_get_last(true));
+var_dump(error_get_last());
+
+$a = $b;
+
+var_dump(error_get_last());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+
+Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+array(4) {
+ ["type"]=>
+ int(2)
+ ["message"]=>
+ string(54) "error_get_last() expects exactly 0 parameters, 1 given"
+ ["file"]=>
+ string(%i) "%s"
+ ["line"]=>
+ int(4)
+}
+
+Notice: Undefined variable: b in %s on line %d
+array(4) {
+ ["type"]=>
+ int(8)
+ ["message"]=>
+ string(21) "Undefined variable: b"
+ ["file"]=>
+ string(%i) "%s"
+ ["line"]=>
+ int(7)
+}
+Done
diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt
new file mode 100644
index 0000000..8880056
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_basic-win32.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test escapeshellarg() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only for Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for escapeshellarg() function\n";
+
+var_dump(escapeshellarg("Mr O'Neil"));
+var_dump(escapeshellarg("Mr O\'Neil"));
+var_dump(escapeshellarg("%FILENAME"));
+var_dump(escapeshellarg(""));
+
+echo "Done\n";
+?>
+--EXPECT--
+Simple testcase for escapeshellarg() function
+string(11) ""Mr O'Neil""
+string(12) ""Mr O\'Neil""
+string(11) "" FILENAME""
+string(2) """"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/escapeshellarg_basic.phpt b/ext/standard/tests/general_functions/escapeshellarg_basic.phpt
new file mode 100644
index 0000000..c26915c
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test escapeshellarg() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for escapeshellarg() function\n";
+
+var_dump(escapeshellarg("Mr O'Neil"));
+var_dump(escapeshellarg("Mr O\'Neil"));
+var_dump(escapeshellarg("%FILENAME"));
+var_dump(escapeshellarg(""));
+
+echo "Done\n";
+?>
+--EXPECT--
+Simple testcase for escapeshellarg() function
+string(14) "'Mr O'\''Neil'"
+string(15) "'Mr O\'\''Neil'"
+string(11) "'%FILENAME'"
+string(2) "''"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/escapeshellarg_error.phpt b/ext/standard/tests/general_functions/escapeshellarg_error.phpt
new file mode 100644
index 0000000..139a445
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test escapeshellarg() function : error conditions - wrong numbers of parameters
+--FILE--
+<?php
+
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ */
+
+/*
+ * Pass an incorrect number of arguments to escapeshellarg() to test behaviour
+ */
+
+echo "*** Testing escapeshellarg() : error conditions ***\n";
+
+
+echo "\n-- Testing escapeshellarg() function with no arguments --\n";
+var_dump( escapeshellarg() );
+
+echo "\n-- Testing escapeshellarg() function with more than expected no. of arguments --\n";
+$arg = "Mr O'Neil";
+$extra_arg = 10;
+var_dump( escapeshellarg($arg, $extra_arg) );
+
+echo "\n-- Testing escapeshellarg() function with a object supplied for argument --\n";
+
+class classA
+{
+}
+
+$arg = new classA();
+var_dump( escapeshellarg($arg));
+
+echo "\n-- Testing escapeshellarg() function with a resource supplied for argument --\n";
+$fp = fopen(__FILE__, "r");
+var_dump( escapeshellarg($fp));
+fclose($fp);
+
+echo "\n-- Testing escapeshellarg() function with a array supplied for argument --\n";
+$arg = array(1,2,3);
+var_dump( escapeshellarg($arg));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing escapeshellarg() : error conditions ***
+
+-- Testing escapeshellarg() function with no arguments --
+
+Warning: escapeshellarg() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with more than expected no. of arguments --
+
+Warning: escapeshellarg() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with a object supplied for argument --
+
+Warning: escapeshellarg() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with a resource supplied for argument --
+
+Warning: escapeshellarg() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Testing escapeshellarg() function with a array supplied for argument --
+
+Warning: escapeshellarg() expects parameter 1 to be string, array given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
new file mode 100644
index 0000000..8f8bc19
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
@@ -0,0 +1,140 @@
+--TEST--
+Test escapeshellarg() function : usage variations - different data types as $arg arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only for Windows");
+?>
+--FILE--
+<?php
+
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ */
+
+echo "*** Testing escapeshellarg() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // undefined data
+/*19*/ @$undefined_var,
+
+ // unset data
+/*20*/ @$unset_var,
+
+);
+
+// loop through each element of $inputs to check the behaviour of escapeshellarg()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(escapeshellarg($input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECT--
+*** Testing escapeshellarg() : usage variations ***
+
+-- Iteration 1 --
+string(3) ""0""
+
+-- Iteration 2 --
+string(3) ""1""
+
+-- Iteration 3 --
+string(4) ""12""
+
+-- Iteration 4 --
+string(5) ""-12""
+
+-- Iteration 5 --
+string(12) ""2147483647""
+
+-- Iteration 6 --
+string(6) ""10.5""
+
+-- Iteration 7 --
+string(7) ""-10.5""
+
+-- Iteration 8 --
+string(10) ""123.4567""
+
+-- Iteration 9 --
+string(12) ""0.01234567""
+
+-- Iteration 10 --
+string(5) ""0.5""
+
+-- Iteration 11 --
+string(2) """"
+
+-- Iteration 12 --
+string(2) """"
+
+-- Iteration 13 --
+string(3) ""1""
+
+-- Iteration 14 --
+string(2) """"
+
+-- Iteration 15 --
+string(3) ""1""
+
+-- Iteration 16 --
+string(2) """"
+
+-- Iteration 17 --
+string(2) """"
+
+-- Iteration 18 --
+string(2) """"
+
+-- Iteration 19 --
+string(2) """"
+
+-- Iteration 20 --
+string(2) """"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
new file mode 100644
index 0000000..32431a5
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
@@ -0,0 +1,140 @@
+--TEST--
+Test escapeshellarg() function : usage variations - different data types as $y arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+
+/* Prototype : string escapeshellarg ( string $arg )
+ * Description: Escape a string to be used as a shell argument.
+ * Source code: ext/standard/exec.c
+ */
+
+echo "*** Testing escapeshellarg() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+
+ // undefined data
+/*19*/ @$undefined_var,
+
+ // unset data
+/*20*/ @$unset_var,
+
+);
+
+// loop through each element of $inputs to check the behaviour of escapeshellarg()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(escapeshellarg($input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECT--
+*** Testing escapeshellarg() : usage variations ***
+
+-- Iteration 1 --
+string(3) "'0'"
+
+-- Iteration 2 --
+string(3) "'1'"
+
+-- Iteration 3 --
+string(4) "'12'"
+
+-- Iteration 4 --
+string(5) "'-12'"
+
+-- Iteration 5 --
+string(12) "'2147483647'"
+
+-- Iteration 6 --
+string(6) "'10.5'"
+
+-- Iteration 7 --
+string(7) "'-10.5'"
+
+-- Iteration 8 --
+string(10) "'123.4567'"
+
+-- Iteration 9 --
+string(12) "'0.01234567'"
+
+-- Iteration 10 --
+string(5) "'0.5'"
+
+-- Iteration 11 --
+string(2) "''"
+
+-- Iteration 12 --
+string(2) "''"
+
+-- Iteration 13 --
+string(3) "'1'"
+
+-- Iteration 14 --
+string(2) "''"
+
+-- Iteration 15 --
+string(3) "'1'"
+
+-- Iteration 16 --
+string(2) "''"
+
+-- Iteration 17 --
+string(2) "''"
+
+-- Iteration 18 --
+string(2) "''"
+
+-- Iteration 19 --
+string(2) "''"
+
+-- Iteration 20 --
+string(2) "''"
+===Done===
diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
new file mode 100644
index 0000000..9fcb991
--- /dev/null
+++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test escapeshellcmd() functionality on Windows
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip...Valid for Windows only');
+}
+?>
+--FILE--
+<?php
+echo "*** Testing escapeshellcmd() basic operations ***\n";
+$data = array(
+ '"abc',
+ "'abc",
+ '?<>',
+ '()[]{}$',
+ '%^',
+ '#&;`|*?',
+ '~<>\\',
+ '%NOENV%'
+);
+
+$count = 1;
+foreach ($data AS $value) {
+ echo "-- Test " . $count++ . " --\n";
+ var_dump(escapeshellcmd($value));
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing escapeshellcmd() basic operations ***
+-- Test 1 --
+string(5) "^"abc"
+-- Test 2 --
+string(5) "^'abc"
+-- Test 3 --
+string(6) "^?^<^>"
+-- Test 4 --
+string(14) "^(^)^[^]^{^}^$"
+-- Test 5 --
+string(4) "^%^^"
+-- Test 6 --
+string(14) "^#^&^;^`^|^*^?"
+-- Test 7 --
+string(8) "^~^<^>^\"
+-- Test 8 --
+string(9) "^%NOENV^%"
+Done
diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt
new file mode 100644
index 0000000..b427bda
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Testing floatval() and its alias doubleval() Functions
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+echo "*** Testing floatval() with valid float values ***\n";
+// different valid float values
+$valid_floats = array(
+ 0.0,
+ 1.0,
+ -1.0,
+ 1.234,
+ -1.234,
+ 1.2e3,
+ -1.2e3,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-1,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ .5e+7,
+ -.5e+7
+);
+
+/* loop to check that floatval() recognizes different
+ float values, expected output:float value for valid floating point number */
+
+foreach ($valid_floats as $value ) {
+ var_dump( floatval($value) );
+}
+
+
+echo "\n*** Testing doubleval() with valid float values ***\n";
+/* loop to check that doubleval() also recognizes different
+ float values, expected output:float value for valid floating point number */
+
+foreach ($valid_floats as $value ) {
+ var_dump( doubleval($value) );
+}
+
+
+echo "\n*** Testing floatval() on non floating types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// other types in an array
+$not_float_types = array (
+ -2147483648, // max negative integer value
+ 2147483648, // max positive integer value
+ $fp, // resource
+ $dfp,
+ "0.0", // string
+ "1.0",
+ "-1.3e3",
+ "bob-1.3e3",
+ "10 Some dollars",
+ "10.2 Some Dollars",
+ "10.0 dollar" + 1,
+ "10.0 dollar" + 1.0,
+ "",
+ true,
+ NULL,
+ null,
+ );
+/* loop through the $not_float_types to see working of
+ floatval() on non float types, expected output: float value valid floating point numbers */
+foreach ($not_float_types as $type ) {
+ var_dump( floatval($type) );
+}
+
+
+echo "\n*** Testing doubleval() on non floating types ***\n";
+
+/* loop through the $not_float_types to see working of
+ doubleval() on non float types, expected output: float value valid floating point numbers */
+foreach ($not_float_types as $type ) {
+ var_dump( doubleval($type) );
+}
+
+
+
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( floatval() );
+var_dump( doubleval() );
+
+//arguments more than expected
+var_dump( floatval(TRUE, FALSE) );
+var_dump( doubleval(TRUE, FALSE) );
+
+echo "\nDone\n";
+
+
+?>
+--EXPECTF--
+*** Testing floatval() with valid float values ***
+float(0)
+float(1)
+float(-1)
+float(1.234)
+float(-1.234)
+float(1200)
+float(-1200)
+float(10)
+float(1050000)
+float(100000)
+float(-100000)
+float(1.0E-5)
+float(-0.1)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(5000000)
+float(-5000000)
+
+*** Testing doubleval() with valid float values ***
+float(0)
+float(1)
+float(-1)
+float(1.234)
+float(-1.234)
+float(1200)
+float(-1200)
+float(10)
+float(1050000)
+float(100000)
+float(-100000)
+float(1.0E-5)
+float(-0.1)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(100000)
+float(-100000)
+float(5000000)
+float(-5000000)
+
+*** Testing floatval() on non floating types ***
+float(-2147483648)
+float(2147483648)
+float(5)
+float(6)
+float(0)
+float(1)
+float(-1300)
+float(0)
+float(10)
+float(10.2)
+float(11)
+float(11)
+float(0)
+float(1)
+float(0)
+float(0)
+
+*** Testing doubleval() on non floating types ***
+float(-2147483648)
+float(2147483648)
+float(5)
+float(6)
+float(0)
+float(1)
+float(-1300)
+float(0)
+float(10)
+float(10.2)
+float(11)
+float(11)
+float(0)
+float(1)
+float(0)
+float(0)
+
+*** Testing error conditions ***
+
+Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Done
diff --git a/ext/standard/tests/general_functions/floatval_basic.phpt b/ext/standard/tests/general_functions/floatval_basic.phpt
new file mode 100644
index 0000000..129aa87
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval_basic.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Testing floatval() and its alias doubleval() Functions
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+// different valid float values
+$valid_floats = array(
+ "0.0" => 0.0,
+ "1.0" => 1.0,
+ "-1.0" => -1.0,
+ "1.234" => 1.234,
+ "-1.234" => -1.234,
+ "1.2e3" => 1.2e3,
+ "-1.2e3" => -1.2e3,
+ "10.0000000000000000005" => 10.0000000000000000005,
+ "10.5e+5" => 10.5e+5,
+ "1e5" => 1e5,
+ "-1e5" => -1e5,
+ "1e5" => 1e-5,
+ "-1e-1" => -1e-1,
+ "1e+5" => 1e+5,
+ "-1e+5" =>-1e+5,
+ "1E5" => 1E5,
+ "-1E5" => -1E5,
+ "1E+5" => 1E+5,
+ "-1E5" => -1E+5,
+ ".5e+7" => .5e+7,
+ "-.5e+7" =>-.5e+7
+);
+
+/* loop to check that floatval() recognizes different
+ float values, expected output:float value for valid floating point number */
+echo "*** Testing floatval() with valid float values ***\n";
+foreach ($valid_floats as $key => $value ) {
+ echo "\n-- Iteration : $key -- \n";
+ var_dump( floatval($value) );
+}
+
+/* loop to check that doubleval() also recognizes different
+ float values, expected output:float value for valid floating point number */
+echo "\n*** Testing doubleval() with valid float values ***\n";
+foreach ($valid_floats as $key => $value ) {
+ echo "\n-- Iteration : $key -- \n";
+ var_dump( doubleval($value) );
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing floatval() with valid float values ***
+
+-- Iteration : 0.0 --
+float(0)
+
+-- Iteration : 1.0 --
+float(1)
+
+-- Iteration : -1.0 --
+float(-1)
+
+-- Iteration : 1.234 --
+float(1.234)
+
+-- Iteration : -1.234 --
+float(-1.234)
+
+-- Iteration : 1.2e3 --
+float(1200)
+
+-- Iteration : -1.2e3 --
+float(-1200)
+
+-- Iteration : 10.0000000000000000005 --
+float(10)
+
+-- Iteration : 10.5e+5 --
+float(1050000)
+
+-- Iteration : 1e5 --
+float(1.0E-5)
+
+-- Iteration : -1e5 --
+float(-100000)
+
+-- Iteration : -1e-1 --
+float(-0.1)
+
+-- Iteration : 1e+5 --
+float(100000)
+
+-- Iteration : -1e+5 --
+float(-100000)
+
+-- Iteration : 1E5 --
+float(100000)
+
+-- Iteration : -1E5 --
+float(-100000)
+
+-- Iteration : 1E+5 --
+float(100000)
+
+-- Iteration : .5e+7 --
+float(5000000)
+
+-- Iteration : -.5e+7 --
+float(-5000000)
+
+*** Testing doubleval() with valid float values ***
+
+-- Iteration : 0.0 --
+float(0)
+
+-- Iteration : 1.0 --
+float(1)
+
+-- Iteration : -1.0 --
+float(-1)
+
+-- Iteration : 1.234 --
+float(1.234)
+
+-- Iteration : -1.234 --
+float(-1.234)
+
+-- Iteration : 1.2e3 --
+float(1200)
+
+-- Iteration : -1.2e3 --
+float(-1200)
+
+-- Iteration : 10.0000000000000000005 --
+float(10)
+
+-- Iteration : 10.5e+5 --
+float(1050000)
+
+-- Iteration : 1e5 --
+float(1.0E-5)
+
+-- Iteration : -1e5 --
+float(-100000)
+
+-- Iteration : -1e-1 --
+float(-0.1)
+
+-- Iteration : 1e+5 --
+float(100000)
+
+-- Iteration : -1e+5 --
+float(-100000)
+
+-- Iteration : 1E5 --
+float(100000)
+
+-- Iteration : -1E5 --
+float(-100000)
+
+-- Iteration : 1E+5 --
+float(100000)
+
+-- Iteration : .5e+7 --
+float(5000000)
+
+-- Iteration : -.5e+7 --
+float(-5000000)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/floatval_error.phpt b/ext/standard/tests/general_functions/floatval_error.phpt
new file mode 100644
index 0000000..178713a
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Testing floatval() and its alias doubleval() : error conditions - wrong numbers of parametersns
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+echo "*** Testing floatval() and doubleval() : error conditions ***\n";
+
+
+echo "\n-- Testing floatval() and doubleval() function with no arguments --\n";
+var_dump( floatval() );
+var_dump( doubleval() );
+
+echo "\n-- Testing floatval() and doubleval() function with more than expected no. of arguments --\n";
+var_dump( floatval(10.5, FALSE) );
+var_dump( doubleval(10.5, FALSE) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing floatval() and doubleval() : error conditions ***
+
+-- Testing floatval() and doubleval() function with no arguments --
+
+Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing floatval() and doubleval() function with more than expected no. of arguments --
+
+Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt
new file mode 100644
index 0000000..83925b8
--- /dev/null
+++ b/ext/standard/tests/general_functions/floatval_variation1.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Testing floatval() and its alias doubleval() functions : usage variations - different data types as $y arg
+--FILE--
+<?php
+/* Prototype: float floatval( mixed $var );
+ * Description: Returns the float value of var.
+ */
+
+
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// other types in an array
+$not_float_types = array (
+ "-2147483648" => -2147483648, // max negative integer value
+ "2147483647" => 2147483648, // max positive integer value
+ "file resoruce" => $fp,
+ "directory resource" => $dfp,
+ "\"0.0\"" => "0.0", // string
+ "\"1.0\"" => "1.0",
+ "\"-1.3e3\"" => "-1.3e3",
+ "\"bob-1.3e3\"" => "bob-1.3e3",
+ "\"10 Some dollars\"" => "10 Some dollars",
+ "\"10.2 Some Dollars\"" => "10.2 Some Dollars",
+ "\"10.0 dollar\" + 1" => "10.0 dollar" + 1,
+ "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0,
+ "\"\"" => "",
+ "true" => true,
+ "NULL" => NULL,
+ "null" => null,
+ );
+/* loop through the $not_float_types to see working of
+ floatval() on non float types, expected output: float value valid floating point numbers */
+echo "\n*** Testing floatval() on non floating types ***\n";
+foreach ($not_float_types as $key => $type ) {
+ echo "\n-- Iteration : $key --\n";
+ var_dump( floatval($type) );
+}
+
+echo "\n*** Testing doubleval() on non floating types ***\n";
+
+/* loop through the $not_float_types to see working of
+ doubleval() on non float types, expected output: float value valid floating point numbers */
+foreach ($not_float_types as $key => $type ) {
+ echo "\n-- Iteration : $key --\n";
+ var_dump( doubleval($type) );
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing floatval() on non floating types ***
+
+-- Iteration : -2147483648 --
+float(-2147483648)
+
+-- Iteration : 2147483647 --
+float(2147483648)
+
+-- Iteration : file resoruce --
+float(%d)
+
+-- Iteration : directory resource --
+float(%d)
+
+-- Iteration : "0.0" --
+float(0)
+
+-- Iteration : "1.0" --
+float(1)
+
+-- Iteration : "-1.3e3" --
+float(-1300)
+
+-- Iteration : "bob-1.3e3" --
+float(0)
+
+-- Iteration : "10 Some dollars" --
+float(10)
+
+-- Iteration : "10.2 Some Dollars" --
+float(10.2)
+
+-- Iteration : "10.0 dollar" + 1 --
+float(11)
+
+-- Iteration : "10.0 dollar" + 1.0 --
+float(11)
+
+-- Iteration : "" --
+float(0)
+
+-- Iteration : true --
+float(1)
+
+-- Iteration : NULL --
+float(0)
+
+-- Iteration : null --
+float(0)
+
+*** Testing doubleval() on non floating types ***
+
+-- Iteration : -2147483648 --
+float(-2147483648)
+
+-- Iteration : 2147483647 --
+float(2147483648)
+
+-- Iteration : file resoruce --
+float(%d)
+
+-- Iteration : directory resource --
+float(%d)
+
+-- Iteration : "0.0" --
+float(0)
+
+-- Iteration : "1.0" --
+float(1)
+
+-- Iteration : "-1.3e3" --
+float(-1300)
+
+-- Iteration : "bob-1.3e3" --
+float(0)
+
+-- Iteration : "10 Some dollars" --
+float(10)
+
+-- Iteration : "10.2 Some Dollars" --
+float(10.2)
+
+-- Iteration : "10.0 dollar" + 1 --
+float(11)
+
+-- Iteration : "10.0 dollar" + 1.0 --
+float(11)
+
+-- Iteration : "" --
+float(0)
+
+-- Iteration : true --
+float(1)
+
+-- Iteration : NULL --
+float(0)
+
+-- Iteration : null --
+float(0)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_cfg_var_basic.phpt b/ext/standard/tests/general_functions/get_cfg_var_basic.phpt
new file mode 100644
index 0000000..3fb0056
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test function get_cfg_var() by calling it with its expected arguments
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test by calling method or function with its expected arguments ***\n";
+var_dump(get_cfg_var( 'session.use_cookies' ) );
+var_dump(get_cfg_var( 'session.serialize_handler' ) );
+var_dump(get_cfg_var( 'session.save_handler' ) );
+
+?>
+--EXPECTF--
+*** Test by calling method or function with its expected arguments ***
+string(1) "0"
+string(3) "php"
+string(5) "files"
diff --git a/ext/standard/tests/general_functions/get_cfg_var_error.phpt b/ext/standard/tests/general_functions/get_cfg_var_error.phpt
new file mode 100644
index 0000000..1c319bf
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function get_cfg_var() by calling it more than or less than its expected arguments
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+var_dump(get_cfg_var( 'session.use_cookies', 'session.serialize_handler' ) );
+var_dump(get_cfg_var( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: get_cfg_var() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
new file mode 100644
index 0000000..4e59f28
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation1.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with array values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: get_cfg_var() expects parameter 1 to be string, array given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt
new file mode 100644
index 0000000..68495a1
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with boolean values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt
new file mode 100644
index 0000000..d1fb5e7
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with emptyUnsetUndefNull values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation4.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation4.phpt
new file mode 100644
index 0000000..8dac4f8
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation4.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with float values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation5.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation5.phpt
new file mode 100644
index 0000000..392abb3
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation5.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with int values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
new file mode 100644
index 0000000..d142621
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation6.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with object values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "session.use_cookies";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+string(1) "0"
+
+Warning: get_cfg_var() expects parameter 1 to be string, object given in %s.php on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt
new file mode 100644
index 0000000..3b5b08c
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation7.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function get_cfg_var() by substituting argument 1 with string values.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with unknown string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with unknown string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
new file mode 100644
index 0000000..c7a72de
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test function get_cfg_var() by calling deprecated option
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+magic_quotes_gpc=1
+--SKIPIF--
+<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or greater"); ?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with deprecated option ***\n";
+var_dump(get_cfg_var( 'magic_quotes_gpc' ) );
+
+?>
+--EXPECTF--
+Fatal error: Directive 'magic_quotes_gpc' is no longer available in PHP in Unknown on line 0
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt
new file mode 100644
index 0000000..6e0ffc5
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation9.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function get_cfg_var() by substituting argument with array of valid parameters.
+--CREDITS--
+Francesco Fullone ff@ideato.it
+#PHPTestFest Cesena Italia on 2009-06-20
+--INI--
+session.use_cookies=0
+session.serialize_handler=php
+session.save_handler=files
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument with array of valid parameters ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'session.use_cookies',
+ 'session.serialize_handler',
+ 'session.save_handler'
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(get_cfg_var( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument with array of valid parameters ***
+string(1) "0"
+string(3) "php"
+string(5) "files"
diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
new file mode 100644
index 0000000..9e2e66c
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test get_defined_constants() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : basic functionality ***\n";
+
+var_dump(gettype(get_defined_constants(true)));
+var_dump(gettype(get_defined_constants()));
+
+$arr1 = get_defined_constants(false);
+$arr2 = get_defined_constants();
+var_dump(array_diff($arr1, $arr2));
+
+$n1 = count(get_defined_constants());
+define("USER_CONSTANT", "test");
+$arr2 = get_defined_constants();
+$n2 = count($arr2);
+
+if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_defined_constants() : basic functionality ***
+string(5) "array"
+string(5) "array"
+array(0) {
+}
+TEST PASSED
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_defined_constants_error.phpt b/ext/standard/tests/general_functions/get_defined_constants_error.phpt
new file mode 100644
index 0000000..1092712
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_defined_constants_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test get_defined_constants() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_defined_constants ([ bool $categorize ] )
+ * Description: Returns an associative array with the names of all the constants and their values
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_defined_constants() : error conditions ***\n";
+
+echo "\n-- Testing get_defined_constants() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+var_dump( get_defined_constants(true, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_defined_constants() : error conditions ***
+
+-- Testing get_defined_constants() function with more than expected no. of arguments --
+
+Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line 11
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
new file mode 100644
index 0000000..3aa6e72
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
@@ -0,0 +1,152 @@
+--TEST--
+Test get_defined_vars() function
+--FILE--
+<?php
+/* Prototype: array get_defined_vars ( void )
+ Description: This function returns a multidimensional array containing a list of all defined
+ variables, be them environment, server or user-defined variables, within the scope that
+ get_defined_vars() is called.
+*/
+
+echo "Simple testcase for get_defined_vars() function\n\n";
+
+function f1() {
+ echo "\n-- Function f1() called --\n";
+ $vars = get_defined_vars();
+
+ if (count($vars) != 0) {
+ echo "TEST FAILED\n";
+ }
+
+ echo "\n-- ..define some local variables --\n";
+ $i = 123;
+ $f = 123.456;
+ $b = false;
+ $s = "Hello World";
+ $arr = array(1,2,3,4);
+ var_dump( get_defined_vars() );
+ f2();
+}
+
+function f2() {
+ echo "\n -- Function f2() called --\n";
+ $vars= get_defined_vars();
+
+ if (count($vars) != 0) {
+ echo "TEST FAILED\n";
+ }
+
+ echo "\n-- ...define some variables --\n";
+ $i = 456;
+ $f = 456.678;
+ $b = true;
+ $s = "Goodnight";
+ $arr = array("foo", "bar");
+ var_dump( get_defined_vars() );
+
+ echo "\n-- ...define some more variables --\n";
+ $i1 = 456;
+ $f1 = 456.678;
+ $b1 = true;
+ var_dump( get_defined_vars() );
+
+}
+
+echo "\n-- Get variables at global scope --\n";
+$vars = get_defined_vars();
+
+if (count($vars) == 0) {
+ echo "TEST FAILED - Global variables missing at global scope\n";
+}
+
+// call a function
+f1();
+
+?>
+===DONE===
+--EXPECT--
+Simple testcase for get_defined_vars() function
+
+
+-- Get variables at global scope --
+
+-- Function f1() called --
+
+-- ..define some local variables --
+array(6) {
+ ["vars"]=>
+ array(0) {
+ }
+ ["i"]=>
+ int(123)
+ ["f"]=>
+ float(123.456)
+ ["b"]=>
+ bool(false)
+ ["s"]=>
+ string(11) "Hello World"
+ ["arr"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+}
+
+ -- Function f2() called --
+
+-- ...define some variables --
+array(6) {
+ ["vars"]=>
+ array(0) {
+ }
+ ["i"]=>
+ int(456)
+ ["f"]=>
+ float(456.678)
+ ["b"]=>
+ bool(true)
+ ["s"]=>
+ string(9) "Goodnight"
+ ["arr"]=>
+ array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ }
+}
+
+-- ...define some more variables --
+array(9) {
+ ["vars"]=>
+ array(0) {
+ }
+ ["i"]=>
+ int(456)
+ ["f"]=>
+ float(456.678)
+ ["b"]=>
+ bool(true)
+ ["s"]=>
+ string(9) "Goodnight"
+ ["arr"]=>
+ array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ }
+ ["i1"]=>
+ int(456)
+ ["f1"]=>
+ float(456.678)
+ ["b1"]=>
+ bool(true)
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
new file mode 100644
index 0000000..d87eb4c
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test get_extension_funcs() function: basic test
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for get_extension_funcs() function\n";
+
+$result = get_extension_funcs("standard");
+var_dump(gettype($result));
+var_dump(in_array("cos", $result));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_extension_funcs() function
+string(5) "array"
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
new file mode 100644
index 0000000..33e32a6
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test get_extension_funcs() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_extension_funcs() : error conditions ***\n";
+
+echo "\n-- Too few arguments --\n";
+var_dump(get_extension_funcs());
+
+$extra_arg = 1;
+echo "\n-- Too many arguments --\n";
+var_dump(get_extension_funcs("standard", $extra_arg));
+
+echo "\n-- Invalid extension name --\n";
+var_dump(get_extension_funcs("foo"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_extension_funcs() : error conditions ***
+
+-- Too few arguments --
+
+Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Too many arguments --
+
+Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Invalid extension name --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt b/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt
new file mode 100644
index 0000000..c575737
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_extension_funcs_variation.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test get_extension_funcs() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_extension_funcs ( string $module_name )
+ * Description: Returns an array with the names of the functions of a module.
+ * Source code: Zend/zend_builtin_functions.c
+ * Alias to functions:
+ */
+
+echo "*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "sample object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $str
+$inputs = array (
+
+ // integer values
+ 0,
+ 1,
+ 255,
+ 256,
+ PHP_INT_MAX,
+ -PHP_INT_MAX,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.1234567e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null values
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $inputs array to test get_extension_funcs() function
+$count = 1;
+foreach($inputs as $input) {
+ echo "-- Iteration $count --\n";
+ var_dump( get_extension_funcs($input) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_extension_funcs() function: with unexpected inputs for 'module_name' argument ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+
+Warning: get_extension_funcs() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt
new file mode 100644
index 0000000..999862b
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test get_include_path() function
+--INI--
+include_path=.
+--FILE--
+<?php
+/* Prototype: string get_include_path ( void )
+ * Description: Gets the current include_path configuration option
+
+*/
+
+echo "*** Testing get_include_path()\n";
+
+var_dump(get_include_path());
+
+if (ini_get("include_path") == get_include_path()) {
+ echo "PASSED\n";
+} else {
+ echo "FAILED\n";
+}
+
+echo "\nError cases:\n";
+var_dump(get_include_path(TRUE));
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_include_path()
+string(1) "."
+PASSED
+
+Error cases:
+
+Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt
new file mode 100644
index 0000000..e7e1ed5
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test get_include_files() function
+--INI--
+include_path=.
+--FILE--
+<?php
+/* Prototype: array get_included_files ( void )
+ * Description: Returns an array with the names of included or required files
+
+*/
+
+echo "*** Testing get_included_files()\n";
+
+echo "\n-- List included files at start --\n";
+var_dump(get_included_files());
+
+include(dirname(__FILE__)."/get_included_files_inc1.inc");
+echo "\n-- List included files atfter including inc1 -\n";
+var_dump(get_included_files());
+
+include(dirname(__FILE__)."/get_included_files_inc2.inc");
+echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n";
+var_dump(get_included_files());
+
+echo "\n-- Error cases --\n";
+var_dump(get_included_files(true));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_included_files()
+
+-- List included files at start --
+array(1) {
+ [0]=>
+ string(%d) "%sget_included_files.php"
+}
+
+-- List included files atfter including inc1 -
+array(2) {
+ [0]=>
+ string(%d) "%sget_included_files.php"
+ [1]=>
+ string(%d) "%sget_included_files_inc1.inc"
+}
+
+-- List included files atfter including inc2 which will include inc3 which includes inc1 --
+array(4) {
+ [0]=>
+ string(%d) "%sget_included_files.php"
+ [1]=>
+ string(%d) "%sget_included_files_inc1.inc"
+ [2]=>
+ string(%d) "%sget_included_files_inc2.inc"
+ [3]=>
+ string(%d) "%sget_included_files_inc3.inc"
+}
+
+-- Error cases --
+
+Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_included_files_inc1.inc b/ext/standard/tests/general_functions/get_included_files_inc1.inc
new file mode 100644
index 0000000..344e300
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files_inc1.inc
@@ -0,0 +1,3 @@
+<?php
+/* dummy include*/
+?>
diff --git a/ext/standard/tests/general_functions/get_included_files_inc2.inc b/ext/standard/tests/general_functions/get_included_files_inc2.inc
new file mode 100644
index 0000000..318eba0
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files_inc2.inc
@@ -0,0 +1,4 @@
+<?php
+/* dummy include*/
+include(dirname(__FILE__)."/get_included_files_inc3.inc");
+?>
diff --git a/ext/standard/tests/general_functions/get_included_files_inc3.inc b/ext/standard/tests/general_functions/get_included_files_inc3.inc
new file mode 100644
index 0000000..f666edf
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_included_files_inc3.inc
@@ -0,0 +1,4 @@
+<?php
+/* dummy include*/
+include(dirname(__FILE__)."/get_included_files_inc1.inc");
+?>
diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
new file mode 100644
index 0000000..4a8eceb
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test get_loaded_extensions() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : basic functionality ***\n";
+
+echo "Get loaded extensions\n";
+var_dump(get_loaded_extensions());
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_loaded_extensions() : basic functionality ***
+Get loaded extensions
+array(%d) {
+%a
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt
new file mode 100644
index 0000000..d731046
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_loaded_extensions_error.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test get_loaded_extensions() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_loaded_extensions ([ bool $zend_extensions= false ] )
+ * Description: Returns an array with the names of all modules compiled and loaded
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_loaded_extensions() : error conditions ***\n";
+
+echo "\n-- Testing get_loaded_extensions() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( get_resource_type(true, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_loaded_extensions() : error conditions ***
+
+-- Testing get_loaded_extensions() function with more than expected no. of arguments --
+
+Warning: get_resource_type() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt b/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
new file mode 100644
index 0000000..75cde18
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_magic_quotes_gpc.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test get_magic_quotes_gpc() function
+--FILE--
+<?php
+/* Prototype: int get_magic_quotes_gpc ( void )
+ * This function is not supported anymore and will always return false
+ */
+
+echo "Simple testcase for get_magic_quotes_gpc() function\n";
+var_dump(get_magic_quotes_gpc());
+
+echo "\n-- Error cases --\n";
+// no checks on number of args
+var_dump(get_magic_quotes_gpc(true));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_magic_quotes_gpc() function
+bool(false)
+
+-- Error cases --
+
+Warning: get_magic_quotes_gpc() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt b/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
new file mode 100644
index 0000000..4106ee9
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_magic_quotes_runtime.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test get_magic_quotes_runtime() function
+--FILE--
+<?php
+/* Prototype: int get_magic_quotes_runtime ( void )
+ * This function is not supported anymore and will always return false
+ */
+
+echo "Simple testcase for get_magic_quotes_runtime() function\n";
+
+var_dump(get_magic_quotes_runtime());
+
+echo "\n-- Error cases --\n";
+// no checks on number of args
+var_dump(get_magic_quotes_runtime(true));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for get_magic_quotes_runtime() function
+bool(false)
+
+-- Error cases --
+
+Warning: get_magic_quotes_runtime() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_resource_type_basic.phpt b/ext/standard/tests/general_functions/get_resource_type_basic.phpt
new file mode 100644
index 0000000..7ff4aec
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_resource_type_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test get_resource_type() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : basic functionality ***\n";
+
+$res = fopen(__FILE__, "r");
+var_dump(get_resource_type($res));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing get_resource_type() : basic functionality ***
+string(6) "stream"
+===DONE===
diff --git a/ext/standard/tests/general_functions/get_resource_type_error.phpt b/ext/standard/tests/general_functions/get_resource_type_error.phpt
new file mode 100644
index 0000000..40dcf07
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_resource_type_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test get_resource_type() function : error conditions
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : error conditions ***\n";
+
+echo "\n-- Testing get_resource_type() function with Zero arguments --\n";
+var_dump( get_resource_type() );
+
+echo "\n-- Testing get_resource_type() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( get_resource_type($res, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_resource_type() : error conditions ***
+
+-- Testing get_resource_type() function with Zero arguments --
+
+Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing get_resource_type() function with more than expected no. of arguments --
+
+Warning: get_resource_type() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/get_resource_type_variation1.phpt b/ext/standard/tests/general_functions/get_resource_type_variation1.phpt
new file mode 100644
index 0000000..2c203af
--- /dev/null
+++ b/ext/standard/tests/general_functions/get_resource_type_variation1.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test get_resource_type() function : usage variations - different data types as handle arg
+--FILE--
+<?php
+/* Prototype : string get_resource_type ( resource $handle )
+ * Description: Returns the resource type
+ * Source code: Zend/zend_builtin_functions.c
+ */
+
+echo "*** Testing get_resource_type() : variation test ***\n";
+
+class Hello {
+ public function SayHello($arg) {
+ echo "Hello\n";
+ }
+}
+
+$res = fopen(__FILE__, "r");
+
+$vars = array(
+ "bool"=>true,
+ "int 10"=>10,
+ "float 10.5"=>10.5,
+ "string"=>"Hello World",
+ "array"=>array(1,2,3,4,5),
+ "NULL"=>NULL,
+ "Object"=>new Hello()
+);
+
+foreach($vars as $variation =>$object) {
+ echo "\n-- $variation --\n";
+ var_dump(get_resource_type($object));
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing get_resource_type() : variation test ***
+
+-- bool --
+
+Warning: get_resource_type() expects parameter 1 to be resource, boolean given in %s on line %d
+NULL
+
+-- int 10 --
+
+Warning: get_resource_type() expects parameter 1 to be resource, integer given in %s on line %d
+NULL
+
+-- float 10.5 --
+
+Warning: get_resource_type() expects parameter 1 to be resource, double given in %s on line %d
+NULL
+
+-- string --
+
+Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
+NULL
+
+-- array --
+
+Warning: get_resource_type() expects parameter 1 to be resource, array given in %s on line %d
+NULL
+
+-- NULL --
+
+Warning: get_resource_type() expects parameter 1 to be resource, null given in %s on line %d
+NULL
+
+-- Object --
+
+Warning: get_resource_type() expects parameter 1 to be resource, object given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/getmypid_basic.phpt b/ext/standard/tests/general_functions/getmypid_basic.phpt
new file mode 100644
index 0000000..869eb59
--- /dev/null
+++ b/ext/standard/tests/general_functions/getmypid_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test getmypid() function: basic test
+--FILE--
+<?php
+/* Prototype : int getmypid ( void )
+ * Description: Gets the current PHP process ID.
+ * Source code: ext/standard/pageinfo.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for getmypid() function\n";
+
+var_dump(getmypid());
+
+echo "Done\n";
+?>
+--EXPECTF--
+Simple testcase for getmypid() function
+int(%d)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/getopt.phpt b/ext/standard/tests/general_functions/getopt.phpt
new file mode 100644
index 0000000..67864e9
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt.phpt
@@ -0,0 +1,24 @@
+--TEST--
+getopt
+--ARGS--
+-v -h -d test -m 1234 -t -j
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("d:m:j:vht"));
+?>
+--EXPECT--
+array(5) {
+ ["v"]=>
+ bool(false)
+ ["h"]=>
+ bool(false)
+ ["d"]=>
+ string(4) "test"
+ ["m"]=>
+ string(4) "1234"
+ ["t"]=>
+ bool(false)
+}
diff --git a/ext/standard/tests/general_functions/getopt_002.phpt b/ext/standard/tests/general_functions/getopt_002.phpt
new file mode 100644
index 0000000..3912ec8
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+getopt#002
+--ARGS--
+-vvv -a value -1111 -2 -v
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("2a:vcd1"));
+?>
+--EXPECT--
+array(4) {
+ ["v"]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ }
+ ["a"]=>
+ string(5) "value"
+ [1]=>
+ array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ }
+ [2]=>
+ bool(false)
+}
+
+
diff --git a/ext/standard/tests/general_functions/getopt_003.phpt b/ext/standard/tests/general_functions/getopt_003.phpt
new file mode 100644
index 0000000..fbb39b0
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_003.phpt
@@ -0,0 +1,57 @@
+--TEST--
+getopt#003
+--ARGS--
+-vvv --v -a value --another value -1111 -2 --12 --0 --0 --1 -v
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v")));
+?>
+--EXPECT--
+array(7) {
+ ["v"]=>
+ array(5) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(false)
+ }
+ ["a"]=>
+ string(5) "value"
+ ["another"]=>
+ string(5) "value"
+ [1]=>
+ array(5) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(false)
+ }
+ [2]=>
+ bool(false)
+ [12]=>
+ bool(false)
+ [0]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+
+
diff --git a/ext/standard/tests/general_functions/getopt_004.phpt b/ext/standard/tests/general_functions/getopt_004.phpt
new file mode 100644
index 0000000..193bd40
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_004.phpt
@@ -0,0 +1,29 @@
+--TEST--
+getopt#004 (Optional values)
+--ARGS--
+-v -v1 -v=10 --v --v=100
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("v::", array("v::")));
+?>
+--EXPECT--
+array(1) {
+ ["v"]=>
+ array(5) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(2) "10"
+ [3]=>
+ bool(false)
+ [4]=>
+ string(3) "100"
+ }
+}
+
+
diff --git a/ext/standard/tests/general_functions/getopt_005.phpt b/ext/standard/tests/general_functions/getopt_005.phpt
new file mode 100644
index 0000000..fe43a02
--- /dev/null
+++ b/ext/standard/tests/general_functions/getopt_005.phpt
@@ -0,0 +1,32 @@
+--TEST--
+getopt#005 (Required values)
+--ARGS--
+--arg value --arg=value -avalue -a=value -a value
+--INI--
+register_argc_argv=On
+variables_order=GPS
+--FILE--
+<?php
+ var_dump(getopt("a:", array("arg:")));
+?>
+--EXPECT--
+array(2) {
+ ["arg"]=>
+ array(2) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ }
+ ["a"]=>
+ array(3) {
+ [0]=>
+ string(5) "value"
+ [1]=>
+ string(5) "value"
+ [2]=>
+ string(5) "value"
+ }
+}
+
+
diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt
new file mode 100644
index 0000000..55abbac
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage.phpt
@@ -0,0 +1,23 @@
+--TEST--
+getrusage() tests
+--SKIPIF--
+<?php if (!function_exists("getrusage")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(gettype(getrusage()));
+var_dump(gettype(getrusage(1)));
+var_dump(gettype(getrusage(-1)));
+var_dump(getrusage(array()));
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+string(5) "array"
+string(5) "array"
+
+Warning: getrusage() expects parameter 1 to be long, array given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/getrusage_basic.phpt b/ext/standard/tests/general_functions/getrusage_basic.phpt
new file mode 100644
index 0000000..c9b3459
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test getrusage() function: basic test
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+echo "Simple testcase for getrusage() function\n";
+
+$dat = getrusage();
+
+if (!is_array($dat)) {
+ echo "TEST FAILED : getrusage shoudl return an array\n";
+}
+
+// echo the fields which are common to all platforms
+echo "User time used (seconds) " . $dat["ru_utime.tv_sec"] . "\n";
+echo "User time used (microseconds) " . $dat["ru_utime.tv_usec"] . "\n";
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for getrusage() function
+User time used (seconds) %d
+User time used (microseconds) %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/getrusage_error.phpt b/ext/standard/tests/general_functions/getrusage_error.phpt
new file mode 100644
index 0000000..b13d4f0
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage_error.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test getrusage() function : error conditions - incorrect number of args
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+/*
+ * Pass an incorrect number of arguments to getrusage() to test behaviour
+ */
+
+echo "*** Testing getrusage() : error conditions ***\n";
+
+echo "\n-- Testing getrusage() function with more than expected no. of arguments --\n";
+$extra_arg = 10;
+$dat = getrusage(1, $extra_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - non-numeric STRING--\n";
+$string_arg = "foo";
+$dat = getrusage($string_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - ARRAY--\n";
+$array_arg = array(1,2,3);
+$dat = getrusage($array_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - OBJECT --\n";
+class classA
+{
+ function __toString() {
+ return "ClassAObject";
+ }
+}
+$obj_arg = new classA();
+$dat = getrusage($obj_arg);
+
+echo "\n-- Testing getrusage() function with invalid argument - RESOURCE --\n";
+$file_handle=fopen(__FILE__, "r");
+$dat = getrusage($file_handle);
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing getrusage() : error conditions ***
+
+-- Testing getrusage() function with more than expected no. of arguments --
+
+Warning: getrusage() expects at most 1 parameter, 2 given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - non-numeric STRING--
+
+Warning: getrusage() expects parameter 1 to be long, string given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - ARRAY--
+
+Warning: getrusage() expects parameter 1 to be long, array given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - OBJECT --
+
+Warning: getrusage() expects parameter 1 to be long, object given in %s on line %d
+
+-- Testing getrusage() function with invalid argument - RESOURCE --
+
+Warning: getrusage() expects parameter 1 to be long, resource given in %s on line %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/getrusage_variation1.phpt b/ext/standard/tests/general_functions/getrusage_variation1.phpt
new file mode 100644
index 0000000..3daf9e5
--- /dev/null
+++ b/ext/standard/tests/general_functions/getrusage_variation1.phpt
@@ -0,0 +1,142 @@
+--TEST--
+Test getrusage() function : usage variation - diff data types as $who arg
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN" )
+ die("skip.. Do not run on Windows");
+?>
+--FILE--
+<?php
+/* Prototype : array getrusage ([ int $who ] )
+ * Description: Gets the current resource usages
+ * Source code: ext/standard/microtime.c
+ * Alias to functions:
+ */
+
+
+/*
+ * Pass different data types as $who argument to test behaviour of getrusage()
+ */
+
+echo "*** Testing getrusage() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// unexpected values to be passed to $stream_id argument
+$inputs = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string data
+/*16*/ "0",
+ '1',
+ "1232456",
+ "1.23E4",
+
+ // undefined data
+/*20*/ @$undefined_var,
+
+ // unset data
+/*21*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behavior of getrusage()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $res = getrusage($input);
+ echo "User time used (microseconds) " . $res["ru_utime.tv_usec"] . "\n";
+ $iterator++;
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing getrusage() : usage variations ***
+
+-- Iteration 1 --
+User time used (microseconds) %d
+
+-- Iteration 2 --
+User time used (microseconds) %d
+
+-- Iteration 3 --
+User time used (microseconds) %d
+
+-- Iteration 4 --
+User time used (microseconds) %d
+
+-- Iteration 5 --
+User time used (microseconds) %d
+
+-- Iteration 6 --
+User time used (microseconds) %d
+
+-- Iteration 7 --
+User time used (microseconds) %d
+
+-- Iteration 8 --
+User time used (microseconds) %d
+
+-- Iteration 9 --
+User time used (microseconds) %d
+
+-- Iteration 10 --
+User time used (microseconds) %d
+
+-- Iteration 11 --
+User time used (microseconds) %d
+
+-- Iteration 12 --
+User time used (microseconds) %d
+
+-- Iteration 13 --
+User time used (microseconds) %d
+
+-- Iteration 14 --
+User time used (microseconds) %d
+
+-- Iteration 15 --
+User time used (microseconds) %d
+
+-- Iteration 16 --
+User time used (microseconds) %d
+
+-- Iteration 17 --
+User time used (microseconds) %d
+
+-- Iteration 18 --
+User time used (microseconds) %d
+
+-- Iteration 19 --
+User time used (microseconds) %d
+
+-- Iteration 20 --
+User time used (microseconds) %d
+
+-- Iteration 21 --
+User time used (microseconds) %d
+===DONE===
diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt
new file mode 100644
index 0000000..adaa7af
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function getservbyname()
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+
+ $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
+
+ foreach ($services as $service) {
+ $port = getservbyname($service, 'tcp');
+ var_dump($port);
+ }
+
+
+?>
+--EXPECTF--
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
+int(%d)
diff --git a/ext/standard/tests/general_functions/getservbyname_error.phpt b/ext/standard/tests/general_functions/getservbyname_error.phpt
new file mode 100644
index 0000000..eaeec64
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test function getservbyname() by calling it more than or less than its expected arguments
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Danilo Sanchi (sanchi@grupporetina.com)
+--FILE--
+<?php
+$service = "www";
+$protocol = "tcp";
+$extra_arg = 12;
+var_dump(getservbyname($service, $protocol, $extra_arg ) );
+var_dump(getservbyname($service));
+?>
+--EXPECTF--
+Warning: getservbyname() expects exactly 2 parameters, %d given in %s on line %d
+NULL
+
+Warning: getservbyname() expects exactly 2 parameters, %d given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation1.phpt b/ext/standard/tests/general_functions/getservbyname_variation1.phpt
new file mode 100644
index 0000000..7dd01aa
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+$protocol = "tcp";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 1 to be string, array given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation10.phpt b/ext/standard/tests/general_functions/getservbyname_variation10.phpt
new file mode 100644
index 0000000..c7ed144
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation10.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+if(PHP_OS == 'Darwin') {
+ die("skip.. Mac OS X is fine with NULLs in getservbyname");
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with emptyUnsetUndefNull values ***\n";
+
+$service = "www";
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation11.phpt b/ext/standard/tests/general_functions/getservbyname_variation11.phpt
new file mode 100644
index 0000000..3c410c5
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation11.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with float values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with float values ***\n";
+
+$service = "www";
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation12.phpt b/ext/standard/tests/general_functions/getservbyname_variation12.phpt
new file mode 100644
index 0000000..7e5323c
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation12.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with int values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with int values ***\n";
+
+$service = "www";
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with int values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation13.phpt b/ext/standard/tests/general_functions/getservbyname_variation13.phpt
new file mode 100644
index 0000000..8dad8cd
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation13.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with object values ***\n";
+
+$service = "www";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 2 to be string, object given in %s.php on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation14.phpt b/ext/standard/tests/general_functions/getservbyname_variation14.phpt
new file mode 100644
index 0000000..d93b53e
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation14.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with string values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with string values ***\n";
+
+$service = "www";
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation2.phpt b/ext/standard/tests/general_functions/getservbyname_variation2.phpt
new file mode 100644
index 0000000..877c1d1
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation2.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with boolean values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+$protocol = "tcp";
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation3.phpt b/ext/standard/tests/general_functions/getservbyname_variation3.phpt
new file mode 100644
index 0000000..d34259d
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation3.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with emptyUnsetUndefNull values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+$protocol = "tcp";
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation4.phpt b/ext/standard/tests/general_functions/getservbyname_variation4.phpt
new file mode 100644
index 0000000..6033c94
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation4.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with float values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with float values ***\n";
+
+$protocol = "tcp";
+
+
+$variation_array = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with float values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation5.phpt b/ext/standard/tests/general_functions/getservbyname_variation5.phpt
new file mode 100644
index 0000000..1d3b8f6
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation5.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with int values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+$protocol = "tcp";
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation6.phpt b/ext/standard/tests/general_functions/getservbyname_variation6.phpt
new file mode 100644
index 0000000..0dfafa6
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation6.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with object values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+$protocol = "tcp";
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+bool(false)
+
+Warning: getservbyname() expects parameter 1 to be string, object given in %s.php on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation7.phpt b/ext/standard/tests/general_functions/getservbyname_variation7.phpt
new file mode 100644
index 0000000..a0e223c
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation7.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function getservbyname() by substituting argument 1 with string values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+$protocol = "tcp";
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $var , $protocol ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyname_variation8.phpt b/ext/standard/tests/general_functions/getservbyname_variation8.phpt
new file mode 100644
index 0000000..69d1d77
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation8.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with array values.
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with array values ***\n";
+
+$service = "www";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with array values ***
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: getservbyname() expects parameter 2 to be string, array given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyname_variation9.phpt b/ext/standard/tests/general_functions/getservbyname_variation9.phpt
new file mode 100644
index 0000000..eef2744
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyname_variation9.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function getservbyname() by substituting argument 2 with boolean values.
+--SKIPIF--
+<?php
+if(PHP_OS == 'Darwin') {
+ die("skip.. Mac OS X is fine with NULLs in getservbyname");
+}
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 2 with boolean values ***\n";
+
+$service = "www";
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(getservbyname( $service, $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 2 with boolean values ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/general_functions/getservbyport_basic.phpt b/ext/standard/tests/general_functions/getservbyport_basic.phpt
new file mode 100644
index 0000000..b9e0f83
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyport_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+ if (file_exists("/etc/services")) {
+ $file = "/etc/services";
+ }
+ elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services";
+ else die(PHP_OS. " unsupported");
+
+ if(file_exists($file)){
+ $services = file_get_contents($file);
+ $service = getservbyport( 80, "tcp" );
+ if(preg_match("/$service\s+80\/tcp/", $services)) {
+ echo "PASS\n";
+ }
+ }else{
+ echo "Services file not found in expected location\n";
+ }
+?>
+--EXPECT--
+PASS
diff --git a/ext/standard/tests/general_functions/getservbyport_error.phpt b/ext/standard/tests/general_functions/getservbyport_error.phpt
new file mode 100644
index 0000000..e2c245b
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyport_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+$port = 80;
+$protocol = "tcp";
+$extra_arg = 12;
+var_dump(getservbyport( $port, $protocol, $extra_arg ) );
+var_dump(getservbyport($port));
+?>
+--EXPECTF--
+Warning: getservbyport() expects exactly 2 parameters, %d given in %s on line %d
+NULL
+
+Warning: getservbyport() expects exactly 2 parameters, %d given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
new file mode 100644
index 0000000..3dd2d9a
--- /dev/null
+++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function getservbyport() by calling it more than or less than its expected arguments
+--DESCRIPTION--
+Test function passing invalid port number and invalid protocol name
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--FILE--
+<?php
+ var_dump(getservbyport( -1, "tcp" ));
+ var_dump(getservbyport( 80, "ppp" ));
+ var_dump(getservbyport( null, null));
+ var_dump(getservbyport( array(), array()));
+ var_dump(getservbyport( array(80), array("tcp")));
+ var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2)));
+ var_dump(getservbyport( 2, 2));
+ var_dump(getservbyport( "80", "tcp"));
+ var_dump(getservbyport( new stdClass(), new stdClass()));
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+Warning: getservbyport() expects parameter 1 to be long, array given in %s on line %d
+NULL
+bool(false)
+string(%d) "%s"
+
+Warning: getservbyport() expects parameter 1 to be long, object given in %s on line %d
+NULL
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
new file mode 100644
index 0000000..d6fb0d4
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -0,0 +1,906 @@
+--TEST--
+Test gettype() & settype() functions : basic functionalities
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test the basic functionalities of settype() & gettype() functions.
+ Use the gettype() to get the type of regular data and use settype()
+ to change its type to other types */
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+echo "**** Testing gettype() and settype() functions ****\n";
+
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "Object";
+ }
+}
+
+$unset_var = 10;
+unset($unset_var);
+
+$values = array(
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ -20,
+ 2.54,
+ -2.54,
+ NULL,
+ false,
+ "some string",
+ 'string',
+ $fp,
+ $dfp,
+ new point(10,20)
+);
+
+$types = array(
+ "null",
+ "integer",
+ "int",
+ "float",
+ "double",
+ "boolean",
+ "bool",
+ "resource",
+ "array",
+ "object",
+ "string"
+);
+
+echo "\n*** Testing gettype(): basic operations ***\n";
+foreach ($values as $value) {
+ var_dump( gettype($value) );
+}
+
+echo "\n*** Testing settype(): basic operations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $loop_count = 1;
+ foreach ($values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count ++;
+ // set to new type
+ var_dump( settype($var, $type) );
+
+ // dump the var
+ var_dump( $var );
+
+ // check the new type
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+**** Testing gettype() and settype() functions ****
+
+*** Testing gettype(): basic operations ***
+string(5) "array"
+string(6) "string"
+string(5) "array"
+string(7) "integer"
+string(7) "integer"
+string(6) "double"
+string(6) "double"
+string(4) "NULL"
+string(7) "boolean"
+string(6) "string"
+string(6) "string"
+string(8) "resource"
+string(8) "resource"
+string(6) "object"
+
+*** Testing settype(): basic operations ***
+
+-- Setting type of data to null --
+-- Iteration 1 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 3 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 4 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 5 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 6 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 7 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 8 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 10 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 11 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 12 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 13 --
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 14 --
+bool(true)
+NULL
+string(4) "NULL"
+
+-- Setting type of data to integer --
+-- Iteration 1 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 2 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+bool(true)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+bool(true)
+int(2)
+string(7) "integer"
+-- Iteration 7 --
+bool(true)
+int(-2)
+string(7) "integer"
+-- Iteration 8 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+bool(true)
+int(5)
+string(7) "integer"
+-- Iteration 13 --
+bool(true)
+int(6)
+string(7) "integer"
+-- Iteration 14 --
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+
+-- Setting type of data to int --
+-- Iteration 1 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 2 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+bool(true)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+bool(true)
+int(2)
+string(7) "integer"
+-- Iteration 7 --
+bool(true)
+int(-2)
+string(7) "integer"
+-- Iteration 8 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+bool(true)
+int(5)
+string(7) "integer"
+-- Iteration 13 --
+bool(true)
+int(6)
+string(7) "integer"
+-- Iteration 14 --
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+
+-- Setting type of data to float --
+-- Iteration 1 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 2 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+bool(true)
+float(-20)
+string(6) "double"
+-- Iteration 6 --
+bool(true)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+bool(true)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+bool(true)
+float(5)
+string(6) "double"
+-- Iteration 13 --
+bool(true)
+float(6)
+string(6) "double"
+-- Iteration 14 --
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+
+-- Setting type of data to double --
+-- Iteration 1 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 2 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+bool(true)
+float(-20)
+string(6) "double"
+-- Iteration 6 --
+bool(true)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+bool(true)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+bool(true)
+float(5)
+string(6) "double"
+-- Iteration 13 --
+bool(true)
+float(6)
+string(6) "double"
+-- Iteration 14 --
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+
+-- Setting type of data to boolean --
+-- Iteration 1 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 2 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 3 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 13 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 14 --
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to bool --
+-- Iteration 1 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 2 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 3 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 13 --
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 14 --
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to resource --
+-- Iteration 1 --
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(5) "array"
+-- Iteration 2 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(14) "another string"
+string(6) "string"
+-- Iteration 3 --
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 4 --
+2: settype(): Cannot convert to resource type
+bool(false)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-20)
+string(7) "integer"
+-- Iteration 6 --
+2: settype(): Cannot convert to resource type
+bool(false)
+float(2.54)
+string(6) "double"
+-- Iteration 7 --
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-2.54)
+string(6) "double"
+-- Iteration 8 --
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(11) "some string"
+string(6) "string"
+-- Iteration 11 --
+2: settype(): Cannot convert to resource type
+bool(false)
+string(6) "string"
+string(6) "string"
+-- Iteration 12 --
+2: settype(): Cannot convert to resource type
+bool(false)
+resource(5) of type (stream)
+string(8) "resource"
+-- Iteration 13 --
+2: settype(): Cannot convert to resource type
+bool(false)
+resource(6) of type (stream)
+string(8) "resource"
+-- Iteration 14 --
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#1 (2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(6) "object"
+
+-- Setting type of data to array --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(5) "array"
+-- Iteration 2 --
+bool(true)
+array(1) {
+ [0]=>
+ string(14) "another string"
+}
+string(5) "array"
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 4 --
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+string(5) "array"
+-- Iteration 5 --
+bool(true)
+array(1) {
+ [0]=>
+ int(-20)
+}
+string(5) "array"
+-- Iteration 6 --
+bool(true)
+array(1) {
+ [0]=>
+ float(2.54)
+}
+string(5) "array"
+-- Iteration 7 --
+bool(true)
+array(1) {
+ [0]=>
+ float(-2.54)
+}
+string(5) "array"
+-- Iteration 8 --
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 9 --
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+string(5) "array"
+-- Iteration 10 --
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "some string"
+}
+string(5) "array"
+-- Iteration 11 --
+bool(true)
+array(1) {
+ [0]=>
+ string(6) "string"
+}
+string(5) "array"
+-- Iteration 12 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(5) of type (stream)
+}
+string(5) "array"
+-- Iteration 13 --
+bool(true)
+array(1) {
+ [0]=>
+ resource(6) of type (stream)
+}
+string(5) "array"
+-- Iteration 14 --
+bool(true)
+array(2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(5) "array"
+
+-- Setting type of data to object --
+-- Iteration 1 --
+bool(true)
+object(stdClass)#2 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(6) "object"
+-- Iteration 2 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(14) "another string"
+}
+string(6) "object"
+-- Iteration 3 --
+bool(true)
+object(stdClass)#2 (3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 4 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ int(1)
+}
+string(6) "object"
+-- Iteration 5 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ int(-20)
+}
+string(6) "object"
+-- Iteration 6 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ float(2.54)
+}
+string(6) "object"
+-- Iteration 7 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ float(-2.54)
+}
+string(6) "object"
+-- Iteration 8 --
+bool(true)
+object(stdClass)#2 (0) {
+}
+string(6) "object"
+-- Iteration 9 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ bool(false)
+}
+string(6) "object"
+-- Iteration 10 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(11) "some string"
+}
+string(6) "object"
+-- Iteration 11 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ string(6) "string"
+}
+string(6) "object"
+-- Iteration 12 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ resource(5) of type (stream)
+}
+string(6) "object"
+-- Iteration 13 --
+bool(true)
+object(stdClass)#2 (1) {
+ ["scalar"]=>
+ resource(6) of type (stream)
+}
+string(6) "object"
+-- Iteration 14 --
+bool(true)
+object(point)#1 (2) {
+ ["x"]=>
+ int(10)
+ ["y"]=>
+ int(20)
+}
+string(6) "object"
+
+-- Setting type of data to string --
+-- Iteration 1 --
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 2 --
+bool(true)
+string(14) "another string"
+string(6) "string"
+-- Iteration 3 --
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 4 --
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 5 --
+bool(true)
+string(3) "-20"
+string(6) "string"
+-- Iteration 6 --
+bool(true)
+string(4) "2.54"
+string(6) "string"
+-- Iteration 7 --
+bool(true)
+string(5) "-2.54"
+string(6) "string"
+-- Iteration 8 --
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+bool(true)
+string(11) "some string"
+string(6) "string"
+-- Iteration 11 --
+bool(true)
+string(6) "string"
+string(6) "string"
+-- Iteration 12 --
+bool(true)
+string(14) "Resource id #5"
+string(6) "string"
+-- Iteration 13 --
+bool(true)
+string(14) "Resource id #6"
+string(6) "string"
+-- Iteration 14 --
+bool(true)
+string(6) "Object"
+string(6) "string"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt
new file mode 100644
index 0000000..2c6aac6
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test gettype() & settype() functions : error conditions
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test different error conditions of settype() and gettype() functions */
+
+echo "**** Testing gettype() and settype() functions ****\n";
+
+echo "\n*** Testing gettype(): error conditions ***\n";
+//Zero arguments
+var_dump( gettype() );
+// args more than expected
+var_dump( gettype( "1", "2" ) );
+
+echo "\n*** Testing settype(): error conditions ***\n";
+//Zero arguments
+var_dump( settype() );
+
+// args more than expected
+$var = 10.5;
+var_dump( settype( $var, $var, "int" ) );
+
+// passing an invalid type to set
+var_dump( settype( $var, "unknown" ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+**** Testing gettype() and settype() functions ****
+
+*** Testing gettype(): error conditions ***
+
+Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+*** Testing settype(): error conditions ***
+
+Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: settype(): Invalid type in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
new file mode 100644
index 0000000..b8834d5
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
@@ -0,0 +1,589 @@
+--TEST--
+Test gettype() & settype() functions : usage variatoins
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to null type.
+ Set type of the data to "null" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to "null type"
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to null type */
+$type = "null";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to null --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+NULL
+string(4) "NULL"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
new file mode 100644
index 0000000..25bf22c
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
@@ -0,0 +1,1005 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+if ( strtoupper( substr(PHP_OS, 0, 3) ) == 'MAC' ) {
+ die('skip Do not run on MacOS');
+}
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to int/integer type.
+ Set type of the data to "int"/"integer" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to interger/int type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+// test conversion to these types
+$types = array(
+ "integer",
+ "int"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to integer --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+int(3)
+string(7) "integer"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+int(-2147483648)
+string(7) "integer"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+int(-2147483647)
+string(7) "integer"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+int(-508130303)
+string(7) "integer"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+int(1952002105)
+string(7) "integer"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+int(343000682)
+string(7) "integer"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+
+-- Setting type of data to int --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+int(3)
+string(7) "integer"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+int(10)
+string(7) "integer"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+int(-123)
+string(7) "integer"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+int(123)
+string(7) "integer"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+int(-2147483648)
+string(7) "integer"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+int(-2147483647)
+string(7) "integer"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+int(-508130303)
+string(7) "integer"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+int(1952002105)
+string(7) "integer"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+int(343000682)
+string(7) "integer"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+int(100000)
+string(7) "integer"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+int(-100000)
+string(7) "integer"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+int(-1)
+string(7) "integer"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+int(500000)
+string(7) "integer"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+int(-500000)
+string(7) "integer"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+int(512000)
+string(7) "integer"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+int(-512000)
+string(7) "integer"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to int
+bool(true)
+int(1)
+string(7) "integer"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+int(0)
+string(7) "integer"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
new file mode 100644
index 0000000..35066b0
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
@@ -0,0 +1,1002 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to float/double type.
+ Set type of the data to "float"/"double" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to float/double type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+// test conversion to these types
+$types = array(
+ "float",
+ "double"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to float --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+float(3)
+string(6) "double"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+float(2147483647)
+string(6) "double"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+float(85)
+string(6) "double"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+float(-21903)
+string(6) "double"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+float(365)
+string(6) "double"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+float(-365)
+string(6) "double"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+
+-- Setting type of data to double --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+float(3)
+string(6) "double"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+float(10)
+string(6) "double"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+float(-1)
+string(6) "double"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+float(100)
+string(6) "double"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+float(2.9743947493287E+21)
+string(6) "double"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+float(-0.01)
+string(6) "double"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+float(-123)
+string(6) "double"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+float(123)
+string(6) "double"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+float(-0)
+string(6) "double"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+float(2147483647)
+string(6) "double"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+float(85)
+string(6) "double"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+float(-21903)
+string(6) "double"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+float(365)
+string(6) "double"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+float(-365)
+string(6) "double"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 77 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 78 --
+string(6) "object"
+8: Object of class point could not be converted to double
+bool(true)
+float(1)
+string(6) "double"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+float(0)
+string(6) "double"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
new file mode 100644
index 0000000..8b93e63
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
@@ -0,0 +1,1201 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to bool/boolean type.
+ Set type of the data to "bool"/"boolean" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to bool/boolean type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+class class_with_no_member {
+ // no member(s)
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ '0',
+
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ 0,
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 0.0,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+ new class_with_no_member,
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var,
+
+ /* binary strings */
+ b"0",
+ b'0',
+ b"10string",
+ b'10string',
+ b"+0123",
+ b'-0123',
+ b"0xff",
+ b'0x55',
+ b'1e2',
+ b'2974394749328742328432',
+ b"1e2",
+ b'10string',
+ b"10string"
+);
+
+// test conversion to these types
+$types = array(
+ "boolean",
+ "bool"
+);
+
+echo "\n*** Testing settype() & gettype() : usage variations ***\n";
+foreach ($types as $type) {
+ echo "\n-- Setting type of data to $type --\n";
+ $inner_loop_count = 1;
+ foreach ($var_values as $var) {
+ echo "-- Iteration $inner_loop_count --\n"; $inner_loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to new type
+ var_dump( settype($var, $type) );
+
+ // dump the converted $var
+ var_dump( $var );
+
+ // get the new type of the $var
+ var_dump( gettype($var) );
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing settype() & gettype() : usage variations ***
+
+-- Setting type of data to boolean --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 43 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 44 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 48 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 49 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 50 --
+string(7) "integer"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 54 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 56 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 57 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 58 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 59 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 76 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 77 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 78 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 79 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 80 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 81 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 82 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 83 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 84 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 85 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 86 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 87 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 88 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 89 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 90 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 91 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 92 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 93 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 94 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 95 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 96 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 97 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 98 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+
+-- Setting type of data to bool --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 43 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 44 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 48 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 49 --
+string(5) "array"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 50 --
+string(7) "integer"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 54 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 56 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 57 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 58 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 59 --
+string(7) "integer"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 76 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 77 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 78 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 79 --
+string(6) "double"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 80 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 81 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 82 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 83 --
+string(6) "object"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 84 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 85 --
+string(4) "NULL"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 86 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 87 --
+string(6) "string"
+bool(true)
+bool(false)
+string(7) "boolean"
+-- Iteration 88 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 89 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 90 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 91 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 92 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 93 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 94 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 95 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 96 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 97 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+-- Iteration 98 --
+string(6) "string"
+bool(true)
+bool(true)
+string(7) "boolean"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
new file mode 100644
index 0000000..c9fa575
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
@@ -0,0 +1,714 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to resource type.
+ Set type of the data to "resource" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to resource type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to resource type */
+$type = "resource";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to resource --
+-- Iteration 1 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 2 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(false)
+string(7) "boolean"
+-- Iteration 3 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(true)
+string(7) "boolean"
+-- Iteration 4 --
+string(7) "boolean"
+2: settype(): Cannot convert to resource type
+bool(false)
+bool(true)
+string(7) "boolean"
+-- Iteration 5 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "ÿ"
+string(6) "string"
+-- Iteration 6 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "f"
+string(6) "string"
+-- Iteration 7 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "
+3"
+string(6) "string"
+-- Iteration 8 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) " "
+string(6) "string"
+-- Iteration 11 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) " "
+string(6) "string"
+-- Iteration 12 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "10"
+string(6) "string"
+-- Iteration 13 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "10"
+string(6) "string"
+-- Iteration 14 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "10string"
+string(6) "string"
+-- Iteration 15 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "10string"
+string(6) "string"
+-- Iteration 16 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "1"
+string(6) "string"
+-- Iteration 17 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "-1"
+string(6) "string"
+-- Iteration 18 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 19 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) " 1"
+string(6) "string"
+-- Iteration 20 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 21 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 22 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(1) "1"
+string(6) "string"
+-- Iteration 23 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) "-1"
+string(6) "string"
+-- Iteration 24 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 25 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(2) " 1"
+string(6) "string"
+-- Iteration 26 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 27 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 28 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0xff"
+string(6) "string"
+-- Iteration 29 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0x55"
+string(6) "string"
+-- Iteration 30 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "0XA55"
+string(6) "string"
+-- Iteration 31 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "0X123"
+string(6) "string"
+-- Iteration 32 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0123"
+string(6) "string"
+-- Iteration 33 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(4) "0123"
+string(6) "string"
+-- Iteration 34 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 35 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 36 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 37 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 38 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "-0x80001"
+string(6) "string"
+-- Iteration 39 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(8) "+0x80001"
+string(6) "string"
+-- Iteration 40 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(10) "-0x80001.5"
+string(6) "string"
+-- Iteration 41 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(9) "0x80001.5"
+string(6) "string"
+-- Iteration 42 --
+string(6) "string"
+2: settype(): Cannot convert to resource type
+bool(false)
+string(12) "@$%#$%^$%^&^"
+string(6) "string"
+-- Iteration 43 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(0) {
+}
+string(5) "array"
+-- Iteration 44 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(1) {
+ [0]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 45 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 46 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 47 --
+string(5) "array"
+2: settype(): Cannot convert to resource type
+bool(false)
+array(3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(5) "array"
+-- Iteration 48 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-2147483648)
+string(6) "double"
+-- Iteration 49 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(2147483647)
+string(7) "integer"
+-- Iteration 50 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(2147483649)
+string(6) "double"
+-- Iteration 51 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(1232147483649)
+string(6) "double"
+-- Iteration 52 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(85)
+string(7) "integer"
+-- Iteration 53 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(1058513956921)
+string(6) "double"
+-- Iteration 54 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-21903)
+string(7) "integer"
+-- Iteration 55 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(365)
+string(7) "integer"
+-- Iteration 56 --
+string(7) "integer"
+2: settype(): Cannot convert to resource type
+bool(false)
+int(-365)
+string(7) "integer"
+-- Iteration 57 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(80561044571754)
+string(6) "double"
+-- Iteration 58 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(100000)
+string(6) "double"
+-- Iteration 59 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-100000)
+string(6) "double"
+-- Iteration 60 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(100000)
+string(6) "double"
+-- Iteration 61 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-100000)
+string(6) "double"
+-- Iteration 62 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-1.5)
+string(6) "double"
+-- Iteration 63 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(0.5)
+string(6) "double"
+-- Iteration 64 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-0.5)
+string(6) "double"
+-- Iteration 65 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(500000)
+string(6) "double"
+-- Iteration 66 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-500000)
+string(6) "double"
+-- Iteration 67 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-5.0E-7)
+string(6) "double"
+-- Iteration 68 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(500000)
+string(6) "double"
+-- Iteration 69 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-500000)
+string(6) "double"
+-- Iteration 70 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(512000)
+string(6) "double"
+-- Iteration 71 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-512000)
+string(6) "double"
+-- Iteration 72 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 73 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(5.12E-7)
+string(6) "double"
+-- Iteration 74 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(512000)
+string(6) "double"
+-- Iteration 75 --
+string(6) "double"
+2: settype(): Cannot convert to resource type
+bool(false)
+float(-512000)
+string(6) "double"
+-- Iteration 76 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#1 (2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 77 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#2 (2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(6) "object"
+-- Iteration 78 --
+string(6) "object"
+2: settype(): Cannot convert to resource type
+bool(false)
+object(point)#3 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(6) "object"
+-- Iteration 79 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+-- Iteration 80 --
+string(4) "NULL"
+2: settype(): Cannot convert to resource type
+bool(false)
+NULL
+string(4) "NULL"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
new file mode 100644
index 0000000..0e99630
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
@@ -0,0 +1,846 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to array type.
+ Set type of the data to "array" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to array type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to array type */
+$type = "array";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to array --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+string(5) "array"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(true)
+}
+string(5) "array"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+array(1) {
+ [0]=>
+ bool(true)
+}
+string(5) "array"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "ÿ"
+}
+string(5) "array"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "f"
+}
+string(5) "array"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "
+3"
+}
+string(5) "array"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+string(5) "array"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+string(5) "array"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+string(5) "array"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) " "
+}
+string(5) "array"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+string(5) "array"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "10"
+}
+string(5) "array"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "10string"
+}
+string(5) "array"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "10string"
+}
+string(5) "array"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+string(5) "array"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+string(5) "array"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(3) "1e2"
+}
+string(5) "array"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) " 1"
+}
+string(5) "array"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(22) "2974394749328742328432"
+}
+string(5) "array"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-1e-2"
+}
+string(5) "array"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+string(5) "array"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) "-1"
+}
+string(5) "array"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(3) "1e2"
+}
+string(5) "array"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(2) " 1"
+}
+string(5) "array"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(22) "2974394749328742328432"
+}
+string(5) "array"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-1e-2"
+}
+string(5) "array"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0xff"
+}
+string(5) "array"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0x55"
+}
+string(5) "array"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "0XA55"
+}
+string(5) "array"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "0X123"
+}
+string(5) "array"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0123"
+}
+string(5) "array"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(4) "0123"
+}
+string(5) "array"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-0123"
+}
+string(5) "array"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "+0123"
+}
+string(5) "array"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "-0123"
+}
+string(5) "array"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(5) "+0123"
+}
+string(5) "array"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "-0x80001"
+}
+string(5) "array"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(8) "+0x80001"
+}
+string(5) "array"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(10) "-0x80001.5"
+}
+string(5) "array"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(9) "0x80001.5"
+}
+string(5) "array"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+array(1) {
+ [0]=>
+ string(12) "@$%#$%^$%^&^"
+}
+string(5) "array"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+array(1) {
+ [0]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+array(4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(5) "array"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+array(3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(5) "array"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-2147483648)
+}
+string(5) "array"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(2147483647)
+}
+string(5) "array"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(2147483649)
+}
+string(5) "array"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(1232147483649)
+}
+string(5) "array"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(85)
+}
+string(5) "array"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(1058513956921)
+}
+string(5) "array"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(-21903)
+}
+string(5) "array"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(365)
+}
+string(5) "array"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+array(1) {
+ [0]=>
+ int(-365)
+}
+string(5) "array"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(80561044571754)
+}
+string(5) "array"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(100000)
+}
+string(5) "array"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-100000)
+}
+string(5) "array"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(100000)
+}
+string(5) "array"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-100000)
+}
+string(5) "array"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-1.5)
+}
+string(5) "array"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(0.5)
+}
+string(5) "array"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-0.5)
+}
+string(5) "array"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(500000)
+}
+string(5) "array"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-500000)
+}
+string(5) "array"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-5.0E-7)
+}
+string(5) "array"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(500000)
+}
+string(5) "array"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-500000)
+}
+string(5) "array"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(512000)
+}
+string(5) "array"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-512000)
+}
+string(5) "array"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(5.12E-7)
+}
+string(5) "array"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(5.12E-7)
+}
+string(5) "array"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(512000)
+}
+string(5) "array"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+array(1) {
+ [0]=>
+ float(-512000)
+}
+string(5) "array"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(5) "array"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(5) "array"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+array(2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(5) "array"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+array(0) {
+}
+string(5) "array"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
new file mode 100644
index 0000000..2da7bb2
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
@@ -0,0 +1,844 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to object type.
+ Set type of the data to "object" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to object type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to object type */
+$type = "object";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to object --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(false)
+}
+string(6) "object"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(true)
+}
+string(6) "object"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ bool(true)
+}
+string(6) "object"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "ÿ"
+}
+string(6) "object"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "f"
+}
+string(6) "object"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "
+3"
+}
+string(6) "object"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(0) ""
+}
+string(6) "object"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(0) ""
+}
+string(6) "object"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) " "
+}
+string(6) "object"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) " "
+}
+string(6) "object"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "10"
+}
+string(6) "object"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "10"
+}
+string(6) "object"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "10string"
+}
+string(6) "object"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "10string"
+}
+string(6) "object"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "1"
+}
+string(6) "object"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "-1"
+}
+string(6) "object"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(3) "1e2"
+}
+string(6) "object"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) " 1"
+}
+string(6) "object"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(22) "2974394749328742328432"
+}
+string(6) "object"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-1e-2"
+}
+string(6) "object"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(1) "1"
+}
+string(6) "object"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) "-1"
+}
+string(6) "object"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(3) "1e2"
+}
+string(6) "object"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(2) " 1"
+}
+string(6) "object"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(22) "2974394749328742328432"
+}
+string(6) "object"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-1e-2"
+}
+string(6) "object"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0xff"
+}
+string(6) "object"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0x55"
+}
+string(6) "object"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "0XA55"
+}
+string(6) "object"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "0X123"
+}
+string(6) "object"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0123"
+}
+string(6) "object"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(4) "0123"
+}
+string(6) "object"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-0123"
+}
+string(6) "object"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "+0123"
+}
+string(6) "object"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "-0123"
+}
+string(6) "object"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(5) "+0123"
+}
+string(6) "object"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "-0x80001"
+}
+string(6) "object"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(8) "+0x80001"
+}
+string(6) "object"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(10) "-0x80001.5"
+}
+string(6) "object"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(9) "0x80001.5"
+}
+string(6) "object"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ string(12) "@$%#$%^$%^&^"
+}
+string(6) "object"
+-- Iteration 43 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 44 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (1) {
+ [0]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 45 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 46 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (4) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ ["four"]=>
+ int(4)
+}
+string(6) "object"
+-- Iteration 47 --
+string(5) "array"
+bool(true)
+object(stdClass)#4 (3) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(2.4)
+ [2]=>
+ float(6500000)
+}
+string(6) "object"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-2147483648)
+}
+string(6) "object"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(2147483647)
+}
+string(6) "object"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(2147483649)
+}
+string(6) "object"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(1232147483649)
+}
+string(6) "object"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(85)
+}
+string(6) "object"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(1058513956921)
+}
+string(6) "object"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(-21903)
+}
+string(6) "object"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(365)
+}
+string(6) "object"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ int(-365)
+}
+string(6) "object"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(80561044571754)
+}
+string(6) "object"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(100000)
+}
+string(6) "object"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-100000)
+}
+string(6) "object"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(100000)
+}
+string(6) "object"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-100000)
+}
+string(6) "object"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-1.5)
+}
+string(6) "object"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(0.5)
+}
+string(6) "object"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-0.5)
+}
+string(6) "object"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(500000)
+}
+string(6) "object"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-500000)
+}
+string(6) "object"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-5.0E-7)
+}
+string(6) "object"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(500000)
+}
+string(6) "object"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-500000)
+}
+string(6) "object"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(512000)
+}
+string(6) "object"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-512000)
+}
+string(6) "object"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(5.12E-7)
+}
+string(6) "object"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(5.12E-7)
+}
+string(6) "object"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(512000)
+}
+string(6) "object"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+object(stdClass)#4 (1) {
+ ["scalar"]=>
+ float(-512000)
+}
+string(6) "object"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+object(point)#1 (2) {
+ ["x"]=>
+ NULL
+ ["y"]=>
+ NULL
+}
+string(6) "object"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+object(point)#2 (2) {
+ ["x"]=>
+ float(2.5)
+ ["y"]=>
+ float(40.5)
+}
+string(6) "object"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+object(point)#3 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+}
+string(6) "object"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+object(stdClass)#4 (0) {
+}
+string(6) "object"
+Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
new file mode 100644
index 0000000..54fb9c1
--- /dev/null
+++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
@@ -0,0 +1,595 @@
+--TEST--
+Test gettype() & settype() functions : usage variations
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string gettype ( mixed $var );
+ Description: Returns the type of the PHP variable var
+
+ Prototype: bool settype ( mixed &$var, string $type );
+ Description: Set the type of variable var to type
+*/
+
+/* Test usage variation of gettype() and settype() functions:
+ settype() to string type.
+ Set type of the data to "string" and verify using gettype
+ Following are performed in the listed sequence:
+ get the current type of the variable
+ set the type of the variable to string type
+ dump the variable to see its new data
+ get the new type of the variable
+*/
+
+/* function to handle catchable errors */
+function foo($errno, $errstr, $errfile, $errline) {
+// var_dump($errstr);
+ // print error no and error string
+ echo "$errno: $errstr\n";
+}
+//set the error handler, this is required as
+// settype() would fail with catachable fatal error
+set_error_handler("foo");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+// a variable which is unset
+$unset_var = 10.5;
+unset( $unset_var );
+
+class point
+{
+ var $x;
+ var $y;
+
+ function point($x, $y) {
+ $this->x = $x;
+ $this->y = $y;
+ }
+
+ function __toString() {
+ return "ObjectPoint";
+ }
+}
+
+$var_values = array (
+ /* nulls */
+ null,
+
+ /* boolean */
+ FALSE,
+ TRUE,
+ true,
+
+ /* strings */
+ "\xFF",
+ "\x66",
+ "\0123",
+ "",
+ '',
+ " ",
+ ' ',
+ /* numerics in the form of string */
+ '10',
+ "10",
+ "10string",
+ '10string',
+ "1",
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0x55',
+ '0XA55',
+ '0X123',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123',
+ "-0x80001", // invalid numerics as its prefix with sign or have decimal points
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ "@$%#$%^$%^&^",
+
+ /* arrays */
+ array(),
+ array(NULL),
+ array(1,2,3,4),
+ array(1 => "one", 2 => "two", "3" => "three", "four" => 4),
+ array(1.5, 2.4, 6.5e6),
+
+ /* integers */
+ -2147483648, // max -ne int value
+ 2147483647,
+ 2147483649,
+ 1232147483649,
+ 0x55,
+ 0xF674593039, // a hex value > than max int
+ -0X558F,
+ 0555,
+ -0555,
+ 02224242434343152, // an octal value > than max int
+
+ /* floats */
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E5,
+ -1.5,
+ .5,
+ -.5,
+ .5e6,
+ -.5e6,
+ -.5e-6,
+ .5e+6,
+ -.5e+6,
+ .512E6,
+ -.512E6,
+ .512E-6,
+ +.512E-6,
+ .512E+6,
+ -.512E+6,
+
+ new point(NULL, NULL),
+ new point(2.5, 40.5),
+ new point(0, 0),
+
+ /* undefined/unset vars */
+ $unset_var,
+ $undef_var
+);
+
+/* test conversion to string type */
+$type = "string";
+
+echo "\n*** Testing gettype() & settype() functions : usage variations ***\n";
+echo "\n-- Setting type of data to $type --\n";
+$loop_count = 1;
+foreach ($var_values as $var) {
+ echo "-- Iteration $loop_count --\n"; $loop_count++;
+
+ // get the current data type
+ var_dump( gettype($var) );
+
+ // convert it to null
+ var_dump( settype($var, $type) );
+
+ // dump the converted data
+ var_dump( $var );
+
+ // check the new type after conversion
+ var_dump( gettype($var) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+8: Undefined variable: unset_var
+8: Undefined variable: undef_var
+
+*** Testing gettype() & settype() functions : usage variations ***
+
+-- Setting type of data to string --
+-- Iteration 1 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 2 --
+string(7) "boolean"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 3 --
+string(7) "boolean"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 4 --
+string(7) "boolean"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 5 --
+string(6) "string"
+bool(true)
+string(1) "ÿ"
+string(6) "string"
+-- Iteration 6 --
+string(6) "string"
+bool(true)
+string(1) "f"
+string(6) "string"
+-- Iteration 7 --
+string(6) "string"
+bool(true)
+string(2) "
+3"
+string(6) "string"
+-- Iteration 8 --
+string(6) "string"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 9 --
+string(6) "string"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 10 --
+string(6) "string"
+bool(true)
+string(1) " "
+string(6) "string"
+-- Iteration 11 --
+string(6) "string"
+bool(true)
+string(1) " "
+string(6) "string"
+-- Iteration 12 --
+string(6) "string"
+bool(true)
+string(2) "10"
+string(6) "string"
+-- Iteration 13 --
+string(6) "string"
+bool(true)
+string(2) "10"
+string(6) "string"
+-- Iteration 14 --
+string(6) "string"
+bool(true)
+string(8) "10string"
+string(6) "string"
+-- Iteration 15 --
+string(6) "string"
+bool(true)
+string(8) "10string"
+string(6) "string"
+-- Iteration 16 --
+string(6) "string"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 17 --
+string(6) "string"
+bool(true)
+string(2) "-1"
+string(6) "string"
+-- Iteration 18 --
+string(6) "string"
+bool(true)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 19 --
+string(6) "string"
+bool(true)
+string(2) " 1"
+string(6) "string"
+-- Iteration 20 --
+string(6) "string"
+bool(true)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 21 --
+string(6) "string"
+bool(true)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 22 --
+string(6) "string"
+bool(true)
+string(1) "1"
+string(6) "string"
+-- Iteration 23 --
+string(6) "string"
+bool(true)
+string(2) "-1"
+string(6) "string"
+-- Iteration 24 --
+string(6) "string"
+bool(true)
+string(3) "1e2"
+string(6) "string"
+-- Iteration 25 --
+string(6) "string"
+bool(true)
+string(2) " 1"
+string(6) "string"
+-- Iteration 26 --
+string(6) "string"
+bool(true)
+string(22) "2974394749328742328432"
+string(6) "string"
+-- Iteration 27 --
+string(6) "string"
+bool(true)
+string(5) "-1e-2"
+string(6) "string"
+-- Iteration 28 --
+string(6) "string"
+bool(true)
+string(4) "0xff"
+string(6) "string"
+-- Iteration 29 --
+string(6) "string"
+bool(true)
+string(4) "0x55"
+string(6) "string"
+-- Iteration 30 --
+string(6) "string"
+bool(true)
+string(5) "0XA55"
+string(6) "string"
+-- Iteration 31 --
+string(6) "string"
+bool(true)
+string(5) "0X123"
+string(6) "string"
+-- Iteration 32 --
+string(6) "string"
+bool(true)
+string(4) "0123"
+string(6) "string"
+-- Iteration 33 --
+string(6) "string"
+bool(true)
+string(4) "0123"
+string(6) "string"
+-- Iteration 34 --
+string(6) "string"
+bool(true)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 35 --
+string(6) "string"
+bool(true)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 36 --
+string(6) "string"
+bool(true)
+string(5) "-0123"
+string(6) "string"
+-- Iteration 37 --
+string(6) "string"
+bool(true)
+string(5) "+0123"
+string(6) "string"
+-- Iteration 38 --
+string(6) "string"
+bool(true)
+string(8) "-0x80001"
+string(6) "string"
+-- Iteration 39 --
+string(6) "string"
+bool(true)
+string(8) "+0x80001"
+string(6) "string"
+-- Iteration 40 --
+string(6) "string"
+bool(true)
+string(10) "-0x80001.5"
+string(6) "string"
+-- Iteration 41 --
+string(6) "string"
+bool(true)
+string(9) "0x80001.5"
+string(6) "string"
+-- Iteration 42 --
+string(6) "string"
+bool(true)
+string(12) "@$%#$%^$%^&^"
+string(6) "string"
+-- Iteration 43 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 44 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 45 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 46 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 47 --
+string(5) "array"
+8: Array to string conversion
+bool(true)
+string(5) "Array"
+string(6) "string"
+-- Iteration 48 --
+string(6) "double"
+bool(true)
+string(11) "-2147483648"
+string(6) "string"
+-- Iteration 49 --
+string(7) "integer"
+bool(true)
+string(10) "2147483647"
+string(6) "string"
+-- Iteration 50 --
+string(6) "double"
+bool(true)
+string(10) "2147483649"
+string(6) "string"
+-- Iteration 51 --
+string(6) "double"
+bool(true)
+string(13) "1232147483649"
+string(6) "string"
+-- Iteration 52 --
+string(7) "integer"
+bool(true)
+string(2) "85"
+string(6) "string"
+-- Iteration 53 --
+string(6) "double"
+bool(true)
+string(13) "1058513956921"
+string(6) "string"
+-- Iteration 54 --
+string(7) "integer"
+bool(true)
+string(6) "-21903"
+string(6) "string"
+-- Iteration 55 --
+string(7) "integer"
+bool(true)
+string(3) "365"
+string(6) "string"
+-- Iteration 56 --
+string(7) "integer"
+bool(true)
+string(4) "-365"
+string(6) "string"
+-- Iteration 57 --
+string(6) "double"
+bool(true)
+string(14) "80561044571754"
+string(6) "string"
+-- Iteration 58 --
+string(6) "double"
+bool(true)
+string(6) "100000"
+string(6) "string"
+-- Iteration 59 --
+string(6) "double"
+bool(true)
+string(7) "-100000"
+string(6) "string"
+-- Iteration 60 --
+string(6) "double"
+bool(true)
+string(6) "100000"
+string(6) "string"
+-- Iteration 61 --
+string(6) "double"
+bool(true)
+string(7) "-100000"
+string(6) "string"
+-- Iteration 62 --
+string(6) "double"
+bool(true)
+string(4) "-1.5"
+string(6) "string"
+-- Iteration 63 --
+string(6) "double"
+bool(true)
+string(3) "0.5"
+string(6) "string"
+-- Iteration 64 --
+string(6) "double"
+bool(true)
+string(4) "-0.5"
+string(6) "string"
+-- Iteration 65 --
+string(6) "double"
+bool(true)
+string(6) "500000"
+string(6) "string"
+-- Iteration 66 --
+string(6) "double"
+bool(true)
+string(7) "-500000"
+string(6) "string"
+-- Iteration 67 --
+string(6) "double"
+bool(true)
+string(7) "-5.0E-7"
+string(6) "string"
+-- Iteration 68 --
+string(6) "double"
+bool(true)
+string(6) "500000"
+string(6) "string"
+-- Iteration 69 --
+string(6) "double"
+bool(true)
+string(7) "-500000"
+string(6) "string"
+-- Iteration 70 --
+string(6) "double"
+bool(true)
+string(6) "512000"
+string(6) "string"
+-- Iteration 71 --
+string(6) "double"
+bool(true)
+string(7) "-512000"
+string(6) "string"
+-- Iteration 72 --
+string(6) "double"
+bool(true)
+string(7) "5.12E-7"
+string(6) "string"
+-- Iteration 73 --
+string(6) "double"
+bool(true)
+string(7) "5.12E-7"
+string(6) "string"
+-- Iteration 74 --
+string(6) "double"
+bool(true)
+string(6) "512000"
+string(6) "string"
+-- Iteration 75 --
+string(6) "double"
+bool(true)
+string(7) "-512000"
+string(6) "string"
+-- Iteration 76 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 77 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 78 --
+string(6) "object"
+bool(true)
+string(11) "ObjectPoint"
+string(6) "string"
+-- Iteration 79 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+-- Iteration 80 --
+string(4) "NULL"
+bool(true)
+string(0) ""
+string(6) "string"
+Done
diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt
new file mode 100644
index 0000000..e83bbf6
--- /dev/null
+++ b/ext/standard/tests/general_functions/head.phpt
@@ -0,0 +1,53 @@
+--TEST--
+header() and friends
+--SKIPIF--
+<?php
+if (php_sapi_name() != "cli") {
+ die("skip this test is for CLI");
+}
+?>
+--FILE--
+<?php
+
+$v1 = headers_sent();
+$v2 = headers_list();
+var_dump(header("HTTP 1.0", true, 200));
+
+var_dump($v1);
+var_dump($v2);
+
+var_dump(header(""));
+var_dump(header("", true));
+var_dump(headers_sent());
+var_dump(headers_list());
+var_dump(header("HTTP blah"));
+var_dump(header("HTTP blah", true));
+var_dump(headers_sent());
+var_dump(headers_list());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+bool(false)
+array(0) {
+}
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+bool(true)
+array(0) {
+}
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+
+Warning: Cannot modify header information - headers already sent by (output started at %s:%d) in %s on line %d
+NULL
+bool(true)
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/general_functions/highlight_heredoc.phpt b/ext/standard/tests/general_functions/highlight_heredoc.phpt
new file mode 100644
index 0000000..ee4e2e8
--- /dev/null
+++ b/ext/standard/tests/general_functions/highlight_heredoc.phpt
@@ -0,0 +1,21 @@
+--TEST--
+highlight_string() handling of heredoc
+--INI--
+highlight.html=#000000
+--FILE--
+<?php
+$str = '
+$x=<<<DD
+jhdsjkfhjdsh
+DD
+."";
+$a=<<<DDDD
+jhdsjkfhjdsh
+DDDD;
+';
+highlight_string($str);
+?>
+--EXPECT--
+<code><span style="color: #000000">
+<br />$x=&lt;&lt;&lt;DD<br />jhdsjkfhjdsh<br />DD<br />."";<br />$a=&lt;&lt;&lt;DDDD<br />jhdsjkfhjdsh<br />DDDD;<br /></span>
+</code>
diff --git a/ext/standard/tests/general_functions/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
new file mode 100644
index 0000000..4a791c7
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request.phpt
@@ -0,0 +1,76 @@
+--TEST--
+import_request_variables() tests
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+a=1&b=heh&c=3&d[]=5&GLOBALS=test&1=hm
+--POST--
+ap=25&bp=test&cp=blah3&dp[]=ar
+--FILE--
+<?php
+
+var_dump(import_request_variables());
+var_dump(import_request_variables(""));
+var_dump(import_request_variables("", ""));
+
+var_dump(import_request_variables("g", ""));
+var_dump($a, $b, $c, $ap);
+
+var_dump(import_request_variables("g", "g_"));
+var_dump($g_a, $g_b, $g_c, $g_ap, $g_1);
+
+var_dump(import_request_variables("GP", "i_"));
+var_dump($i_a, $i_b, $i_c, $i_ap, $i_bp, $i_cp, $i_dp);
+
+var_dump(import_request_variables("gGg", "r_"));
+var_dump($r_a, $r_b, $r_c, $r_ap);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: import_request_variables() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+bool(false)
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+bool(false)
+
+Notice: import_request_variables(): No prefix specified - possible security hazard in %s on line %d
+
+Warning: import_request_variables(): Attempted GLOBALS variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Numeric key detected - possible security hazard in %s on line %d
+bool(true)
+
+Notice: Undefined variable: ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+bool(true)
+
+Notice: Undefined variable: g_ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+string(2) "hm"
+bool(true)
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+string(2) "25"
+string(4) "test"
+string(5) "blah3"
+array(1) {
+ [0]=>
+ string(2) "ar"
+}
+bool(true)
+
+Notice: Undefined variable: r_ap in %s on line %d
+string(1) "1"
+string(3) "heh"
+string(1) "3"
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/import_request1.phpt b/ext/standard/tests/general_functions/import_request1.phpt
new file mode 100644
index 0000000..f592088
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request1.phpt
@@ -0,0 +1,101 @@
+--TEST--
+import_request_variables() test (overwrite super-globals)
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+GET=0&POST=1&COOKIE=2&FILES=3&REQUEST=4
+--POST--
+GET=5&POST=6&COOKIE=7&FILES=8&REQUEST=9
+--COOKIE--
+GET=10;POST=11;COOKIE=12;FILES=13;REQUEST=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gpc", "_");
+var_dump($_GET, $_POST, $_COOKIE, $_FILES, $_REQUEST);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_GET) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_POST) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_COOKIE) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_FILES) variable overwrite in %s on line %d
+
+Warning: import_request_variables(): Attempted super-global (_REQUEST) variable overwrite in %s on line %d
+array(5) {
+ ["GET"]=>
+ string(1) "0"
+ ["POST"]=>
+ string(1) "1"
+ ["COOKIE"]=>
+ string(1) "2"
+ ["FILES"]=>
+ string(1) "3"
+ ["REQUEST"]=>
+ string(1) "4"
+}
+array(5) {
+ ["GET"]=>
+ string(1) "5"
+ ["POST"]=>
+ string(1) "6"
+ ["COOKIE"]=>
+ string(1) "7"
+ ["FILES"]=>
+ string(1) "8"
+ ["REQUEST"]=>
+ string(1) "9"
+}
+array(5) {
+ ["GET"]=>
+ string(2) "10"
+ ["POST"]=>
+ string(2) "11"
+ ["COOKIE"]=>
+ string(2) "12"
+ ["FILES"]=>
+ string(2) "13"
+ ["REQUEST"]=>
+ string(2) "14"
+}
+array(0) {
+}
+array(5) {
+ ["GET"]=>
+ string(1) "5"
+ ["POST"]=>
+ string(1) "6"
+ ["COOKIE"]=>
+ string(1) "7"
+ ["FILES"]=>
+ string(1) "8"
+ ["REQUEST"]=>
+ string(1) "9"
+}
+Done
diff --git a/ext/standard/tests/general_functions/import_request2.phpt b/ext/standard/tests/general_functions/import_request2.phpt
new file mode 100644
index 0000000..c290602
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request2.phpt
@@ -0,0 +1,27 @@
+--TEST--
+import_request_variables() test (numeric keys)
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+1=0&2=1&3=2&4=3&5=4
+--POST--
+1=5&2=6&3=7&4=8&5=9
+--COOKIE--
+1=10;2=11;3=12;4=13;5=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gpc", "_");
+var_dump($_1, $_2, $_3, $_4, $_5);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+Done
diff --git a/ext/standard/tests/general_functions/import_request3.phpt b/ext/standard/tests/general_functions/import_request3.phpt
new file mode 100644
index 0000000..a8cbf56
--- /dev/null
+++ b/ext/standard/tests/general_functions/import_request3.phpt
@@ -0,0 +1,27 @@
+--TEST--
+import_request_variables() test (numeric keys, different order)
+--SKIPIF--
+<?php if(PHP_VERSION_ID >= 50399){ die('skip not needed anymore without register_globals'); } ?>
+--GET--
+1=0&2=1&3=2&4=3&5=4
+--POST--
+1=5&2=6&3=7&4=8&5=9
+--COOKIE--
+1=10;2=11;3=12;4=13;5=14
+--INI--
+variables_order=CGP
+--FILE--
+<?php
+
+import_request_variables("gcp", "_");
+var_dump($_1, $_2, $_3, $_4, $_5);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+Done
diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt
new file mode 100644
index 0000000..0392307
--- /dev/null
+++ b/ext/standard/tests/general_functions/include_path.phpt
@@ -0,0 +1,75 @@
+--TEST--
+*_include_path() tests
+--INI--
+include_path=.
+--FILE--
+<?php
+
+var_dump(get_include_path());
+var_dump(get_include_path("var"));
+
+var_dump(restore_include_path());
+var_dump(restore_include_path(""));
+
+
+var_dump(set_include_path());
+var_dump(get_include_path());
+var_dump(set_include_path("var"));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(".:/path/to/dir"));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(""));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+var_dump(set_include_path(array()));
+var_dump(get_include_path());
+
+var_dump(restore_include_path());
+var_dump(get_include_path());
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "."
+
+Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+NULL
+
+Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+string(1) "."
+string(1) "."
+string(3) "var"
+NULL
+string(1) "."
+string(1) "."
+string(14) ".:/path/to/dir"
+NULL
+string(1) "."
+bool(false)
+string(1) "."
+NULL
+string(1) "."
+
+Warning: set_include_path() expects parameter 1 to be string, array given in %s on line %d
+NULL
+string(1) "."
+NULL
+string(1) "."
+Done
diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt
new file mode 100644
index 0000000..60cd38a
--- /dev/null
+++ b/ext/standard/tests/general_functions/ini_get_all.phpt
@@ -0,0 +1,64 @@
+--TEST--
+ini_get_all() tests
+--INI--
+pcre.backtrack_limit=1000000
+pcre.recursion_limit=100000
+--SKIPIF--
+<?php if (!extension_loaded("reflection")) die("skip"); ?>
+--FILE--
+<?php
+
+var_dump(gettype(ini_get_all()));
+var_dump(ini_get_all(""));
+var_dump(ini_get_all("nosuchextension"));
+var_dump(ini_get_all("reflection"));
+var_dump(ini_get_all("pcre"));
+var_dump(ini_get_all("pcre", false));
+var_dump(ini_get_all("reflection", false));
+
+var_dump(ini_get_all("", ""));
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+
+Warning: ini_get_all(): Unable to find extension '' in %s on line %d
+bool(false)
+
+Warning: ini_get_all(): Unable to find extension 'nosuchextension' in %s on line %d
+bool(false)
+array(0) {
+}
+array(2) {
+ ["pcre.backtrack_limit"]=>
+ array(3) {
+ ["global_value"]=>
+ string(7) "1000000"
+ ["local_value"]=>
+ string(7) "1000000"
+ ["access"]=>
+ int(7)
+ }
+ ["pcre.recursion_limit"]=>
+ array(3) {
+ ["global_value"]=>
+ string(6) "100000"
+ ["local_value"]=>
+ string(6) "100000"
+ ["access"]=>
+ int(7)
+ }
+}
+array(2) {
+ ["pcre.backtrack_limit"]=>
+ string(7) "1000000"
+ ["pcre.recursion_limit"]=>
+ string(6) "100000"
+}
+array(0) {
+}
+
+Warning: ini_get_all(): Unable to find extension '' in %sini_get_all.php on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt
new file mode 100644
index 0000000..7986e2d
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval.phpt
@@ -0,0 +1,306 @@
+--TEST--
+Test intval() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: int intval( mixed $var [.int $base] );
+ * Description: Returns the integer value of var, using the specified base for the conversion(the default is base 10).
+ */
+
+echo "*** Testing intval() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ '0',
+ '1',
+ '-1',
+ '-2147483648', // max negative integer value
+ '-2147483647',
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ '0x12ab',
+ '0Xfff',
+ '0XFA',
+ -0x80000000, // max negative integer as hexadecimal
+ '0x7fffffff', // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ '0123', // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ );
+
+/* loop to check that intval() recognizes different
+ integer values, expected output:integer value in decimal notation for valid integer */
+
+echo "\n***Output with default base value ie 10 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value) );
+}
+
+
+echo "\n***Output with base value of 10( explicitly passed as argument) ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 10) );
+}
+
+
+echo "\n***Output with base value of 16 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 16) );
+}
+
+echo "\n***Output with base value of 8 ***\n";
+foreach ($valid_ints as $value ) {
+ var_dump( intval($value, 8) );
+}
+
+echo "\n*** Testing intval() on non integer types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+fclose($fp);
+$dfp = opendir ( dirname(__FILE__) );
+closedir($dfp);
+
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ '-2147483649', // float value
+ '2147483648', // float value
+ '-0x80000001', // float value, beyond max negative int
+ '0x800000001', // float value, beyond max positive int
+ '020000000001', // float value, beyond max positive int
+ '-020000000001', // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+
+
+/* loop through the $not_int_types to see working of
+ intval() on non integer types, expected output: integer value in decimal notation for valid integers */
+foreach ($not_int_types as $type ) {
+ var_dump( intval($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( intval() );
+
+//arguments more than expected
+var_dump( intval(TRUE, FALSE, TRUE) );
+
+echo "\n--- Done ---\n";
+
+
+?>
+--EXPECTF--
+*** Testing intval() with valid integer values ***
+
+***Output with default base value ie 10 ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483647)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(123)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 10( explicitly passed as argument) ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483647)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(123)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 16 ***
+int(0)
+int(1)
+int(-1)
+int(-2147483648)
+int(-2147483648)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(4779)
+int(4095)
+int(250)
+int(-2147483648)
+int(2147483647)
+int(2147483647)
+int(291)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+***Output with base value of 8 ***
+int(0)
+int(1)
+int(-1)
+int(-9020)
+int(-9020)
+int(2147483647)
+int(2147483640)
+int(4667)
+int(0)
+int(0)
+int(0)
+int(-2147483648)
+int(0)
+int(2147483647)
+int(83)
+int(1)
+int(-2147483648)
+int(2147483647)
+
+*** Testing intval() on non integer types ***
+int(-2147483648)
+int(2147483647)
+int(0)
+int(0)
+int(2147483647)
+int(-2147483648)
+int(0)
+int(0)
+int(1)
+int(100000)
+int(-1000000)
+int(100000000)
+int(-1000000000)
+int(10)
+int(1050000)
+int(%d)
+int(%d)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for intval() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for intval() in %s on line %d
+NULL
+
+--- Done ---
diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt
new file mode 100644
index 0000000..bf88c7c
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval_variation1.phpt
@@ -0,0 +1,203 @@
+--TEST--
+Test intval() function : usage variation
+--FILE--
+<?php
+/* Prototype : int intval(mixed var [, int base])
+ * Description: Get the integer value of a variable using the optional base for the conversion
+ * Source code: ext/standard/type.c
+ * Alias to functions:
+ */
+
+echo "*** Testing intval() : usage variation ***\n";
+
+// Define error handler
+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');
+
+// Initialise function arguments not being substituted (if any)
+$base = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789e5' => 12.3456789e5,
+ 'float -12.3456789e5' => -12.3456789e5,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for var
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( intval($value, $base) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing intval() : usage variation ***
+
+--int 0--
+int(0)
+
+--int 1--
+int(1)
+
+--int 12345--
+int(12345)
+
+--int -12345--
+int(-2345)
+
+--float 10.5--
+int(10)
+
+--float -10.5--
+int(-10)
+
+--float 12.3456789e5--
+int(1234567)
+
+--float -12.3456789e5--
+int(-1234567)
+
+--float .5--
+int(0)
+
+--empty array--
+int(0)
+
+--int indexed array--
+int(1)
+
+--associative array--
+int(1)
+
+--nested arrays--
+int(1)
+
+--uppercase NULL--
+int(0)
+
+--lowercase null--
+int(0)
+
+--lowercase true--
+int(1)
+
+--lowercase false--
+int(0)
+
+--uppercase TRUE--
+int(1)
+
+--uppercase FALSE--
+int(0)
+
+--empty string DQ--
+int(0)
+
+--empty string SQ--
+int(0)
+
+--string DQ--
+int(0)
+
+--string SQ--
+int(0)
+
+--mixed case string--
+int(0)
+
+--heredoc--
+int(0)
+
+--instance of classWithToString--
+Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
+int(1)
+
+--instance of classWithoutToString--
+Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
+int(1)
+
+--undefined var--
+int(0)
+
+--unset var--
+int(0)
+===DONE===
diff --git a/ext/standard/tests/general_functions/intval_variation2.phpt b/ext/standard/tests/general_functions/intval_variation2.phpt
new file mode 100644
index 0000000..65bc584
--- /dev/null
+++ b/ext/standard/tests/general_functions/intval_variation2.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test intval() function : usage variation
+--FILE--
+<?php
+/* Prototype : int intval(mixed var [, int base])
+ * Description: Get the integer value of a variable using the optional base for the conversion
+ * Source code: ext/standard/type.c
+ * Alias to functions:
+ */
+
+echo "*** Testing intval() : usage variation ***\n";
+
+// Define error handler
+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');
+
+// Initialise function arguments not being substituted (if any)
+$var = 1;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for base
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( intval($var, $value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing intval() : usage variation ***
+
+--float 10.5--
+int(1)
+
+--float -10.5--
+int(1)
+
+--float 12.3456789000e10--
+int(1)
+
+--float -12.3456789000e10--
+int(1)
+
+--float .5--
+int(1)
+
+--empty array--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - intval() expects parameter 2 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+int(1)
+
+--lowercase null--
+int(1)
+
+--lowercase true--
+int(1)
+
+--lowercase false--
+int(1)
+
+--uppercase TRUE--
+int(1)
+
+--uppercase FALSE--
+int(1)
+
+--empty string DQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - intval() expects parameter 2 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - intval() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - intval() expects parameter 2 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+int(1)
+
+--unset var--
+int(1)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt
new file mode 100644
index 0000000..469a8ec
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_array.phpt
@@ -0,0 +1,213 @@
+--TEST--
+Test is_array() function
+--FILE--
+<?php
+/* Prototype: bool is_array ( mixed $var );
+ * Description: Finds whether the given variable is an array
+ */
+
+echo "*** Testing is_array() on different type of arrays ***\n";
+/* different types of arrays */
+$arrays = array(
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test')
+);
+/* loop to check that is_array() recognizes different
+ type of arrays, expected output bool(true) */
+$loop_counter = 1;
+foreach ($arrays as $var_array ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_array ($var_array) );
+}
+
+echo "\n*** Testing is_array() on non array types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variables
+$unset_array = array(10);
+unset($unset_array);
+
+// other types in a array
+$varient_arrays = array (
+ /* integers */
+ 543915,
+ -5322,
+ 0x55F,
+ -0xCCF,
+ 123,
+ -0654,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ 'string',
+ "string",
+
+ /* floats */
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* nulls */
+ null,
+ NULL,
+
+ /* boolean */
+ true,
+ TRUE,
+ FALSE,
+ false,
+
+ /* unset/undefined arrays */
+ @$unset_array,
+ @$undefined_array
+);
+/* loop through the $varient_array to see working of
+ is_array() on non array types, expected output bool(false) */
+$loop_counter = 1;
+foreach ($varient_arrays as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_array ($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_array() );
+
+//arguments more than expected
+var_dump( is_array ($fp, $fp) );
+
+echo "Done\n";
+/* close resources */
+fclose($fp);
+closedir($dfp);
+?>
+--EXPECTF--
+*** Testing is_array() on different type of arrays ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+
+*** Testing is_array() on non array types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt
new file mode 100644
index 0000000..250385a
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_bool.phpt
@@ -0,0 +1,294 @@
+--TEST--
+Test is_bool() function
+--FILE--
+<?php
+/* Prototype: bool is_bool ( mixed $var );
+ * Description: Finds whether the given variable is a boolean
+ */
+
+echo "*** Testing is_bool() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bools = array(
+ TRUE,
+ FALSE,
+ true,
+ false,
+);
+/* loop to check that is_bool() recognizes different
+ bool values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_bools as $bool_val ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_bool($bool_val) );
+}
+
+echo "\n*** Testing is_bool() on non boolean values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_bool1 = true;
+$unset_bool2 = false;
+$unset_var = 0;
+unset ($unset_bool1);
+unset ($unset_bool2);
+unset ($unset_var);
+
+// other types in a array
+$not_bool_types = array (
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ 'string',
+ "string",
+ "true",
+ "false",
+ "FALSE",
+ "TRUE",
+ 'true',
+ 'false',
+ 'FALSE',
+ 'TRUE',
+ "NULL",
+ "null",
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* nulls */
+ null,
+ NULL,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* unset bool vars and undefined var */
+ @$unset_bool1,
+ @$unset_bool2,
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_bool_types to see working of
+ is_bool() on non bull types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_bool_types as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_bool($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_bool() );
+
+//arguments more than expected
+var_dump( is_bool(TRUE, FALSE) );
+
+echo "Done\n";
+
+// close resources
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_bool() with valid boolean values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+
+*** Testing is_bool() on non boolean values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+-- Iteration 46 --
+bool(false)
+-- Iteration 47 --
+bool(false)
+-- Iteration 48 --
+bool(false)
+-- Iteration 49 --
+bool(false)
+-- Iteration 50 --
+bool(false)
+-- Iteration 51 --
+bool(false)
+-- Iteration 52 --
+bool(false)
+-- Iteration 53 --
+bool(false)
+-- Iteration 54 --
+bool(false)
+-- Iteration 55 --
+bool(false)
+-- Iteration 56 --
+bool(false)
+-- Iteration 57 --
+bool(false)
+-- Iteration 58 --
+bool(false)
+-- Iteration 59 --
+bool(false)
+-- Iteration 60 --
+bool(false)
+-- Iteration 61 --
+bool(false)
+-- Iteration 62 --
+bool(false)
+-- Iteration 63 --
+bool(false)
+-- Iteration 64 --
+bool(false)
+-- Iteration 65 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_callable_basic1.phpt b/ext/standard/tests/general_functions/is_callable_basic1.phpt
new file mode 100644
index 0000000..fe4d6e2
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_basic1.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test is_callable() function : usage variations - defined functions
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ * Description: Verify that the contents of a variable can be called as a function
+ * Source code: ext/imap/php_imap.c
+ */
+
+/* Prototype: void check_iscallable( $functions );
+ Description: use iscallable() on given string to check for valid function name
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable( $functions ) {
+ $counter = 1;
+ foreach($functions as $func) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_callable($func) ); //given only $var argument
+ var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, TRUE, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, FALSE, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on defined functions ***\n";
+/* function name with simple string */
+function someFunction() {
+}
+
+/* function name with mixed string and integer */
+function x123() {
+}
+
+/* function name as NULL */
+function NULL() {
+}
+
+/* function name with boolean name */
+function false() {
+}
+
+/* function name with string and special character */
+function Hello_World() {
+}
+
+$defined_functions = array (
+ $functionVar1 = 'someFunction',
+ $functionVar2 = 'x123',
+ $functionVar3 = 'NULL',
+ $functionVar4 = 'false',
+ $functionVar5 = "Hello_World"
+);
+/* use check_iscallable() to check whether given string is valid function name
+ * expected: true as it is valid callback
+ */
+check_iscallable($defined_functions);
+
+?>
+===DONE===
+--EXPECT--
+*** Testing is_callable() on defined functions ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+someFunction
+bool(true)
+bool(true)
+someFunction
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+x123
+bool(true)
+bool(true)
+x123
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+NULL
+bool(true)
+bool(true)
+NULL
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+false
+bool(true)
+bool(true)
+false
+-- Iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+Hello_World
+bool(true)
+bool(true)
+Hello_World
+===DONE===
diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt
new file mode 100644
index 0000000..c900032
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt
@@ -0,0 +1,787 @@
+--TEST--
+Test is_callable() function : usage variations - on objects
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+/* Prototype: void check_iscallable_objects( $methods );
+ Description: use is_callable() on given $method to check if the array
+ contains a valid method name;
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable_objects( $methods ) {
+ global $loop_counter;
+ $counter = 1;
+ foreach($methods as $method) {
+ echo "-- Innerloop iteration $counter of Outerloop iteration $loop_counter --\n";
+ var_dump( is_callable($method) );
+ var_dump( is_callable($method, true) );
+ var_dump( is_callable($method, false) );
+ var_dump( is_callable($method, true, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($method, false, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on objects ***\n";
+class object_class
+{
+ public $value = 100;
+
+ /* static method */
+ static public function foo() {
+ }
+
+ public function foo1() {
+ }
+ /* function name with mixed string and integer */
+ public function x123() {
+ }
+ /* function name as NULL */
+ public function null() {
+ }
+ /* function name having boolean value */
+ public function TRUE() {
+ }
+
+ protected function foo2() {
+ }
+ private function foo3() {
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+/* class with member as object of other class */
+class contains_object_class
+{
+ public $class_object1;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->no_member_class_object = new no_member_class();
+ }
+}
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+/* check is_callable() on static method */
+echo "\n** Testing behavior of is_callable() on static methods **\n";
+var_dump( is_callable('object_class::foo()', true) ); //expected: true
+var_dump( is_callable('object_class::foo()') ); //expected: false
+
+echo "\n** Testing normal operations of is_callable() on objects **\n";
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+
+/* loop to check whether given object/string has valid given method name
+ * expected: true if valid callback
+ * false otherwise
+ */
+$loop_counter = 1;
+foreach($objects as $object) {
+ echo "--- Outerloop iteration $loop_counter ---\n";
+ $methods = array (
+ array( $object, 'foo1' ),
+ array( $object, 'foo2' ),
+ array( $object, 'foo3' ),
+ array( $object, 'x123' ),
+ array( $object, 'null' ),
+ array( $object, 'TRUE' ),
+ array( $object, '123' ),
+ array( @$temp_class_obj->value, 100 ),
+ array( $object, 'func' ),
+ array( 'object_class', 'foo1' ),
+ );
+ /* use check_iscallable_objects() to check whether given object/string
+ has valid method name */
+ check_iscallable_objects($methods);
+ $loop_counter++;
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_callable() on objects ***
+
+** Testing behavior of is_callable() on static methods **
+bool(true)
+bool(false)
+
+** Testing normal operations of is_callable() on objects **
+--- Outerloop iteration 1 ---
+-- Innerloop iteration 1 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo2
+bool(false)
+object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo3
+bool(false)
+object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::x123
+bool(true)
+object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::null
+bool(true)
+object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::TRUE
+bool(true)
+object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::123
+bool(false)
+object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 1 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::func
+bool(false)
+object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 2 ---
+-- Innerloop iteration 1 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo1
+bool(false)
+no_member_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo2
+bool(false)
+no_member_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo3
+bool(false)
+no_member_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::x123
+bool(false)
+no_member_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::null
+bool(false)
+no_member_class::null
+-- Innerloop iteration 6 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::TRUE
+bool(false)
+no_member_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::123
+bool(false)
+no_member_class::123
+-- Innerloop iteration 8 of Outerloop iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 2 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::func
+bool(false)
+no_member_class::func
+-- Innerloop iteration 10 of Outerloop iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 3 ---
+-- Innerloop iteration 1 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo1
+bool(false)
+contains_object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo2
+bool(false)
+contains_object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo3
+bool(false)
+contains_object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::x123
+bool(false)
+contains_object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::null
+bool(false)
+contains_object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::TRUE
+bool(false)
+contains_object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 3 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::123
+bool(false)
+contains_object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+contains_object_class::func
+bool(true)
+contains_object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 4 ---
+-- Innerloop iteration 1 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo1
+bool(false)
+contains_object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo2
+bool(false)
+contains_object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::foo3
+bool(false)
+contains_object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::x123
+bool(false)
+contains_object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::null
+bool(false)
+contains_object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::TRUE
+bool(false)
+contains_object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 4 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+contains_object_class::123
+bool(false)
+contains_object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+contains_object_class::func
+bool(true)
+contains_object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 5 ---
+-- Innerloop iteration 1 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo2
+bool(false)
+object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo3
+bool(false)
+object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::x123
+bool(true)
+object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::null
+bool(true)
+object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::TRUE
+bool(true)
+object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::123
+bool(false)
+object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 5 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::func
+bool(false)
+object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 6 ---
+-- Innerloop iteration 1 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo1
+bool(false)
+no_member_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo2
+bool(false)
+no_member_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::foo3
+bool(false)
+no_member_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::x123
+bool(false)
+no_member_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::null
+bool(false)
+no_member_class::null
+-- Innerloop iteration 6 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::TRUE
+bool(false)
+no_member_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::123
+bool(false)
+no_member_class::123
+-- Innerloop iteration 8 of Outerloop iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 6 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+no_member_class::func
+bool(false)
+no_member_class::func
+-- Innerloop iteration 10 of Outerloop iteration 6 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 7 ---
+-- Innerloop iteration 1 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+-- Innerloop iteration 2 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo2
+bool(false)
+object_class::foo2
+-- Innerloop iteration 3 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::foo3
+bool(false)
+object_class::foo3
+-- Innerloop iteration 4 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::x123
+bool(true)
+object_class::x123
+-- Innerloop iteration 5 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::null
+bool(true)
+object_class::null
+-- Innerloop iteration 6 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::TRUE
+bool(true)
+object_class::TRUE
+-- Innerloop iteration 7 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::123
+bool(false)
+object_class::123
+-- Innerloop iteration 8 of Outerloop iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 7 --
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+object_class::func
+bool(false)
+object_class::func
+-- Innerloop iteration 10 of Outerloop iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+--- Outerloop iteration 8 ---
+-- Innerloop iteration 1 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 2 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 3 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 4 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 5 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 6 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 7 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 8 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 9 of Outerloop iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+Array
+-- Innerloop iteration 10 of Outerloop iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+object_class::foo1
+bool(true)
+object_class::foo1
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_callable_error.phpt b/ext/standard/tests/general_functions/is_callable_error.phpt
new file mode 100644
index 0000000..ac23b8a
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test is_callable() function
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing is_callable() function with less than expected no. of arguments --\n";
+var_dump( is_callable() );
+
+echo "\n-- Testing is_callable() function with more than expected no. of arguments --\n";
+var_dump( is_callable("string", TRUE, $callable_name, "EXTRA") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing error conditions ***
+
+-- Testing is_callable() function with less than expected no. of arguments --
+
+Warning: is_callable() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing is_callable() function with more than expected no. of arguments --
+
+Warning: is_callable() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_callable_variation1.phpt b/ext/standard/tests/general_functions/is_callable_variation1.phpt
new file mode 100644
index 0000000..cfc14bb
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_variation1.phpt
@@ -0,0 +1,208 @@
+--TEST--
+Test is_callable() function : usage variations - undefined functions
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+/* Prototype: void check_iscallable( $functions );
+ Description: use iscallable() on given string to check for valid function name
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable( $functions ) {
+ $counter = 1;
+ foreach($functions as $func) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_callable($func) ); //given only $var argument
+ var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, TRUE, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, FALSE, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on undefined functions ***\n";
+$undef_functions = array (
+ "", //empty string
+ '',
+ " ", //string with a space
+ ' ',
+ "12356",
+ "\0",
+ '\0',
+ "hello world",
+ 'hello world',
+ "welcome\0",
+ 'welcome\0',
+ "==%%%***$$$@@@!!",
+ "false",
+ "\070",
+ '\t', //escape character
+ '\007',
+ '123',
+ 'echo()'
+);
+
+/* use check_iscallable() to check whether given string is valid function name
+ * expected: true with $syntax = TRUE
+ * false with $syntax = FALSE
+ */
+check_iscallable($undef_functions);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_callable() on undefined functions ***
+-- Iteration 1 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+bool(true)
+bool(true)
+12356
+bool(false)
+bool(false)
+12356
+-- Iteration 6 --
+bool(false)
+bool(true)
+bool(true)
+
+bool(false)
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+bool(true)
+bool(true)
+\0
+bool(false)
+bool(false)
+\0
+-- Iteration 8 --
+bool(false)
+bool(true)
+bool(true)
+hello world
+bool(false)
+bool(false)
+hello world
+-- Iteration 9 --
+bool(false)
+bool(true)
+bool(true)
+hello world
+bool(false)
+bool(false)
+hello world
+-- Iteration 10 --
+bool(false)
+bool(true)
+bool(true)
+welcome
+bool(false)
+bool(false)
+welcome
+-- Iteration 11 --
+bool(false)
+bool(true)
+bool(true)
+welcome\0
+bool(false)
+bool(false)
+welcome\0
+-- Iteration 12 --
+bool(false)
+bool(true)
+bool(true)
+==%%%***$$$@@@!!
+bool(false)
+bool(false)
+==%%%***$$$@@@!!
+-- Iteration 13 --
+bool(false)
+bool(true)
+bool(true)
+false
+bool(false)
+bool(false)
+false
+-- Iteration 14 --
+bool(false)
+bool(true)
+bool(true)
+8
+bool(false)
+bool(false)
+8
+-- Iteration 15 --
+bool(false)
+bool(true)
+bool(true)
+\t
+bool(false)
+bool(false)
+\t
+-- Iteration 16 --
+bool(false)
+bool(true)
+bool(true)
+\007
+bool(false)
+bool(false)
+\007
+-- Iteration 17 --
+bool(false)
+bool(true)
+bool(true)
+123
+bool(false)
+bool(false)
+123
+-- Iteration 18 --
+bool(false)
+bool(true)
+bool(true)
+echo()
+bool(false)
+bool(false)
+echo()
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_callable_variation2.phpt b/ext/standard/tests/general_functions/is_callable_variation2.phpt
new file mode 100644
index 0000000..b94a446
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_callable_variation2.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Test is_callable() function : usage variations - on invalid function names
+--INI--
+precision=14
+error_reporting = E_ALL & ~E_NOTICE | E_STRICT
+--FILE--
+<?php
+/* Prototype: bool is_callable ( mixed $var [, bool $syntax_only [, string &$callable_name]] );
+ Description: Verify that the contents of a variable can be called as a function
+ In case of objects, $var = array($SomeObject, 'MethodName')
+*/
+
+/* Prototype: void check_iscallable( $functions );
+ Description: use iscallable() on given string to check for valid function name
+ returns true if valid function name, false otherwise
+*/
+function check_iscallable( $functions ) {
+ $counter = 1;
+ foreach($functions as $func) {
+ echo "-- Iteration $counter --\n";
+ var_dump( is_callable($func) ); //given only $var argument
+ var_dump( is_callable($func, TRUE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, TRUE, $callable_name) );
+ echo $callable_name, "\n";
+ var_dump( is_callable($func, FALSE) ); //given $var and $syntax argument
+ var_dump( is_callable($func, FALSE, $callable_name) );
+ echo $callable_name, "\n";
+ $counter++;
+ }
+}
+
+echo "\n*** Testing is_callable() on invalid function names ***\n";
+/* check on unset variables */
+$unset_var = 10;
+unset ($unset_var);
+
+/* opening file resource type */
+$file_handle = fopen (__FILE__, "r");
+
+$variants = array (
+ NULL, // NULL as argument
+ 0, // zero as argument
+ 1234567890, // positive value
+ -100123456782, // negative value
+ -2.000000, // negative float value
+ .567, // positive float value
+ FALSE, // boolean value
+ array(1, 2, 3), // array
+ @$unset_var,
+ @$undef_var, //undefined variable
+ $file_handle
+);
+
+/* use check_iscallable() to check whether given variable is valid function name
+ * expected: false
+ */
+check_iscallable($variants);
+
+/* closing resources used */
+fclose($file_handle);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_callable() on invalid function names ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+0
+bool(false)
+bool(false)
+0
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+1234567890
+bool(false)
+bool(false)
+1234567890
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+-100123456782
+bool(false)
+bool(false)
+-100123456782
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-2
+bool(false)
+bool(false)
+-2
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+0.567
+bool(false)
+bool(false)
+0.567
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+Array
+bool(false)
+bool(false)
+Array
+-- Iteration 9 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+bool(false)
+bool(false)
+
+bool(false)
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+bool(false)
+bool(false)
+Resource id #%d
+bool(false)
+bool(false)
+Resource id #%d
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt
new file mode 100644
index 0000000..f6bbdaa
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_float.phpt
@@ -0,0 +1,440 @@
+--TEST--
+Test is_float() & it's FALIASes: is_double() & is_real() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: bool is_float ( mixed $var );
+ * Description: Finds whether the given variable is a float
+ */
+
+echo "*** Testing is_float(), is_double() and is_real() with float values***\n";
+// different valid float vlaues
+$floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+/* loop to check that is_float(), is_double() & is_real() recognizes
+ different float values, expected: bool(true) */
+$loop_counter = 1;
+foreach ($floats as $float ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_float($float) );
+ var_dump( is_double($float) );
+ var_dump( is_real($float) );
+}
+
+echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ var $array = array(10.5);
+};
+$object = new foo();
+
+$not_floats = array (
+ new foo, //object
+ $object,
+
+ $fp, // resource
+ $dfp,
+
+ array(), // arrays
+ array(NULL),
+ array(0.5e10),
+ array(1,2,3,4),
+ array("string"),
+
+ NULL, // nulls
+ null,
+
+ true, // boolean
+ TRUE,
+ false,
+ FALSE,
+
+ "", // strings
+ '',
+ "0",
+ '0',
+ "0.0",
+ '0.0',
+ '0.5',
+ "-0.5",
+ "1e5",
+ '1e5',
+ '1.5e6_string',
+ "1.5e6_string",
+
+ 1, // integers, hex and octal
+ -1,
+ 0,
+ 12345,
+ 0xFF55,
+ -0x673,
+ 0123,
+ -0123,
+
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_floats to see working of
+ is_float(), is_double() & is_real() on objects,
+ arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_floats as $value ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_float($value) );
+ var_dump( is_double($value) );
+ var_dump( is_real($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_float() );
+var_dump( is_double() );
+var_dump( is_real() );
+
+//arguments more than expected
+var_dump( is_float( $floats[0], $floats[1]) );
+var_dump( is_double( $floats[0], $floats[1]) );
+var_dump( is_real( $floats[0], $floats[1]) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_float(), is_double() and is_real() with float values***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 28 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 29 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_float(), is_double() & is_real() with non float values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt
new file mode 100644
index 0000000..05dd1c3
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_float_64bit.phpt
@@ -0,0 +1,437 @@
+--TEST--
+Test is_float() & it's FALIASes: is_double() & is_real() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool is_float ( mixed $var );
+ * Description: Finds whether the given variable is a float
+ */
+
+echo "*** Testing is_float(), is_double() and is_real() with float values***\n";
+// different valid float vlaues
+$floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ .5e+7,
+ -.5e+7,
+ .6e-19,
+ -.6e-19,
+ .05E+44,
+ -.05E+44,
+ .0034E-30,
+ -.0034E-30
+);
+/* loop to check that is_float(), is_double() & is_real() recognizes
+ different float values, expected: bool(true) */
+$loop_counter = 1;
+foreach ($floats as $float ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_float($float) );
+ var_dump( is_double($float) );
+ var_dump( is_real($float) );
+}
+
+echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n";
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ var $array = array(10.5);
+};
+$object = new foo();
+
+$not_floats = array (
+ new foo, //object
+ $object,
+
+ $fp, // resource
+ $dfp,
+
+ array(), // arrays
+ array(NULL),
+ array(0.5e10),
+ array(1,2,3,4),
+ array("string"),
+
+ NULL, // nulls
+ null,
+
+ true, // boolean
+ TRUE,
+ false,
+ FALSE,
+
+ "", // strings
+ '',
+ "0",
+ '0',
+ "0.0",
+ '0.0',
+ '0.5',
+ "-0.5",
+ "1e5",
+ '1e5',
+ '1.5e6_string',
+ "1.5e6_string",
+
+ 1, // integers, hex and octal
+ -1,
+ 0,
+ 12345,
+ 0xFF55,
+ -0x673,
+ 0123,
+ -0123,
+
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_floats to see working of
+ is_float(), is_double() & is_real() on objects,
+ arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_floats as $value ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_float($value) );
+ var_dump( is_double($value) );
+ var_dump( is_real($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_float() );
+var_dump( is_double() );
+var_dump( is_real() );
+
+//arguments more than expected
+var_dump( is_float( $floats[0], $floats[1]) );
+var_dump( is_double( $floats[0], $floats[1]) );
+var_dump( is_real( $floats[0], $floats[1]) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_float(), is_double() and is_real() with float values***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 13 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 24 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 25 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 26 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 27 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 28 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 29 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_float(), is_double() & is_real() with non float values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt
new file mode 100644
index 0000000..7cc3f3b
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_int.phpt
@@ -0,0 +1,465 @@
+--TEST--
+Test is_int() & it's FALIASes: is_long() & is_integer() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: bool is_int ( mixed $var );
+ * Description: Finds whether the given variable is an integer
+ */
+
+echo "*** Testing is_int(), is_integer() & is_long() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+);
+/* loop to check that is_int() recognizes different
+ integer values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_ints as $int_val ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($int_val) );
+ var_dump( is_integer($int_val) );
+ var_dump( is_long($int_val) );
+}
+
+echo "\n*** Testing is_int(), is_integer() & is_long() with non integer values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_int_types to see working of
+ is_int() on non integer types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_int_types as $type ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($type) );
+ var_dump( is_integer($type) );
+ var_dump( is_long($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_int() );
+var_dump( is_integer() );
+var_dump( is_long() );
+
+//arguments more than expected
+var_dump( is_int(TRUE, FALSE) );
+var_dump( is_integer(TRUE, FALSE) );
+var_dump( is_long(TRUE, FALSE) );
+
+echo "Done\n";
+
+// close the resources
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_int(), is_integer() & is_long() with valid integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 8--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 9--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 10--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 11--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 14--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 15--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 16--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_int(), is_integer() & is_long() with non integer values ***
+--Iteration 1--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 2--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 3--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 4--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 5--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 6--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 38--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 39--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 40--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 41--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 42--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 43--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 44--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 45--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 46--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 47--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 48--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 49--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 50--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 51--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 52--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 53--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 54--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt
new file mode 100644
index 0000000..9de376e
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_int_64bit.phpt
@@ -0,0 +1,462 @@
+--TEST--
+Test is_int() & it's FALIASes: is_long() & is_integer() functions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool is_int ( mixed $var );
+ * Description: Finds whether the given variable is an integer
+ */
+
+echo "*** Testing is_int(), is_integer() & is_long() with valid integer values ***\n";
+// different valid integer vlaues
+$valid_ints = array(
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+);
+/* loop to check that is_int() recognizes different
+ integer values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_ints as $int_val ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($int_val) );
+ var_dump( is_integer($int_val) );
+ var_dump( is_long($int_val) );
+}
+
+echo "\n*** Testing is_int(), is_integer() & is_long() with non integer values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+// unset variable
+
+$unset_var = 10;
+unset ($unset_var);
+
+// other types in a array
+$not_int_types = array (
+ /* float values */
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+
+ /* booleans */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* undefined and unset vars */
+ @$unset_var,
+ @$undefined_var
+);
+/* loop through the $not_int_types to see working of
+ is_int() on non integer types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_int_types as $type ) {
+ echo "--Iteration $loop_counter--\n"; $loop_counter++;
+ var_dump( is_int($type) );
+ var_dump( is_integer($type) );
+ var_dump( is_long($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_int() );
+var_dump( is_integer() );
+var_dump( is_long() );
+
+//arguments more than expected
+var_dump( is_int(TRUE, FALSE) );
+var_dump( is_integer(TRUE, FALSE) );
+var_dump( is_long(TRUE, FALSE) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing is_int(), is_integer() & is_long() with valid integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 8--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 9--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 10--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 11--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 12--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 13--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 14--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 15--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 16--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 17--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 18--
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing is_int(), is_integer() & is_long() with non integer values ***
+--Iteration 1--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 2--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 3--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 4--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 5--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 6--
+bool(true)
+bool(true)
+bool(true)
+--Iteration 7--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 8--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 9--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 10--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 11--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 12--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 13--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 14--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 15--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 16--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 17--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 18--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 19--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 20--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 21--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 22--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 23--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 24--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 25--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 26--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 27--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 28--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 29--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 30--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 31--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 32--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 33--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 34--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 35--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 36--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 37--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 38--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 39--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 40--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 41--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 42--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 43--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 44--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 45--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 46--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 47--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 48--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 49--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 50--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 51--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 52--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 53--
+bool(false)
+bool(false)
+bool(false)
+--Iteration 54--
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt
new file mode 100644
index 0000000..b01b195
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_null.phpt
@@ -0,0 +1,296 @@
+--TEST--
+Test is_null() function
+--FILE--
+<?php
+/* Prototype: bool is_null ( mixed $var );
+ * Description: Finds whether the given variable is NULL
+ */
+
+echo "*** Testing is_null() with valid null values ***\n";
+// different valid null vlaues
+$unset_array = array();
+$unset_int = 10;
+$unset_float = 10.5;
+$unset_bool = true;
+$unset_object = new stdclass;
+$unset_resource = fopen(__FILE__, "r");
+// unset them to make it null.
+unset ($unset_array, $unset_int, $unset_float, $unset_bool, $unset_object, $unset_resource);
+$null_var1 = NULL;
+$null_var2 = null;
+
+$valid_nulls = array(
+ NULL,
+ null,
+ @$null_var1,
+ @$null_var2,
+ @$unset_array,
+ @$unset_int,
+ @$unset_float,
+ @$unset_bool,
+ @$unset_object,
+ @$unset_resource,
+ @$undefined_var,
+);
+/* loop to check that is_null() recognizes different
+ null values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_nulls as $null_val ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_null($null_val) );
+}
+
+echo "\n*** Testing is_bool() on non null values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// other types in a array
+$not_null_types = array (
+/* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* strings */
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ 'string',
+ "string",
+ "true",
+ "false",
+ "FALSE",
+ "TRUE",
+ 'true',
+ 'false',
+ 'FALSE',
+ 'TRUE',
+ "NULL",
+ "null",
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+);
+/* loop through the $not_null_types to see working of
+ is_null() on non null types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_null_types as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_null($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_null() );
+
+//arguments more than expected
+var_dump( is_null(NULL, null) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_null() with valid null values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+
+*** Testing is_bool() on non null values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+-- Iteration 46 --
+bool(false)
+-- Iteration 47 --
+bool(false)
+-- Iteration 48 --
+bool(false)
+-- Iteration 49 --
+bool(false)
+-- Iteration 50 --
+bool(false)
+-- Iteration 51 --
+bool(false)
+-- Iteration 52 --
+bool(false)
+-- Iteration 53 --
+bool(false)
+-- Iteration 54 --
+bool(false)
+-- Iteration 55 --
+bool(false)
+-- Iteration 56 --
+bool(false)
+-- Iteration 57 --
+bool(false)
+-- Iteration 58 --
+bool(false)
+-- Iteration 59 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt
new file mode 100644
index 0000000..e6edffd
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_numeric.phpt
@@ -0,0 +1,387 @@
+--TEST--
+Test is_numeric() function
+--FILE--
+<?php
+/* Prototype: bool is_numeric ( mixed $var );
+ * Description: Finds whether a variable is a number or a numeric string
+ */
+
+echo "*** Testing is_numeric() with valid numeric values ***\n";
+// different valid numeric vlaues
+$numerics = array(
+ 0,
+ 1,
+ -1,
+ -0,
+ +0,
+ 0.0,
+ -0.0,
+ +0.0,
+ 1.0,
+ -1.0,
+ +1.0,
+ .5,
+ -.5,
+ +.5,
+ -.5e-2,
+ .5e-2,
+ +.5e-2,
+ +.5E+2,
+ 0.70000000,
+ +0.70000000,
+ -0.70000000,
+ 1234567890123456,
+ -1234567890123456,
+ 984847472827282718178,
+ -984847472827282718178,
+ 123.56e30,
+ 123.56E30,
+ 426.45e-30,
+ 5657.3E-40,
+ 3486.36e+40,
+ 3486.36E+90,
+ -3486.36E+10,
+ -3486.36e+80,
+ -426.45e-50,
+ -426.45E-99,
+ 1e2,
+ -1e2,
+ -1e-2,
+ +1e2,
+ +1e+2,
+ +1e-2,
+ +1e+2,
+ 2245555555555555.444,
+ 1.444444444444444444,
+ 0xff, // hexa decimal numbers
+ 0xFF,
+ //0x1111111111111111111111,
+ -0x1111111,
+ +0x6698319,
+ 01000000000000000000000,
+ 0123,
+ 0345900,
+ -0200001,
+ -0200001.7,
+ 0200001.7,
+ +0200001,
+ +0200001.7,
+ +0200001.7,
+ 2.00000000000000000000001, // a float value with more precision points
+ "1", // numeric in the form of string
+ "-1",
+ "1e2",
+ " 1",
+ "2974394749328742328432",
+ "-1e-2",
+ '1',
+ '-1',
+ '1e2',
+ ' 1',
+ '2974394749328742328432',
+ '-1e-2',
+ "0xff",
+ '0xff',
+ "0123",
+ '0123',
+ "-0123",
+ "+0123",
+ '-0123',
+ '+0123'
+);
+/* loop to check that is_numeric() recognizes different
+ numeric values, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($numerics as $num ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_numeric($num) );
+}
+
+echo "\n*** Testing is_numeric() on non numeric types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10.5;
+unset ($unset_var);
+
+// other types in a array
+$not_numerics = array(
+ "-0x80001",
+ "+0x80001",
+ "-0x80001.5",
+ "0x80001.5",
+ new stdclass, // object
+ $fp, // resource
+ $dfp,
+ array(),
+ array("string"),
+ "",
+ "1 ",
+ "- 1",
+ "1.2.4",
+ "1e7.6",
+ "3FF",
+ "20 test",
+ "3.6test",
+ "1,000",
+ "NULL",
+ "true",
+ true,
+ NULL,
+ null,
+ TRUE,
+ FALSE,
+ false,
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_numerics to see working of
+ is_numeric() on non numeric values, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_numerics as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_numeric($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_numeric() );
+
+//arguments more than expected
+var_dump( is_numeric("10", "20") );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_numeric() with valid numeric values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+-- Iteration 23 --
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+-- Iteration 26 --
+bool(true)
+-- Iteration 27 --
+bool(true)
+-- Iteration 28 --
+bool(true)
+-- Iteration 29 --
+bool(true)
+-- Iteration 30 --
+bool(true)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(true)
+-- Iteration 33 --
+bool(true)
+-- Iteration 34 --
+bool(true)
+-- Iteration 35 --
+bool(true)
+-- Iteration 36 --
+bool(true)
+-- Iteration 37 --
+bool(true)
+-- Iteration 38 --
+bool(true)
+-- Iteration 39 --
+bool(true)
+-- Iteration 40 --
+bool(true)
+-- Iteration 41 --
+bool(true)
+-- Iteration 42 --
+bool(true)
+-- Iteration 43 --
+bool(true)
+-- Iteration 44 --
+bool(true)
+-- Iteration 45 --
+bool(true)
+-- Iteration 46 --
+bool(true)
+-- Iteration 47 --
+bool(true)
+-- Iteration 48 --
+bool(true)
+-- Iteration 49 --
+bool(true)
+-- Iteration 50 --
+bool(true)
+-- Iteration 51 --
+bool(true)
+-- Iteration 52 --
+bool(true)
+-- Iteration 53 --
+bool(true)
+-- Iteration 54 --
+bool(true)
+-- Iteration 55 --
+bool(true)
+-- Iteration 56 --
+bool(true)
+-- Iteration 57 --
+bool(true)
+-- Iteration 58 --
+bool(true)
+-- Iteration 59 --
+bool(true)
+-- Iteration 60 --
+bool(true)
+-- Iteration 61 --
+bool(true)
+-- Iteration 62 --
+bool(true)
+-- Iteration 63 --
+bool(true)
+-- Iteration 64 --
+bool(true)
+-- Iteration 65 --
+bool(true)
+-- Iteration 66 --
+bool(true)
+-- Iteration 67 --
+bool(true)
+-- Iteration 68 --
+bool(true)
+-- Iteration 69 --
+bool(true)
+-- Iteration 70 --
+bool(true)
+-- Iteration 71 --
+bool(true)
+-- Iteration 72 --
+bool(true)
+-- Iteration 73 --
+bool(true)
+-- Iteration 74 --
+bool(true)
+-- Iteration 75 --
+bool(true)
+-- Iteration 76 --
+bool(true)
+-- Iteration 77 --
+bool(true)
+-- Iteration 78 --
+bool(true)
+
+*** Testing is_numeric() on non numeric types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt
new file mode 100644
index 0000000..33fd422
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_object.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test is_object() function
+--FILE--
+<?php
+/* Prototype: bool is_object ( mixed $var );
+ * Description: Finds whether the given variable is an object
+ */
+
+echo "*** Testing is_object() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface IValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+
+// implement the interface
+class Value implements IValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_dump ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ new stdclass,
+ new foo,
+ new concreteClass,
+ new Value,
+ new myClass,
+ $myClass_object,
+ $myClass_object->foo_object,
+ $myClass_object->public_var1,
+ $foo_object,
+ $Value_object,
+ $concreteClass_object
+);
+
+/* loop to check that is_object() recognizes different
+ objects, expected output: bool(true) */
+$loop_counter = 1;
+foreach ($valid_objects as $object ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_object($object) );
+}
+
+echo "\n*** Testing is_object() on non object types ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset object
+$unset_object = new foo();
+unset ($unset_object);
+
+// other types in a array
+$not_objects = array (
+ 0,
+ -1,
+ 0.1,
+ -10.0000000000000000005,
+ 10.5e+5,
+ 0xFF,
+ 0123,
+ $fp, // resource
+ $dfp,
+ array(),
+ array("string"),
+ "0",
+ "1",
+ "",
+ true,
+ NULL,
+ null,
+ @$unset_object, // unset object
+ @$undefined_var, // undefined variable
+);
+/* loop through the $not_objects to see working of
+ is_object() on non object types, expected output: bool(false) */
+$loop_counter = 1;
+foreach ($not_objects as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_object($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_object() );
+
+//arguments more than expected
+var_dump( is_object($myClass_object, $myClass_object) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_object() with valid objects ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+
+*** Testing is_object() on non object types ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt
new file mode 100644
index 0000000..2717e3f
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_resource.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #27822 (is_resource() returns TRUE for closed resources)
+--FILE--
+<?php
+ $f = fopen(__FILE__, 'r');
+ fclose($f);
+ var_dump(is_resource($f));
+?>
+--EXPECT--
+bool(false)
diff --git a/ext/standard/tests/general_functions/is_resource_basic.phpt b/ext/standard/tests/general_functions/is_resource_basic.phpt
new file mode 100644
index 0000000..27583d3
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_resource_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test is_resource() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool is_resource ( mixed $var )
+ * Description: Finds whether a variable is a resource
+ * Source code: ext/standard/type.c
+ */
+
+echo "*** Testing is_resource() : basic functionality ***\n";
+
+class Hello {
+ public function SayHello($arg) {
+ echo "Hello\n";
+ }
+}
+
+
+$vars = array(
+ false,
+ true,
+ 10,
+ 10.5,
+ "Helo World",
+ array(1,2,3,4,5),
+ NULL,
+ new Hello());
+
+$types = array(
+ "bool=false",
+ "bool=true",
+ "integer",
+ "double",
+ "string",
+ "array",
+ "NULL",
+ "object");
+
+echo "\nNon-resource type cases\n";
+
+for ($i=0; $i < count($vars); $i++) {
+ if (is_resource($vars[$i])) {
+ echo $types[$i]. " test returns TRUE\n";
+ } else {
+ echo $types[$i]. " test returns FALSE\n";
+ }
+}
+
+$res = fopen(__FILE__, "r");
+echo "\nResource type..var_dump after file open returns\n";
+var_dump($res);
+echo "Resource type..after file open is_resource() returns";
+if (is_resource($res)) {
+ echo " TRUE\n";
+} else {
+ echo " FALSE\n";
+}
+
+fclose($res);
+echo "\nResource type..var_dump after file close returns\n";
+var_dump($res);
+echo "Resource type..after file close is_resource() returns";
+if (is_resource($res)) {
+ echo " TRUE\n";
+} else {
+ echo " FALSE\n";
+}
+
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_resource() : basic functionality ***
+
+Non-resource type cases
+bool=false test returns FALSE
+bool=true test returns FALSE
+integer test returns FALSE
+double test returns FALSE
+string test returns FALSE
+array test returns FALSE
+NULL test returns FALSE
+object test returns FALSE
+
+Resource type..var_dump after file open returns
+resource(%d) of type (%s)
+Resource type..after file open is_resource() returns TRUE
+
+Resource type..var_dump after file close returns
+resource(%d) of type (Unknown)
+Resource type..after file close is_resource() returns FALSE
+===DONE===
diff --git a/ext/standard/tests/general_functions/is_resource_error.phpt b/ext/standard/tests/general_functions/is_resource_error.phpt
new file mode 100644
index 0000000..acb3cb6
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_resource_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test is_resource() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool is_resource ( mixed $var )
+ * Description: Finds whether a variable is a resource
+ * Source code: ext/standard/type.c
+ */
+
+echo "*** Testing is_resource() : error conditions ***\n";
+
+echo "\n-- Testing is_resource() function with Zero arguments --\n";
+var_dump( is_resource() );
+
+echo "\n-- Testing is_resource() function with more than expected no. of arguments --\n";
+$res = fopen(__FILE__, "r");
+$extra_arg = 10;
+var_dump( is_resource($res, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing is_resource() : error conditions ***
+
+-- Testing is_resource() function with Zero arguments --
+
+Warning: is_resource() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing is_resource() function with more than expected no. of arguments --
+
+Warning: is_resource() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt
new file mode 100644
index 0000000..d3e2fa5
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_scalar.phpt
@@ -0,0 +1,240 @@
+--TEST--
+Test is_scalar() function
+--FILE--
+<?php
+/* Prototype: bool is_scalar ( mixed $var );
+ * Description: Finds whether a variable is a scalar (i.e integer, float, string or boolean)
+ */
+
+echo "*** Testing basic operations ***\n";
+$scalar_variables = array(
+ 0, // integers
+ 1,
+ -45678,
+ 0x5FF, // hexadecimal as integer
+ 0X566,
+ -0xAAF,
+ -0XCCF,
+ 01234, // octal as integer
+ -0126,
+
+ 0.0, // floats
+ -1.0,
+ 1e5,
+ -1e7,
+ 1.6E7,
+ 475.e-8,
+ 784.e+30,
+ 98.45E+40,
+ .5E-40,
+
+ "", // strings
+ '',
+ " ",
+ ' ',
+ "string",
+ 'string',
+ "0", // numeric as string
+ "40",
+ "50.696",
+ "0x534",
+ "0X534",
+
+ TRUE, // boolean
+ FALSE,
+ true,
+ false
+);
+/* loop through each valid scalar variables in $scalar_variables
+ and see the working of is_scalar(), expected output: bool(true)
+*/
+$loop_counter = 1;
+foreach($scalar_variables as $scalar) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_scalar($scalar) );
+}
+
+echo "\n*** Testing possible variations ***\n";
+// different scalar variables which are unset
+$int_var = 10;
+$float_var = 1e5;
+$string_var = "string";
+$boolean_var = true;
+$object = new stdclass;
+$array = array(10);
+$resource = opendir('.');
+unset($int_var, $float_var, $string_var, $boolean_var, $object, $array, $resource);
+
+// resources
+$fp = fopen(__FILE__, "r");
+$dfp = opendir(".");
+
+$variation_array = array(
+ NULL,
+ null,
+
+ array(), // arrays
+ array(NULL),
+ array(true),
+ array(0),
+ array(1,2,3,4),
+
+ $fp, // resources
+ $dfp,
+
+ new stdclass, // object
+
+ @$int_var, // scalars that are unset
+ @$float_var,
+ @$string_var,
+ @$boolean_var,
+
+ @$array, // non scalars that are unset
+ @$object,
+ @$resource,
+
+ @$undefined_var // undefined variable
+);
+
+/* loop through each element of $variation_array to see the
+ working of is_scalar on non-scalar values, expected output: bool(false)
+*/
+$loop_counter = 1;
+foreach( $variation_array as $value ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_scalar($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+// Zero arguments
+var_dump( is_scalar() );
+
+// Arguments more than expected
+var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) );
+var_dump( is_scalar( new stdclass, new stdclass) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing basic operations ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+-- Iteration 23 --
+bool(true)
+-- Iteration 24 --
+bool(true)
+-- Iteration 25 --
+bool(true)
+-- Iteration 26 --
+bool(true)
+-- Iteration 27 --
+bool(true)
+-- Iteration 28 --
+bool(true)
+-- Iteration 29 --
+bool(true)
+-- Iteration 30 --
+bool(true)
+-- Iteration 31 --
+bool(true)
+-- Iteration 32 --
+bool(true)
+-- Iteration 33 --
+bool(true)
+
+*** Testing possible variations ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt
new file mode 100644
index 0000000..b8c82b1
--- /dev/null
+++ b/ext/standard/tests/general_functions/is_string.phpt
@@ -0,0 +1,303 @@
+--TEST--
+Test is_string() function
+--FILE--
+<?php
+/* Prototype: bool is_string ( mixed $var );
+ * Description: Finds whether the given variable is a string
+ */
+
+echo "*** Testing is_string() with valid string values ***\n";
+// different valid strings
+
+/* string created using Heredoc (<<<) */
+$heredoc_string = <<<EOT
+This is string defined
+using heredoc.
+EOT;
+/* heredoc string with only numerics */
+$heredoc_numeric_string = <<<EOT
+123456 3993
+4849 string
+EOT;
+/* null heardoc string */
+$heredoc_empty_string = <<<EOT
+EOT;
+$heredoc_null_string = <<<EOT
+NULL
+EOT;
+
+$strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'true',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070",
+ "0x55F",
+ "055",
+ "@#$#$%%$^^$%^%^$^&",
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string,
+ $heredoc_null_string
+);
+/* loop to check that is_string() recognizes different
+ strings, expected output bool(true) */
+$loop_counter = 1;
+foreach ($strings as $string ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_string($string) );
+}
+
+echo "\n*** Testing is_string() on non string values ***\n";
+
+// get a resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// unset vars
+$unset_string1 = "string";
+$unset_string2 = 'string';
+$unset_heredoc = <<<EOT
+this is heredoc string
+EOT;
+// unset the vars
+unset($unset_string1, $unset_string2, $unset_heredoc);
+
+// other types in a array
+$not_strings = array (
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -0,
+ 543915,
+ -5322,
+ 0x0,
+ 0x1,
+ 0x55F,
+ -0xCCF,
+ 0123,
+ -0654,
+ 00,
+ 01,
+
+ /* floats */
+ 0.0,
+ 1.0,
+ -1.0,
+ 10.0000000000000000005,
+ .5e6,
+ -.5E7,
+ .5E+8,
+ -.5e+90,
+ 1e5,
+ -1e5,
+ 1E5,
+ -1E7,
+
+ /* objects */
+ new stdclass,
+
+ /* resources */
+ $fp,
+ $dfp,
+
+ /* arrays */
+ array(),
+ array(0),
+ array(1),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2),
+
+ /* undefined and unset vars */
+ @$unset_string1,
+ @$unset_string2,
+ @$unset_heredoc,
+ @$undefined_var
+);
+/* loop through the $not_strings to see working of
+ is_string() on non string types, expected output bool(false) */
+$loop_counter = 1;
+foreach ($not_strings as $type ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( is_string($type) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( is_string() );
+
+//arguments more than expected
+var_dump( is_string("string", "test") );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing is_string() with valid string values ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(true)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(true)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+-- Iteration 9 --
+bool(true)
+-- Iteration 10 --
+bool(true)
+-- Iteration 11 --
+bool(true)
+-- Iteration 12 --
+bool(true)
+-- Iteration 13 --
+bool(true)
+-- Iteration 14 --
+bool(true)
+-- Iteration 15 --
+bool(true)
+-- Iteration 16 --
+bool(true)
+-- Iteration 17 --
+bool(true)
+-- Iteration 18 --
+bool(true)
+-- Iteration 19 --
+bool(true)
+-- Iteration 20 --
+bool(true)
+-- Iteration 21 --
+bool(true)
+-- Iteration 22 --
+bool(true)
+
+*** Testing is_string() on non string values ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(false)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(false)
+-- Iteration 6 --
+bool(false)
+-- Iteration 7 --
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+bool(false)
+-- Iteration 11 --
+bool(false)
+-- Iteration 12 --
+bool(false)
+-- Iteration 13 --
+bool(false)
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+bool(false)
+-- Iteration 20 --
+bool(false)
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+-- Iteration 27 --
+bool(false)
+-- Iteration 28 --
+bool(false)
+-- Iteration 29 --
+bool(false)
+-- Iteration 30 --
+bool(false)
+-- Iteration 31 --
+bool(false)
+-- Iteration 32 --
+bool(false)
+-- Iteration 33 --
+bool(false)
+-- Iteration 34 --
+bool(false)
+-- Iteration 35 --
+bool(false)
+-- Iteration 36 --
+bool(false)
+-- Iteration 37 --
+bool(false)
+-- Iteration 38 --
+bool(false)
+-- Iteration 39 --
+bool(false)
+-- Iteration 40 --
+bool(false)
+-- Iteration 41 --
+bool(false)
+-- Iteration 42 --
+bool(false)
+-- Iteration 43 --
+bool(false)
+-- Iteration 44 --
+bool(false)
+-- Iteration 45 --
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/isset_basic1.phpt b/ext/standard/tests/general_functions/isset_basic1.phpt
new file mode 100644
index 0000000..4c03210
--- /dev/null
+++ b/ext/standard/tests/general_functions/isset_basic1.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Test isset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] )
+ * Description: Determine if a variable is set and is not NULL
+ */
+
+class foo {}
+
+echo "*** Testing isset() : basic functionality ***\n";
+
+$i = 10;
+$f = 10.5;
+$s = "Hello";
+$a = array(1,2,3,4,5);
+$b = true;
+$n = NULL;
+$obj = new foo;
+$res = fopen(__FILE__, "r");
+
+echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n";
+echo "Float test: " . (isset($f) ? "YES": "NO") . "\n";
+echo "String test: " . (isset($s) ? "YES": "NO") . "\n";
+echo "Array test: " . (isset($a) ? "YES": "NO") . "\n";
+echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n";
+echo "Null test: " . (isset($n) ? "YES": "NO") . "\n";
+echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n";
+echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n";
+
+echo "\n\nUnset the variables\n\n";
+unset($i, $f, $s, $a, $b, $n, $obj, $res);
+
+echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n";
+echo "Float test: " . (isset($f) ? "YES": "NO") . "\n";
+echo "String test: " . (isset($s) ? "YES": "NO") . "\n";
+echo "Array test: " . (isset($a) ? "YES": "NO") . "\n";
+echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n";
+echo "Null test: " . (isset($n) ? "YES": "NO") . "\n";
+echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n";
+echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n";
+?>
+===DONE===
+--EXPECT--
+*** Testing isset() : basic functionality ***
+Integer test: YES
+Float test: YES
+String test: YES
+Array test: YES
+Boolean test: YES
+Null test: NO
+Object test: YES
+Resource test: YES
+
+
+Unset the variables
+
+Integer test: NO
+Float test: NO
+String test: NO
+Array test: NO
+Boolean test: NO
+Null test: NO
+Object test: NO
+Resource test: NO
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/isset_basic2.phpt b/ext/standard/tests/general_functions/isset_basic2.phpt
new file mode 100644
index 0000000..9137aeb
--- /dev/null
+++ b/ext/standard/tests/general_functions/isset_basic2.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test isset() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] )
+ * Description: Determine if a variable is set and is not NULL
+ */
+
+class foo {}
+
+echo "*** Testing isset() : basic functionality ***\n";
+
+$i = 10;
+$f = 10.5;
+$s = "Hello";
+$b = true;
+$n = NULL;
+
+echo "Test multiple scalar variables in a group\n";
+var_dump(isset($i, $f, $s, $b));
+var_dump(isset($i, $f, $s, $b, $n));
+
+echo "Unset a few\n";
+unset($i, $b);
+
+echo "Test again\n";
+var_dump(isset($i, $f, $s, $b));
+
+echo "\n\nArray test:\n";
+$arr = array();
+var_dump(isset($var));
+var_dump(isset($var[1]));
+var_dump(isset($var, $var[1]));
+echo "..now set\n";
+$var[1] = 10;
+var_dump(isset($var));
+var_dump(isset($var[1]));
+var_dump(isset($var, $var[1]));
+
+?>
+===DONE===
+--EXPECT--
+*** Testing isset() : basic functionality ***
+Test multiple scalar variables in a group
+bool(true)
+bool(false)
+Unset a few
+Test again
+bool(false)
+
+
+Array test:
+bool(false)
+bool(false)
+bool(false)
+..now set
+bool(true)
+bool(true)
+bool(true)
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/ob_get_flush_basic.phpt b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
new file mode 100644
index 0000000..dbda1d9
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test ob_get_flush() function : basic functionality
+--INI--
+output_buffering=0
+--FILE--
+<?php
+/* Prototype : bool ob_get_flush(void)
+ * Description: Get current buffer contents, flush (send) the output buffer, and delete current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_get_flush() : basic functionality ***\n";
+
+ob_start();
+
+echo "testing ob_get_flush() with some\nNewlines too\n";
+$string = ob_get_flush();
+
+var_dump( "this is printed before returning the string" );
+var_dump( $string );
+var_dump( ob_list_handlers() );
+
+// Empty string expected
+ob_start();
+$string = ob_get_flush();
+var_dump($string)
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ob_get_flush() : basic functionality ***
+testing ob_get_flush() with some
+Newlines too
+string(43) "this is printed before returning the string"
+string(46) "testing ob_get_flush() with some
+Newlines too
+"
+array(0) {
+}
+string(0) ""
+===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
new file mode 100644
index 0000000..1d35381
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test ob_get_flush() function : error conditions
+--INI--
+output_buffering=0
+--FILE--
+<?php
+/* Prototype : bool ob_get_flush(void)
+ * Description: Get current buffer contents, flush (send) the output buffer, and delete current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_get_flush() : error conditions ***\n";
+
+// One extra argument
+$extra_arg = 10;
+var_dump( ob_get_flush( $extra_arg ) );
+
+// No ob_start() executed
+var_dump( ob_get_flush() );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ob_get_flush() : error conditions ***
+
+Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
new file mode 100644
index 0000000..9b3e8fb
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test ob_get_length() function : basic functionality
+--INI--
+output_buffering=0
+--FILE--
+<?php
+/* Prototype : int ob_get_length(void)
+ * Description: Return the length of the output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+function dump_string_length( $string )
+{
+ ob_start();
+ echo $string;
+ $len = ob_get_length();
+ ob_end_clean();
+ var_dump( $len );
+}
+
+echo "*** Testing ob_get_length() : basic functionality ***\n";
+
+// No buffering active
+var_dump( ob_get_length() );
+
+dump_string_length( 'foo bar length of a string' );
+dump_string_length( 'plus one' );
+dump_string_length( "\0" );
+dump_string_length( ' lsf' );
+dump_string_length( '' );
+dump_string_length( null );
+
+// Extra argument
+var_dump( ob_get_length( 'foobar' ) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing ob_get_length() : basic functionality ***
+bool(false)
+int(26)
+int(8)
+int(1)
+int(15)
+int(0)
+int(0)
+
+Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/ob_start_closures.phpt b/ext/standard/tests/general_functions/ob_start_closures.phpt
new file mode 100644
index 0000000..ba73096
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_start_closures.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ob_start() function : closures as output handlers
+--INI--
+output_buffering=0
+--FILE--
+<?php
+echo "*** Testing ob_start() : closures as output handlers ***\n";
+
+ob_start(function ($output) {
+ return 'Output (1): ' . $output;
+});
+
+ob_start(function ($output) {
+ return 'Output (2): ' . $output;
+});
+
+echo "Test\nWith newlines\n";
+
+$str1 = ob_get_contents ();
+
+ob_end_flush();
+
+$str2 = ob_get_contents ();
+
+ob_end_flush();
+
+echo $str1, $str2;
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ob_start() : closures as output handlers ***
+Output (1): Output (2): Test
+With newlines
+Test
+With newlines
+Output (2): Test
+With newlines
+===DONE===
diff --git a/ext/standard/tests/general_functions/parse_ini_basic.data b/ext/standard/tests/general_functions/parse_ini_basic.data
new file mode 100644
index 0000000..cafbb15
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_basic.data
@@ -0,0 +1,132 @@
+[basic]
+basicval = bar
+longval = 12345
+with.dot = fooobar
+boolon = on
+booltrue = true
+boolyes = yes
+booloff = off
+boolfalse = false
+boolnone = none
+boolno = no
+string = asdadfsdjkslkj ¡@£$$ { }[ ]/%#¤
+sqstring = 'adsasdadasdasd'
+dqstring = "asdadfsdjkslkj ¡@£$$ { } !^~|¥¥{[()/)&/% ¤ # #"
+php_constant = E_WARNING
+user_constant = TEST_CONSTANT
+
+[basic with whitespace]
+basicval = bar
+longval = 12345
+with.dot = fooobar
+boolon = on
+booltrue = true
+boolyes = yes
+booloff = off
+boolfalse = false
+boolnone = none
+boolno = no
+sqstring = 'adsasdadasdasd'
+dqstring = "asdadfsdjkslkj ¡@£$$€¥¥{[()/)&/%#¤"
+php_constant = E_WARNING
+
+[comments]
+; some comment
+ ; some comment with whitespace
+somecomment = comment follows;aaa@bbb ; comment here
+;
+
+[variables]
+var1 = ${basicval}
+var2 = ${basicval}/foo
+var3 = foo/${basicval}
+var4 = foo/${basicval}/foo
+quoted_var1 = "${basicqval}"
+quoted_var2 = "${basicqval}/foo"
+quoted_var3 = "foo/${basicqval}"
+quoted_var4 = "foo/${basicqval}/foo"
+
+[offset values]
+foo1[] = "basic offset 1"
+foo1[ ] = "basic offset 2"
+foo2[123] = "long offset"
+foo3[abc] = "string offset"
+foo4[""] = "quoted offset 1"
+foo4[" "] = "quoted offset 2"
+foo4["sqfoobar"] = "quoted string offset"
+foo4['dqfoobar'] = "single quoted offset"
+foo6[${basicval}] = "variable"
+foo6[${basicval}/foo] = "variable with string 1"
+foo6[foo/${basicval}] = "variable with string 2"
+foo6[foo/${basicval}/foo] = "variable with string 3"
+foo7["${basicqval}"] = "quoted variable 1"
+foo7["${basicqval}/foo"] = "quoted variable 2"
+foo7["foo/${basicqval}"] = "quoted variable 3"
+foo7[ "foo/${basicqval}/foo" ] = "quoted variable 4"
+
+[non value]
+novalue_option1 =
+novalue_option2=
+novalue_option3 =
+novalue_option4=
+novalue_option4[] =
+novalue_option4[]=
+novalue_option4[]=
+
+["Quoted strings and variables in sections"]
+
+[${basicval}]
+[${basicval}/foo]
+[foo/${basicval}]
+[foo/${basicval}/foo]
+
+["${basicqval}"]
+["${basicqval}/foo"]
+["foo/${basicqval}"]
+["foo/${basicqval}/foo"]
+
+[PATH=${basicval}/no/quotes]
+; Invalid!
+;[PATH="${basicval}/path/quoted"]
+["PATH=${basicval}/all/quoted"]
+
+; This is test for bug #29306
+[01]
+e=e
+f=f
+[02]
+g=g
+h=h
+[1]
+a=a
+b=b
+[2]
+c=c
+d=d
+[0815]
+bla=bla
+
+;Test for bug #43923
+[bug #43923]
+curly1 = {
+curly2 = "{"
+curly3 = '{'
+
+;Test for bug #44019
+[bug #44019]
+concatenation_before = TEST_CONSTANT "+some_text_after"
+concatenation_middle = "some_text_before+" TEST_CONSTANT "+some_text_after"
+concatenation_after = "some_text_before+" TEST_CONSTANT
+concatenation_nows_before = TEST_CONSTANT"+some_text_after"
+concatenation_nows_middle = "some_text_before+"TEST_CONSTANT"+some_text_after"
+concatenation_nows_after = "some_text_before+"TEST_CONSTANT
+
+;Test for bug #43915
+[bug #43915]
+ini_with-hyphen = with hyphen and underscore
+ini.with-hyphen = dot and hyphen
+ini-with.hyphen = hyphen and dot
+
+[windows paths]
+winpath1="c:\some windows\path\test\new\r\quote \" here\single ' quote\some more"
+winpath2="special case\"
diff --git a/ext/standard/tests/general_functions/parse_ini_basic.phpt b/ext/standard/tests/general_functions/parse_ini_basic.phpt
new file mode 100644
index 0000000..0c0591e
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_basic.phpt
@@ -0,0 +1,283 @@
+--TEST--
+parse_ini_file() tests
+--ENV--
+basicval=FUBAR_VARIABLE
+basicqval=FUBAR_QUOTES_VARIABLE
+--FILE--
+<?php
+
+$ini_file = dirname(__FILE__)."/parse_ini_basic.data";
+
+define('TEST_CONSTANT', 'this_is_test_constant');
+
+var_dump(parse_ini_file($ini_file, 1));
+
+echo "Done.\n";
+?>
+--EXPECTF--
+array(26) {
+ ["basic"]=>
+ array(15) {
+ ["basicval"]=>
+ string(3) "bar"
+ ["longval"]=>
+ string(5) "12345"
+ ["with.dot"]=>
+ string(7) "fooobar"
+ ["boolon"]=>
+ string(1) "1"
+ ["booltrue"]=>
+ string(1) "1"
+ ["boolyes"]=>
+ string(1) "1"
+ ["booloff"]=>
+ string(0) ""
+ ["boolfalse"]=>
+ string(0) ""
+ ["boolnone"]=>
+ string(0) ""
+ ["boolno"]=>
+ string(0) ""
+ ["string"]=>
+ string(34) "asdadfsdjkslkj ¡@£$$ { }[ ]/%#¤"
+ ["sqstring"]=>
+ string(14) "adsasdadasdasd"
+ ["dqstring"]=>
+ string(51) "asdadfsdjkslkj ¡@£$$ { } !^~|¥¥{[()/)&/% ¤ # #"
+ ["php_constant"]=>
+ string(1) "2"
+ ["user_constant"]=>
+ string(21) "this_is_test_constant"
+ }
+ ["basic with whitespace"]=>
+ array(13) {
+ ["basicval"]=>
+ string(3) "bar"
+ ["longval"]=>
+ string(5) "12345"
+ ["with.dot"]=>
+ string(7) "fooobar"
+ ["boolon"]=>
+ string(1) "1"
+ ["booltrue"]=>
+ string(1) "1"
+ ["boolyes"]=>
+ string(1) "1"
+ ["booloff"]=>
+ string(0) ""
+ ["boolfalse"]=>
+ string(0) ""
+ ["boolnone"]=>
+ string(0) ""
+ ["boolno"]=>
+ string(0) ""
+ ["sqstring"]=>
+ string(14) "adsasdadasdasd"
+ ["dqstring"]=>
+ string(41) "asdadfsdjkslkj ¡@£$$€¥¥{[()/)&/%#¤"
+ ["php_constant"]=>
+ string(1) "2"
+ }
+ ["comments"]=>
+ array(1) {
+ ["somecomment"]=>
+ string(15) "comment follows"
+ }
+ ["variables"]=>
+ array(8) {
+ ["var1"]=>
+ string(14) "FUBAR_VARIABLE"
+ ["var2"]=>
+ string(18) "FUBAR_VARIABLE/foo"
+ ["var3"]=>
+ string(18) "foo/FUBAR_VARIABLE"
+ ["var4"]=>
+ string(22) "foo/FUBAR_VARIABLE/foo"
+ ["quoted_var1"]=>
+ string(21) "FUBAR_QUOTES_VARIABLE"
+ ["quoted_var2"]=>
+ string(25) "FUBAR_QUOTES_VARIABLE/foo"
+ ["quoted_var3"]=>
+ string(25) "foo/FUBAR_QUOTES_VARIABLE"
+ ["quoted_var4"]=>
+ string(29) "foo/FUBAR_QUOTES_VARIABLE/foo"
+ }
+ ["offset values"]=>
+ array(6) {
+ ["foo1"]=>
+ array(2) {
+ [0]=>
+ string(14) "basic offset 1"
+ [1]=>
+ string(14) "basic offset 2"
+ }
+ ["foo2"]=>
+ array(1) {
+ [123]=>
+ string(11) "long offset"
+ }
+ ["foo3"]=>
+ array(1) {
+ ["abc"]=>
+ string(13) "string offset"
+ }
+ ["foo4"]=>
+ array(4) {
+ [0]=>
+ string(15) "quoted offset 1"
+ [" "]=>
+ string(15) "quoted offset 2"
+ ["sqfoobar"]=>
+ string(20) "quoted string offset"
+ ["dqfoobar"]=>
+ string(20) "single quoted offset"
+ }
+ ["foo6"]=>
+ array(4) {
+ ["FUBAR_VARIABLE"]=>
+ string(8) "variable"
+ ["FUBAR_VARIABLE/foo"]=>
+ string(22) "variable with string 1"
+ ["foo/FUBAR_VARIABLE"]=>
+ string(22) "variable with string 2"
+ ["foo/FUBAR_VARIABLE/foo"]=>
+ string(22) "variable with string 3"
+ }
+ ["foo7"]=>
+ array(4) {
+ ["FUBAR_QUOTES_VARIABLE"]=>
+ string(17) "quoted variable 1"
+ ["FUBAR_QUOTES_VARIABLE/foo"]=>
+ string(17) "quoted variable 2"
+ ["foo/FUBAR_QUOTES_VARIABLE"]=>
+ string(17) "quoted variable 3"
+ ["foo/FUBAR_QUOTES_VARIABLE/foo"]=>
+ string(17) "quoted variable 4"
+ }
+ }
+ ["non value"]=>
+ array(4) {
+ ["novalue_option1"]=>
+ string(0) ""
+ ["novalue_option2"]=>
+ string(0) ""
+ ["novalue_option3"]=>
+ string(0) ""
+ ["novalue_option4"]=>
+ array(3) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ }
+ }
+ ["Quoted strings and variables in sections"]=>
+ array(0) {
+ }
+ ["FUBAR_VARIABLE"]=>
+ array(0) {
+ }
+ ["FUBAR_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_VARIABLE"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["FUBAR_QUOTES_VARIABLE"]=>
+ array(0) {
+ }
+ ["FUBAR_QUOTES_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_QUOTES_VARIABLE"]=>
+ array(0) {
+ }
+ ["foo/FUBAR_QUOTES_VARIABLE/foo"]=>
+ array(0) {
+ }
+ ["PATH=FUBAR_VARIABLE/no/quotes"]=>
+ array(0) {
+ }
+ ["PATH=FUBAR_VARIABLE/all/quoted"]=>
+ array(0) {
+ }
+ ["01"]=>
+ array(2) {
+ ["e"]=>
+ string(1) "e"
+ ["f"]=>
+ string(1) "f"
+ }
+ ["02"]=>
+ array(2) {
+ ["g"]=>
+ string(1) "g"
+ ["h"]=>
+ string(1) "h"
+ }
+ [1]=>
+ array(2) {
+ ["a"]=>
+ string(1) "a"
+ ["b"]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(2) {
+ ["c"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "d"
+ }
+ ["0815"]=>
+ array(1) {
+ ["bla"]=>
+ string(3) "bla"
+ }
+ ["bug #43923"]=>
+ array(3) {
+ ["curly1"]=>
+ string(1) "{"
+ ["curly2"]=>
+ string(1) "{"
+ ["curly3"]=>
+ string(1) "{"
+ }
+ ["bug #44019"]=>
+ array(6) {
+ ["concatenation_before"]=>
+ string(37) "this_is_test_constant+some_text_after"
+ ["concatenation_middle"]=>
+ string(54) "some_text_before+this_is_test_constant+some_text_after"
+ ["concatenation_after"]=>
+ string(38) "some_text_before+this_is_test_constant"
+ ["concatenation_nows_before"]=>
+ string(37) "this_is_test_constant+some_text_after"
+ ["concatenation_nows_middle"]=>
+ string(54) "some_text_before+this_is_test_constant+some_text_after"
+ ["concatenation_nows_after"]=>
+ string(38) "some_text_before+this_is_test_constant"
+ }
+ ["bug #43915"]=>
+ array(3) {
+ ["ini_with-hyphen"]=>
+ string(26) "with hyphen and underscore"
+ ["ini.with-hyphen"]=>
+ string(14) "dot and hyphen"
+ ["ini-with.hyphen"]=>
+ string(14) "hyphen and dot"
+ }
+ ["windows paths"]=>
+ array(2) {
+ ["winpath1"]=>
+ string(69) "c:\some windows\path\test\new\r\quote " here\single ' quote\some more"
+ ["winpath2"]=>
+ string(13) "special case\"
+ }
+}
+Done.
diff --git a/ext/standard/tests/general_functions/parse_ini_booleans.data b/ext/standard/tests/general_functions/parse_ini_booleans.data
new file mode 100644
index 0000000..d408577
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_booleans.data
@@ -0,0 +1,27 @@
+[error_reporting values]
+foo = E_ALL E_NOTICE
+error_reporting = E_ALL
+error_reporting1 = E_COMPILE_ERROR|E_RECOVERABLE_ERROR |E_ERROR|E_CORE_ERROR
+error_reporting2 = E_ALL&~E_NOTICE
+error_reporting3 = E_ALL & ~E_NOTICE
+error_reporting4 = E_ALL & ~E_NOTICE | E_STRICT
+
+['true or false']
+bool_true = true
+bool_yes = yes
+bool_on = on
+bool_false=false
+bool_off =Off
+bool_no=No
+bool_none= NoNe
+bool_null = NULl
+
+[strings]
+string_true = "true"
+string_yes = " yes"
+string_on = " on "
+string_false="false"
+string_off ="Off "
+string_no="No "
+string_none=" NoNe"
+string_null = "NULl"
diff --git a/ext/standard/tests/general_functions/parse_ini_booleans.phpt b/ext/standard/tests/general_functions/parse_ini_booleans.phpt
new file mode 100644
index 0000000..7b012c5
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_booleans.phpt
@@ -0,0 +1,69 @@
+--TEST--
+parse_ini_file() boolean operators
+--FILE--
+<?php
+
+$ini_file = dirname(__FILE__)."/parse_ini_booleans.data";
+
+var_dump(parse_ini_file($ini_file, 1));
+
+echo "Done.\n";
+
+?>
+--EXPECTF--
+array(3) {
+ ["error_reporting values"]=>
+ array(6) {
+ ["foo"]=>
+ string(7) "32767 8"
+ ["error_reporting"]=>
+ string(5) "32767"
+ ["error_reporting1"]=>
+ string(4) "4177"
+ ["error_reporting2"]=>
+ string(5) "32759"
+ ["error_reporting3"]=>
+ string(5) "32759"
+ ["error_reporting4"]=>
+ string(5) "32759"
+ }
+ ["true or false"]=>
+ array(8) {
+ ["bool_true"]=>
+ string(1) "1"
+ ["bool_yes"]=>
+ string(1) "1"
+ ["bool_on"]=>
+ string(1) "1"
+ ["bool_false"]=>
+ string(0) ""
+ ["bool_off"]=>
+ string(0) ""
+ ["bool_no"]=>
+ string(0) ""
+ ["bool_none"]=>
+ string(0) ""
+ ["bool_null"]=>
+ string(0) ""
+ }
+ ["strings"]=>
+ array(8) {
+ ["string_true"]=>
+ string(4) "true"
+ ["string_yes"]=>
+ string(4) " yes"
+ ["string_on"]=>
+ string(5) " on "
+ ["string_false"]=>
+ string(5) "false"
+ ["string_off"]=>
+ string(4) "Off "
+ ["string_no"]=>
+ string(4) "No "
+ ["string_none"]=>
+ string(5) " NoNe"
+ ["string_null"]=>
+ string(4) "NULl"
+ }
+}
+Done.
diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt
new file mode 100644
index 0000000..240b0f3
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_file.phpt
@@ -0,0 +1,218 @@
+--TEST--
+parse_ini_file() multiple calls
+--SKIPIF--
+<?php if( substr(PHP_OS, 0, 3) == 'WIN' ) die("skip Windows has different error message");?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/parse_ini_file.dat";
+@unlink($filename); /* Make sure the file really does not exist! */
+
+var_dump(parse_ini_file());
+var_dump(parse_ini_file(1,1,1,1));
+var_dump(parse_ini_file($filename));
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+test =
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+$ini = "
+test==
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test=test=
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+test= \"new
+line\"
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+define("TEST_CONST", "test const value");
+$ini = "
+test=TEST_CONST
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename));
+
+$ini = "
+[section]
+test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, false));
+
+$ini = "
+section.test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+section.test=hello
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+[section]
+1=2
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+$ini = "
+1=2
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+$ini = "
+test=test2
+test=test3
+test=test4
+";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+/* From bug #44574 */
+$ini = "[section1]\nname = value";
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+/* #44842, labels starting with underscore */
+$ini = <<<'INI'
+foo=bar1
+_foo=bar2
+foo_=bar3
+INI;
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+/* #44575, comments starting with '#' */
+$ini = <<<'INI'
+foo=bar1
+; comment
+_foo=bar2
+# comment
+foo_=bar3
+INI;
+file_put_contents($filename, $ini);
+var_dump(parse_ini_file($filename, true));
+
+
+@unlink($filename);
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6
+bool(false)
+
+Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7
+bool(false)
+
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8
+bool(false)
+
+Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9
+bool(false)
+array(1) {
+ ["test"]=>
+ string(0) ""
+}
+
+Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
+ in %sparse_ini_file.php on line 20
+bool(false)
+
+Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
+ in %sparse_ini_file.php on line 26
+bool(false)
+array(1) {
+ ["test"]=>
+ string(8) "new
+line"
+}
+array(1) {
+ ["test"]=>
+ string(16) "test const value"
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ ["test"]=>
+ string(5) "hello"
+ }
+}
+array(1) {
+ ["test"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["section.test"]=>
+ string(5) "hello"
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ ["section.test"]=>
+ string(5) "hello"
+ }
+}
+array(1) {
+ ["section"]=>
+ array(1) {
+ [1]=>
+ string(1) "2"
+ }
+}
+array(1) {
+ [1]=>
+ string(1) "2"
+}
+array(1) {
+ ["test"]=>
+ string(5) "test4"
+}
+array(1) {
+ ["section1"]=>
+ array(1) {
+ ["name"]=>
+ string(5) "value"
+ }
+}
+array(3) {
+ ["foo"]=>
+ string(4) "bar1"
+ ["_foo"]=>
+ string(4) "bar2"
+ ["foo_"]=>
+ string(4) "bar3"
+}
+
+Deprecated: Comments starting with '#' are deprecated in %s
+array(3) {
+ ["foo"]=>
+ string(4) "bar1"
+ ["_foo"]=>
+ string(4) "bar2"
+ ["foo_"]=>
+ string(4) "bar3"
+}
+Done
diff --git a/ext/standard/tests/general_functions/parse_ini_string_001.phpt b/ext/standard/tests/general_functions/parse_ini_string_001.phpt
new file mode 100644
index 0000000..e135210
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_string_001.phpt
@@ -0,0 +1,479 @@
+--TEST--
+Test parse_ini_string() function
+--FILE--
+<?php
+/* Prototype: array parse_ini_string(string $string [,bool $process_sections]);
+ Description: parse_ini_string() loads in the ini file specified in filename,
+ and returns the settings in it in an associative array.
+*/
+
+$parse_string = <<<EOD
+; Comment starts with semi-colon(;)
+; Section starts with [<section name>]
+
+; start of ini file
+
+[Constans]
+one = 1
+five = 5
+animal = BIRD
+Language = PHP
+PHP_CONSTANT = 1.2345678
+10 = Ten
+HELLO = HELLO
+
+[date]
+date =
+time =
+
+[paths]
+path = /usr/local/bin
+URL = http://www.php.net
+
+[Decimal]
+Decimal_value1 = 100
+Decimal_value2 = -100
+Decimal_value3 = -2147483647
+Decimal_value4 = 2147483647
+Decimal_value5 = -2147483648
+Decimal_value6 = 2147483648
+
+[Octal]
+Octal_value = 0100
+
+[Hex]
+Hex_value1 = 0x101
+Hex_Value2 = 0x102
+Hex_Value2 = 0x103
+
+[Non-alphanumerics_as_values]
+;Non-alpha numeric chars without quotes
+Non_alpha1 = ;
+Non_alpha2 = +
+Non_alpha3 = *
+Non_alpha4 = %
+Non_alpha5 = <>
+Non_alpha6 = @
+Non_alpha7 = #
+Non_alpha8 = ^
+Non_alpha9 = -
+Non_alpha10 = :
+Non_alpha11 = ?
+Non_alpha12 = /
+Non_alpha13 = \
+;These chars have a special meaning when used in the value,
+; hence parser throws an error
+;Non_alpha14 = &
+;Non_alpha15 = {}
+;Non_alpha16 = |
+;Non_alpha17 = ~
+;Non_alpha18 = !
+;Non_alpha19 = $
+;Non_alpha20 = ()
+
+Non_alpha1_quotes = ";"
+Non_alpha2_quotes = "+"
+Non_alpha3_quotes = "*"
+Non_alpha4_quotes = "%"
+Non_alpha5_quotes = "<>"
+Non_alpha6_quotes = "@"
+Non_alpha7_quotes = "#"
+Non_alpha8_quotes = "^"
+Non_alpha9_quotes = "-"
+Non_alpha10_quotes = "="
+Non_alpha11_quotes = ":"
+Non_alpha12_quotes = "?"
+Non_alpha13_quotes = "/"
+;Non_alpha14_quotes = "\"
+Non_alpha15_quotes = "&"
+Non_alpha16_quotes = "{}"
+Non_alpha17_quotes = "|"
+Non_alpha18_quotes = "~"
+Non_alpha19_quotes = "!"
+;Non_alpha20_quotes = "$"
+Non_alpha21_quotes = "()"
+
+[Non-alpha numerics in strings]
+;expected error, as the non-alphanumeric chars not enclosed in double quotes("")
+Non_alpha_string1 = Hello@world
+;Non_alpha_string2 = Hello!world
+;Non_alpha_string3 = Hello#world
+;Non_alpha_string4 = Hello%world
+;Non_alpha_string5 = Hello&world
+;Non_alpha_string6 = Hello*world
+;Non_alpha_string7 = Hello+world
+;Non_alpha_string8 = Hello-world
+;Non_alpha_string9 = Hello'world
+;Non_alpha_string10 = Hello:world
+;Non_alpha_string11 = Hello;world
+;Non_alpha_string12 = Hello<world
+;Non_alpha_string13 = Hello>world
+;Non_alpha_string14 = Hello>world
+;Non_alpha_string15 = Hello?world
+;Non_alpha_string16 = Hello\world
+;Non_alpha_string17 = Hello^world
+;Non_alpha_string18 = Hello_world
+;Non_alpha_string19 = Hello|world
+;Non_alpha_string20 = Hello~world
+;Non_alpha_string21 = Hello`world
+;Non_alpha_string22 = Hello(world)
+
+[Non-alpha numerics in strings -with quotes]
+Non_alpha_string1_quotes = "Hello@world"
+Non_alpha_string2_quotes = "Hello!world"
+Non_alpha_string3_quotes = "Hello#world"
+Non_alpha_string4_quotes = "Hello&world"
+Non_alpha_string5_quotes = "Hello*world"
+Non_alpha_string6_quotes = "Hello+world"
+Non_alpha_string7_quotes = "Hello-world"
+Non_alpha_string8_quotes = "Hello'world"
+Non_alpha_string9_quotes = "Hello:world"
+Non_alpha_string10_quotes = "Hello;world"
+Non_alpha_string11_quotes = "Hello<world"
+Non_alpha_string12_quotes = "Hello>world"
+Non_alpha_string13_quotes = "Hello>world"
+Non_alpha_string14_quotes = "Hello?world"
+Non_alpha_string15_quotes = "Hello\world"
+Non_alpha_string16_quotes = "Hello^world"
+Non_alpha_string17_quotes = "Hello_world"
+Non_alpha_string18_quotes = "Hello|world"
+Non_alpha_string19_quotes = "Hello~world"
+Non_alpha_string20_quotes = "Hello`world"
+Non_alpha_string21_quotes = "Hello(world)"
+
+[Newlines_in_Values]
+String1 = "Hello, world\nGood Morning"
+String2 = "\nHello, world
+ Good Morning\n"
+String3 = 'Hello, world\tGood Morning'
+String4 = "\n"
+String5 = "\n\n"
+String6 = Hello, world\tGood Morning
+
+[ReservedKeys_as_Values]
+Key1 = YES
+Key2 = Yes
+Key3 = yEs
+Key4 = NO
+Key5 = No
+Key6 = nO
+Key7 = TRUE
+Key8 = True
+Key9 = tRUE
+Key10 = true
+Key11 = FALSE
+Key12 = False
+Key13 = false
+Key14 = fAlSE
+Key15 = NULL
+Key16 = Null
+Key17 = nuLL
+Key18 = null
+
+[ReservedKeys_as_Keys]
+; Expected:error, reserved key words must not be used as keys for ini file
+;YES = 1
+;Yes = 2
+;yEs = 1.2
+;YES = YES
+;NO = ""
+;No = "string"
+;nO = "\0"
+;TRUE = 1.1
+;True = 1
+;tRUE = 5
+;true = TRUE
+;FALSE = FALSE
+;False = ""
+;false = "hello"
+;fAlSE = ""
+;NULL = ""
+;Null = 0
+;nuLL = "\0"
+;null = NULL
+
+; end of ini file
+EOD;
+
+echo "*** Test parse_ini_string() function: with various keys and values given in string ***\n";
+echo "-- ini string without process_sections optional arg --\n";
+define('BIRD', 'Humming bird');
+$ini_array = parse_ini_string($parse_string);
+print_r($ini_array);
+
+echo "\n-- ini string with process_sections as TRUE --\n";
+$ini_array = parse_ini_string($parse_string, TRUE);
+print_r($ini_array);
+
+echo "*** Done **\n";
+?>
+--EXPECTF--
+*** Test parse_ini_string() function: with various keys and values given in string ***
+-- ini string without process_sections optional arg --
+Array
+(
+ [one] => 1
+ [five] => 5
+ [animal] => Humming bird
+ [Language] => PHP
+ [PHP_CONSTANT] => 1.2345678
+ [10] => Ten
+ [HELLO] => HELLO
+ [date] =>
+ [time] =>
+ [path] => /usr/local/bin
+ [URL] => http://www.php.net
+ [Decimal_value1] => 100
+ [Decimal_value2] => -100
+ [Decimal_value3] => -2147483647
+ [Decimal_value4] => 2147483647
+ [Decimal_value5] => -2147483648
+ [Decimal_value6] => 2147483648
+ [Octal_value] => 0100
+ [Hex_value1] => 0x101
+ [Hex_Value2] => 0x103
+ [Non_alpha1] =>
+ [Non_alpha2] => +
+ [Non_alpha3] => *
+ [Non_alpha4] => %
+ [Non_alpha5] => <>
+ [Non_alpha6] => @
+ [Non_alpha7] => #
+ [Non_alpha8] => ^
+ [Non_alpha9] => -
+ [Non_alpha10] => :
+ [Non_alpha11] => ?
+ [Non_alpha12] => /
+ [Non_alpha13] => \
+ [Non_alpha1_quotes] => ;
+ [Non_alpha2_quotes] => +
+ [Non_alpha3_quotes] => *
+ [Non_alpha4_quotes] => %
+ [Non_alpha5_quotes] => <>
+ [Non_alpha6_quotes] => @
+ [Non_alpha7_quotes] => #
+ [Non_alpha8_quotes] => ^
+ [Non_alpha9_quotes] => -
+ [Non_alpha10_quotes] => =
+ [Non_alpha11_quotes] => :
+ [Non_alpha12_quotes] => ?
+ [Non_alpha13_quotes] => /
+ [Non_alpha15_quotes] => &
+ [Non_alpha16_quotes] => {}
+ [Non_alpha17_quotes] => |
+ [Non_alpha18_quotes] => ~
+ [Non_alpha19_quotes] => !
+ [Non_alpha21_quotes] => ()
+ [Non_alpha_string1] => Hello@world
+ [Non_alpha_string1_quotes] => Hello@world
+ [Non_alpha_string2_quotes] => Hello!world
+ [Non_alpha_string3_quotes] => Hello#world
+ [Non_alpha_string4_quotes] => Hello&world
+ [Non_alpha_string5_quotes] => Hello*world
+ [Non_alpha_string6_quotes] => Hello+world
+ [Non_alpha_string7_quotes] => Hello-world
+ [Non_alpha_string8_quotes] => Hello'world
+ [Non_alpha_string9_quotes] => Hello:world
+ [Non_alpha_string10_quotes] => Hello;world
+ [Non_alpha_string11_quotes] => Hello<world
+ [Non_alpha_string12_quotes] => Hello>world
+ [Non_alpha_string13_quotes] => Hello>world
+ [Non_alpha_string14_quotes] => Hello?world
+ [Non_alpha_string15_quotes] => Hello\world
+ [Non_alpha_string16_quotes] => Hello^world
+ [Non_alpha_string17_quotes] => Hello_world
+ [Non_alpha_string18_quotes] => Hello|world
+ [Non_alpha_string19_quotes] => Hello~world
+ [Non_alpha_string20_quotes] => Hello`world
+ [Non_alpha_string21_quotes] => Hello(world)
+ [String1] => Hello, world
+Good Morning
+ [String2] =>
+Hello, world
+ Good Morning
+
+ [String3] => Hello, world Good Morning
+ [String4] =>
+
+ [String5] =>
+
+
+ [String6] => Hello, world Good Morning
+ [Key1] => 1
+ [Key2] => 1
+ [Key3] => 1
+ [Key4] =>
+ [Key5] =>
+ [Key6] =>
+ [Key7] => 1
+ [Key8] => 1
+ [Key9] => 1
+ [Key10] => 1
+ [Key11] =>
+ [Key12] =>
+ [Key13] =>
+ [Key14] =>
+ [Key15] =>
+ [Key16] =>
+ [Key17] =>
+ [Key18] =>
+)
+
+-- ini string with process_sections as TRUE --
+Array
+(
+ [Constans] => Array
+ (
+ [one] => 1
+ [five] => 5
+ [animal] => Humming bird
+ [Language] => PHP
+ [PHP_CONSTANT] => 1.2345678
+ [10] => Ten
+ [HELLO] => HELLO
+ )
+
+ [date] => Array
+ (
+ [date] =>
+ [time] =>
+ )
+
+ [paths] => Array
+ (
+ [path] => /usr/local/bin
+ [URL] => http://www.php.net
+ )
+
+ [Decimal] => Array
+ (
+ [Decimal_value1] => 100
+ [Decimal_value2] => -100
+ [Decimal_value3] => -2147483647
+ [Decimal_value4] => 2147483647
+ [Decimal_value5] => -2147483648
+ [Decimal_value6] => 2147483648
+ )
+
+ [Octal] => Array
+ (
+ [Octal_value] => 0100
+ )
+
+ [Hex] => Array
+ (
+ [Hex_value1] => 0x101
+ [Hex_Value2] => 0x103
+ )
+
+ [Non-alphanumerics_as_values] => Array
+ (
+ [Non_alpha1] =>
+ [Non_alpha2] => +
+ [Non_alpha3] => *
+ [Non_alpha4] => %
+ [Non_alpha5] => <>
+ [Non_alpha6] => @
+ [Non_alpha7] => #
+ [Non_alpha8] => ^
+ [Non_alpha9] => -
+ [Non_alpha10] => :
+ [Non_alpha11] => ?
+ [Non_alpha12] => /
+ [Non_alpha13] => \
+ [Non_alpha1_quotes] => ;
+ [Non_alpha2_quotes] => +
+ [Non_alpha3_quotes] => *
+ [Non_alpha4_quotes] => %
+ [Non_alpha5_quotes] => <>
+ [Non_alpha6_quotes] => @
+ [Non_alpha7_quotes] => #
+ [Non_alpha8_quotes] => ^
+ [Non_alpha9_quotes] => -
+ [Non_alpha10_quotes] => =
+ [Non_alpha11_quotes] => :
+ [Non_alpha12_quotes] => ?
+ [Non_alpha13_quotes] => /
+ [Non_alpha15_quotes] => &
+ [Non_alpha16_quotes] => {}
+ [Non_alpha17_quotes] => |
+ [Non_alpha18_quotes] => ~
+ [Non_alpha19_quotes] => !
+ [Non_alpha21_quotes] => ()
+ )
+
+ [Non-alpha numerics in strings] => Array
+ (
+ [Non_alpha_string1] => Hello@world
+ )
+
+ [Non-alpha numerics in strings -with quotes] => Array
+ (
+ [Non_alpha_string1_quotes] => Hello@world
+ [Non_alpha_string2_quotes] => Hello!world
+ [Non_alpha_string3_quotes] => Hello#world
+ [Non_alpha_string4_quotes] => Hello&world
+ [Non_alpha_string5_quotes] => Hello*world
+ [Non_alpha_string6_quotes] => Hello+world
+ [Non_alpha_string7_quotes] => Hello-world
+ [Non_alpha_string8_quotes] => Hello'world
+ [Non_alpha_string9_quotes] => Hello:world
+ [Non_alpha_string10_quotes] => Hello;world
+ [Non_alpha_string11_quotes] => Hello<world
+ [Non_alpha_string12_quotes] => Hello>world
+ [Non_alpha_string13_quotes] => Hello>world
+ [Non_alpha_string14_quotes] => Hello?world
+ [Non_alpha_string15_quotes] => Hello\world
+ [Non_alpha_string16_quotes] => Hello^world
+ [Non_alpha_string17_quotes] => Hello_world
+ [Non_alpha_string18_quotes] => Hello|world
+ [Non_alpha_string19_quotes] => Hello~world
+ [Non_alpha_string20_quotes] => Hello`world
+ [Non_alpha_string21_quotes] => Hello(world)
+ )
+
+ [Newlines_in_Values] => Array
+ (
+ [String1] => Hello, world
+Good Morning
+ [String2] =>
+Hello, world
+ Good Morning
+
+ [String3] => Hello, world Good Morning
+ [String4] =>
+
+ [String5] =>
+
+
+ [String6] => Hello, world Good Morning
+ )
+
+ [ReservedKeys_as_Values] => Array
+ (
+ [Key1] => 1
+ [Key2] => 1
+ [Key3] => 1
+ [Key4] =>
+ [Key5] =>
+ [Key6] =>
+ [Key7] => 1
+ [Key8] => 1
+ [Key9] => 1
+ [Key10] => 1
+ [Key11] =>
+ [Key12] =>
+ [Key13] =>
+ [Key14] =>
+ [Key15] =>
+ [Key16] =>
+ [Key17] =>
+ [Key18] =>
+ )
+
+ [ReservedKeys_as_Keys] => Array
+ (
+ )
+
+)
+*** Done **
diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
new file mode 100644
index 0000000..733409c
--- /dev/null
+++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
@@ -0,0 +1,168 @@
+--TEST--
+parse_ini_string() multiple calls
+--FILE--
+<?php
+
+var_dump(parse_ini_string());
+var_dump(parse_ini_string(1,1,1,1));
+
+$ini = "
+test =
+";
+var_dump(parse_ini_string($ini));
+$ini = "
+test==
+";
+var_dump(parse_ini_string($ini));
+
+$ini = "
+test=test=
+";
+var_dump(parse_ini_string($ini));
+
+$ini = "
+test= \"new
+line\"
+";
+var_dump(parse_ini_string($ini));
+
+define("TEST_CONST", "test const value");
+$ini = "
+test=TEST_CONST
+";
+var_dump(parse_ini_string($ini));
+
+$ini = "
+[section]
+test=hello
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+[section]
+test=hello
+";
+var_dump(parse_ini_string($ini, false));
+
+$ini = "
+section.test=hello
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+[section]
+section.test=hello
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+[section]
+1=2
+";
+var_dump(parse_ini_string($ini, true));
+
+$ini = "
+1=2
+";
+var_dump(parse_ini_string($ini, true));
+$ini = "
+test=test2
+test=test3
+test=test4
+";
+var_dump(parse_ini_string($ini, true));
+
+/* From bug #44574 */
+$ini = "[section1]\nname = value";
+var_dump(parse_ini_string($ini, true));
+
+/* #44842, labels starting with underscore */
+$ini = <<<'INI'
+foo=bar1
+_foo=bar2
+foo_=bar3
+INI;
+var_dump(parse_ini_string($ini, true));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s
+bool(false)
+
+Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s
+bool(false)
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(0) ""
+}
+
+Warning: syntax error, unexpected '='%sin Unknown on line 2
+ in %s
+bool(false)
+
+Warning: syntax error, unexpected '='%sin Unknown on line 2
+ in %s
+bool(false)
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(8) "new
+line"
+}
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(16) "test const value"
+}
+array(1) {
+ [%u|b%"section"]=>
+ array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(5) "hello"
+ }
+}
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(5) "hello"
+}
+array(1) {
+ [%u|b%"section.test"]=>
+ %unicode|string%(5) "hello"
+}
+array(1) {
+ [%u|b%"section"]=>
+ array(1) {
+ [%u|b%"section.test"]=>
+ %unicode|string%(5) "hello"
+ }
+}
+array(1) {
+ [%u|b%"section"]=>
+ array(1) {
+ [1]=>
+ %unicode|string%(1) "2"
+ }
+}
+array(1) {
+ [1]=>
+ %unicode|string%(1) "2"
+}
+array(1) {
+ [%u|b%"test"]=>
+ %unicode|string%(5) "test4"
+}
+array(1) {
+ [%u|b%"section1"]=>
+ array(1) {
+ [%u|b%"name"]=>
+ %unicode|string%(5) "value"
+ }
+}
+array(3) {
+ [%u|b%"foo"]=>
+ %unicode|string%(4) "bar1"
+ [%u|b%"_foo"]=>
+ %unicode|string%(4) "bar2"
+ [%u|b%"foo_"]=>
+ %unicode|string%(4) "bar3"
+}
+Done
diff --git a/ext/standard/tests/general_functions/php_uname_basic.phpt b/ext/standard/tests/general_functions/php_uname_basic.phpt
new file mode 100644
index 0000000..629318d
--- /dev/null
+++ b/ext/standard/tests/general_functions/php_uname_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test php_uname() function - basic test
+--FILE--
+<?php
+/* Prototype: string php_uname ([ string $mode ] )
+ * Description: Returns information about the operating system PHP is running on
+*/
+
+echo "*** Testing php_uname() - basic test\n";
+
+var_dump(php_uname());
+
+echo "\n-- Try all the defined mode's --\n";
+
+var_dump(php_uname('a'));
+var_dump(php_uname('s'));
+var_dump(php_uname('n'));
+var_dump(php_uname('r'));
+var_dump(php_uname('v'));
+var_dump(php_uname('m'));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing php_uname() - basic test
+string(%d) "%s"
+
+-- Try all the defined mode's --
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+string(%d) "%s"
+===DONE===
diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt
new file mode 100644
index 0000000..5e221b7
--- /dev/null
+++ b/ext/standard/tests/general_functions/php_uname_error.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test php_uname() function - error conditions - pass function incorrect arguments
+--FILE--
+<?php
+/* Prototype: string php_uname ([ string $mode ] )
+ * Description: Returns information about the operating system PHP is running on
+*/
+
+echo "*** Testing php_uname() - error test\n";
+
+echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n";
+var_dump( php_uname('a', true) );
+
+echo "\n-- Testing php_uname() function with invalid mode --\n";
+// am invalid mode shoudl result in same o/p as mode 'a'
+var_dump( php_uname('z') == php_uname('z') );
+
+class barClass {
+}
+
+$fp = fopen(__FILE__, "r");
+
+echo "\n-- Testing php_uname() function with invalid argument types --\n";
+var_dump(php_uname(array()));
+var_dump(php_uname(array('color' => 'red', 'item' => 'pen')));
+var_dump(php_uname(new barClass()));
+var_dump(php_uname($fp));
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing php_uname() - error test
+
+-- Testing php_uname() function with more than expected no. of arguments --
+
+Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing php_uname() function with invalid mode --
+bool(true)
+
+-- Testing php_uname() function with invalid argument types --
+
+Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/php_uname_variation1.phpt b/ext/standard/tests/general_functions/php_uname_variation1.phpt
new file mode 100644
index 0000000..d94fd80
--- /dev/null
+++ b/ext/standard/tests/general_functions/php_uname_variation1.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test php_uname() function - usage variations
+--FILE--
+<?php
+/* Prototype: string php_uname ([ string $mode ] )
+ * Description: Returns information about the operating system PHP is running on
+*/
+
+echo "*** Testing php_uname() - usage variations\n";
+// Prevent notices about undefines variables
+error_reporting(E_ALL & ~E_NOTICE);
+
+$unset_var = 10;
+unset ($unset_var);
+
+class fooClass {
+ function __toString() {
+ return "m";
+ }
+}
+
+$values = array(
+
+ // int data
+ "0" => 0,
+ "1" => 1,
+ "12345" => 12345,
+ "-2345" => -2345,
+
+ // float data
+ "10.5" => 10.5,
+ "-10.5" => -10.5,
+ "10.1234567e10" => 10.1234567e10,
+ "10.7654321E-10" => 10.7654321E-10,
+ ".5" => .5,
+
+ // null data
+ "NULL" => NULL,
+ "null" => null,
+
+ // boolean data
+ "true" => true,
+ "false" => false,
+ "TRUE" => TRUE,
+ "FALSE" => FALSE,
+
+ // empty data
+ "\"\"" => "",
+ "''" => '',
+
+ // object data
+ "new fooClass()" => new fooClass(),
+
+ // undefined data
+ "undefined var" => $undefined_var,
+
+ // unset data
+ "unset var" => $unset_var,
+);
+
+// loop through each element of the array for data
+
+foreach($values as $key => $value) {
+ echo "-- Iterator $key --\n";
+ var_dump( php_uname($value) );
+};
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing php_uname() - usage variations
+-- Iterator 0 --
+string(%d) "%s"
+-- Iterator 1 --
+string(%d) "%s"
+-- Iterator 12345 --
+string(%d) "%s"
+-- Iterator -2345 --
+string(%d) "%s"
+-- Iterator 10.5 --
+string(%d) "%s"
+-- Iterator -10.5 --
+string(%d) "%s"
+-- Iterator 10.1234567e10 --
+string(%d) "%s"
+-- Iterator 10.7654321E-10 --
+string(%d) "%s"
+-- Iterator .5 --
+string(%d) "%s"
+-- Iterator NULL --
+string(%d) "%s"
+-- Iterator null --
+string(%d) "%s"
+-- Iterator true --
+string(%d) "%s"
+-- Iterator false --
+string(%d) "%s"
+-- Iterator TRUE --
+string(%d) "%s"
+-- Iterator FALSE --
+string(%d) "%s"
+-- Iterator "" --
+string(%d) "%s"
+-- Iterator '' --
+string(%d) "%s"
+-- Iterator new fooClass() --
+string(%d) "%s"
+-- Iterator undefined var --
+string(%d) "%s"
+-- Iterator unset var --
+string(%d) "%s"
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt
new file mode 100644
index 0000000..0aff614
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpcredits.phpt
@@ -0,0 +1,54 @@
+--TEST--
+phpcredits()
+--FILE--
+<?php
+
+var_dump(phpcredits());
+var_dump(phpcredits(array()));
+
+echo "--\n";
+var_dump(phpcredits(0));
+
+echo "--\n";
+var_dump(phpcredits(CREDITS_GROUP));
+
+?>
+--EXPECTF--
+PHP Credits
+
+PHP Group
+%a
+
+Language Design & Concept
+%a
+
+%wPHP Authors%w
+%a
+
+%wSAPI Modules%w
+%a
+
+%wModule Authors%w
+%a
+
+%wPHP Documentation%w
+%a
+
+PHP Quality Assurance Team
+%a
+
+%wWebsites and Infrastructure team%w
+%a
+bool(true)
+
+Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits.php on line 4
+NULL
+--
+PHP Credits
+bool(true)
+--
+PHP Credits
+
+PHP Group
+%a
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt
new file mode 100644
index 0000000..ee17f59
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpcredits2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+phpcredits() CGI
+--POST--
+dummy=x
+--FILE--
+<?php
+
+var_dump(phpcredits());
+var_dump(phpcredits(array()));
+
+echo "--\n";
+var_dump(phpcredits(0));
+
+echo "--\n";
+var_dump(phpcredits(CREDITS_GROUP));
+
+?>
+--EXPECTF--
+<!DOCTYPE %a>%s</html>
+bool(true)
+
+Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits2.php on line 4
+NULL
+--
+<h1>PHP Credits</h1>
+bool(true)
+--
+<h1>PHP Credits</h1>
+%aPHP Group%a
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
new file mode 100644
index 0000000..01b0c62
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -0,0 +1,76 @@
+--TEST--
+phpinfo()
+--FILE--
+<?php
+var_dump(phpinfo());
+
+echo "--\n";
+var_dump(phpinfo(array()));
+
+echo "--\n";
+var_dump(phpinfo(0));
+
+echo "--\n";
+var_dump(phpinfo(INFO_LICENSE));
+
+?>
+--EXPECTF--
+phpinfo()
+PHP Version => %s
+
+System => %s
+Build Date => %s%a
+Configure Command => %s
+Server API => Command Line Interface
+Virtual Directory Support => %s
+Configuration File (php.ini) Path => %s
+Loaded Configuration File => %a
+Scan this dir for additional .ini files => %a
+Additional .ini files parsed => %a
+PHP API => %d
+PHP Extension => %d
+Zend Extension => %d
+Zend Extension Build => API%s
+PHP Extension Build => API%s
+Debug Build => %s
+Thread Safety => %s
+Zend Signal Handling => %s
+Zend Memory Manager => %s
+Zend Multibyte Support => %s
+IPv6 Support => %s
+DTrace Support => %s
+
+Registered PHP Streams => %s
+Registered Stream Socket Transports => %s
+Registered Stream Filters => %s
+
+%a
+ _______________________________________________________________________
+
+
+Configuration
+%A
+Core
+%A
+Additional Modules
+%A
+Environment
+%A
+PHP Variables
+%A
+PHP License
+%A
+bool(true)
+--
+
+Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo.php on line 5
+NULL
+--
+phpinfo()
+bool(true)
+--
+phpinfo()
+
+PHP License
+%a
+bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt
new file mode 100644
index 0000000..891867f
--- /dev/null
+++ b/ext/standard/tests/general_functions/phpinfo2.phpt
@@ -0,0 +1,31 @@
+--TEST--
+phpinfo() CGI
+--POST--
+dummy=x
+--FILE--
+<?php
+var_dump(phpinfo());
+
+echo "--\n";
+var_dump(phpinfo(array()));
+
+echo "--\n";
+var_dump(phpinfo(0));
+
+echo "--\n";
+var_dump(phpinfo(INFO_LICENSE));
+
+?>
+--EXPECTF--
+<!DOCTYPE %s>
+%a</html>bool(true)
+--
+
+Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo2.php on line 5
+NULL
+--
+<!DOCTYPE %s>
+%a</html>bool(true)
+--
+<!DOCTYPE %s>
+%a</html>bool(true)
diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt
new file mode 100644
index 0000000..81a523a
--- /dev/null
+++ b/ext/standard/tests/general_functions/print_r.phpt
@@ -0,0 +1,1736 @@
+--TEST--
+Test print_r() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: bool print_r ( mixed $expression [, bool $return] );
+ Description: Prints human-readable information about a variable
+*/
+
+/* Prototype: void check_printr( $variables )
+ Description: use print_r() to print variables */
+function check_printr( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "\n-- Iteration $counter --\n";
+ //default = false, prints output to screen
+ print_r($variable);
+ //$return=TRUE, print_r() will return its output, instead of printing it
+ $ret_string = print_r($variable, true); //$ret_string captures the output
+ echo "\n$ret_string\n";
+ //$return=false, print_r() prints the output; default behavior
+ print_r($variable, false);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing print_r() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_printr() to display contents of integer variables
+ using print_r() */
+check_printr($integers);
+
+echo "\n*** Testing print_r() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_printr() to display contents of float variables
+ using print_r() */
+check_printr($floats);
+
+echo "\n*** Testing print_r() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_printr() to display contents of strings using print_r() */
+check_printr($strings);
+
+echo "\n*** Testing print_r() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_printr() to display boolean variables using print_r() */
+check_printr($booleans);
+var_dump( reset($booleans) );
+echo "\n";
+var_dump( current($booleans) );
+
+echo "\n*** Testing print_r() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_printr() to display contents of $arrays */
+check_printr($arrays);
+
+echo "\n*** Testing print_r() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_printr() to display contents of the objects using print_r() */
+check_printr($objects);
+
+echo "\n** Testing print_r() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+print_r($recursion_obj2);
+
+echo "\n*** Testing print_r() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_printr() to display the resource content type
+ using print_r() */
+check_printr($resources);
+
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_printr() to display combinations of scalar and
+ non-scalar variables using print_r() */
+check_printr($variations);
+
+echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_printr() to display miscelleneous data using print_r() */
+check_printr($misc_values);
+
+/* checking print_r() on functions */
+echo "\n*** Testing print_r() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+print_r( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump( print_r() );
+
+//passing more than required no. of arguments
+var_dump( print_r(123, true, "abc") );
+
+// check when second arg is given other than boolean TRUE
+var_dump( print_r ($value, "string") );
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing print_r() on integer variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+83
+83
+83
+-- Iteration 3 --
+123000000
+123000000
+123000000
+-- Iteration 4 --
+-83
+-83
+-83
+-- Iteration 5 --
+-12300000
+-12300000
+-12300000
+-- Iteration 6 --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+-- Iteration 8 --
+2147483647
+2147483647
+2147483647
+-- Iteration 9 --
+2147483648
+2147483648
+2147483648
+-- Iteration 10 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 11 --
+-2147483647
+-2147483647
+-2147483647
+-- Iteration 12 --
+2147483647
+2147483647
+2147483647
+-- Iteration 13 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 14 --
+2147483647
+2147483647
+2147483647
+-- Iteration 15 --
+-2147483648
+-2147483648
+-2147483648
+*** Testing print_r() on float variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+0
+0
+0
+-- Iteration 3 --
+1.234
+1.234
+1.234
+-- Iteration 4 --
+-1.234
+-1.234
+-1.234
+-- Iteration 5 --
+-2
+-2
+-2
+-- Iteration 6 --
+2
+2
+2
+-- Iteration 7 --
+-0.5
+-0.5
+-0.5
+-- Iteration 8 --
+0.567
+0.567
+0.567
+-- Iteration 9 --
+-0.00067
+-0.00067
+-0.00067
+-- Iteration 10 --
+-670
+-670
+-670
+-- Iteration 11 --
+670
+670
+670
+-- Iteration 12 --
+670
+670
+670
+-- Iteration 13 --
+-0.00410003
+-0.00410003
+-0.00410003
+-- Iteration 14 --
+-4100.03
+-4100.03
+-4100.03
+-- Iteration 15 --
+0.004100003
+0.004100003
+0.004100003
+-- Iteration 16 --
+4100.003
+4100.003
+4100.003
+-- Iteration 17 --
+100000
+100000
+100000
+-- Iteration 18 --
+-100000
+-100000
+-100000
+-- Iteration 19 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 20 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 21 --
+100000
+100000
+100000
+-- Iteration 22 --
+-100000
+-100000
+-100000
+-- Iteration 23 --
+100000
+100000
+100000
+-- Iteration 24 --
+-100000
+-100000
+-100000
+-- Iteration 25 --
+100000
+100000
+100000
+-- Iteration 26 --
+-100000
+-100000
+-100000
+-- Iteration 27 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 28 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 29 --
+-2147483649
+-2147483649
+-2147483649
+-- Iteration 30 --
+2147483649
+2147483649
+2147483649
+-- Iteration 31 --
+2147483649
+2147483649
+2147483649
+-- Iteration 32 --
+-2147483649
+-2147483649
+-2147483649
+*** Testing print_r() on string variables ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+-- Iteration 5 --
+0
+0
+0
+-- Iteration 6 --
+
+
+
+-- Iteration 7 --
+\0
+\0
+\0
+-- Iteration 8 --
+
+
+
+-- Iteration 9 --
+\t
+\t
+\t
+-- Iteration 10 --
+PHP
+PHP
+PHP
+-- Iteration 11 --
+PHP
+PHP
+PHP
+-- Iteration 12 --
+abcd
+abcd
+abcd
+-- Iteration 13 --
+abcd
+abcd
+abcd
+-- Iteration 14 --
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+*** Testing print_r() on boolean variables ***
+
+-- Iteration 1 --
+1
+1
+1
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+1
+1
+1
+-- Iteration 4 --
+
+
+bool(true)
+
+bool(true)
+
+*** Testing print_r() on array variables ***
+
+-- Iteration 1 --
+Array
+(
+)
+
+Array
+(
+)
+
+Array
+(
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+-- Iteration 8 --
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+-- Iteration 9 --
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+-- Iteration 10 --
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+-- Iteration 11 --
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+-- Iteration 12 --
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+-- Iteration 13 --
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+-- Iteration 14 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+-- Iteration 15 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+*** Testing print_r() on object variables ***
+
+-- Iteration 1 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 2 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 3 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 4 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 5 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 6 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 7 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 8 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 9 --
+
+
+
+** Testing print_r() on objects having circular reference **
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ *RECURSION*
+ )
+
+)
+
+*** Testing print_r() on resources ***
+
+-- Iteration 1 --
+Resource id #5
+Resource id #5
+Resource id #5
+-- Iteration 2 --
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
+
+-- Iteration 1 --
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+*** Testing print_r() on miscelleneous input arguments ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+*** Testing print_r() on anonymous functions ***
+New anonymous function:
+2 * 3 = 6
+
+*** Testing error conditions ***
+
+Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: value in %s on line %d
+string(0) ""
+Done
diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt
new file mode 100644
index 0000000..f3ebd58
--- /dev/null
+++ b/ext/standard/tests/general_functions/print_r_64bit.phpt
@@ -0,0 +1,1737 @@
+--TEST--
+Test print_r() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+
+<?php
+/* Prototype: bool print_r ( mixed $expression [, bool $return] );
+ Description: Prints human-readable information about a variable
+*/
+
+/* Prototype: void check_printr( $variables )
+ Description: use print_r() to print variables */
+function check_printr( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "\n-- Iteration $counter --\n";
+ //default = false, prints output to screen
+ print_r($variable);
+ //$return=TRUE, print_r() will return its output, instead of printing it
+ $ret_string = print_r($variable, true); //$ret_string captures the output
+ echo "\n$ret_string\n";
+ //$return=false, print_r() prints the output; default behavior
+ print_r($variable, false);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing print_r() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_printr() to display contents of integer variables
+ using print_r() */
+check_printr($integers);
+
+echo "\n*** Testing print_r() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_printr() to display contents of float variables
+ using print_r() */
+check_printr($floats);
+
+echo "\n*** Testing print_r() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_printr() to display contents of strings using print_r() */
+check_printr($strings);
+
+echo "\n*** Testing print_r() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_printr() to display boolean variables using print_r() */
+check_printr($booleans);
+var_dump( reset($booleans) );
+echo "\n";
+var_dump( current($booleans) );
+
+echo "\n*** Testing print_r() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_printr() to display contents of $arrays */
+check_printr($arrays);
+
+echo "\n*** Testing print_r() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_printr() to display contents of the objects using print_r() */
+check_printr($objects);
+
+echo "\n** Testing print_r() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+print_r($recursion_obj2);
+
+echo "\n*** Testing print_r() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_printr() to display the resource content type
+ using print_r() */
+check_printr($resources);
+
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_printr() to display combinations of scalar and
+ non-scalar variables using print_r() */
+check_printr($variations);
+
+echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_printr() to display miscelleneous data using print_r() */
+check_printr($misc_values);
+
+/* checking print_r() on functions */
+echo "\n*** Testing print_r() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+print_r( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump( print_r() );
+
+//passing more than required no. of arguments
+var_dump( print_r(123, true, "abc") );
+
+// check when second arg is given other than boolean TRUE
+var_dump( print_r ($value, "string") );
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing print_r() on integer variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+83
+83
+83
+-- Iteration 3 --
+123000000
+123000000
+123000000
+-- Iteration 4 --
+-83
+-83
+-83
+-- Iteration 5 --
+-12300000
+-12300000
+-12300000
+-- Iteration 6 --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+ [9] => 10
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+Array
+(
+ [0] => -1
+ [1] => -2
+ [2] => -3
+ [3] => -4
+ [4] => -5
+ [5] => -6
+ [6] => -7
+ [7] => -8
+ [8] => -9
+ [9] => -10
+)
+
+-- Iteration 8 --
+2147483647
+2147483647
+2147483647
+-- Iteration 9 --
+2147483648
+2147483648
+2147483648
+-- Iteration 10 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 11 --
+-2147483647
+-2147483647
+-2147483647
+-- Iteration 12 --
+2147483647
+2147483647
+2147483647
+-- Iteration 13 --
+-2147483648
+-2147483648
+-2147483648
+-- Iteration 14 --
+2147483647
+2147483647
+2147483647
+-- Iteration 15 --
+-2147483648
+-2147483648
+-2147483648
+*** Testing print_r() on float variables ***
+
+-- Iteration 1 --
+0
+0
+0
+-- Iteration 2 --
+0
+0
+0
+-- Iteration 3 --
+1.234
+1.234
+1.234
+-- Iteration 4 --
+-1.234
+-1.234
+-1.234
+-- Iteration 5 --
+-2
+-2
+-2
+-- Iteration 6 --
+2
+2
+2
+-- Iteration 7 --
+-0.5
+-0.5
+-0.5
+-- Iteration 8 --
+0.567
+0.567
+0.567
+-- Iteration 9 --
+-0.00067
+-0.00067
+-0.00067
+-- Iteration 10 --
+-670
+-670
+-670
+-- Iteration 11 --
+670
+670
+670
+-- Iteration 12 --
+670
+670
+670
+-- Iteration 13 --
+-0.00410003
+-0.00410003
+-0.00410003
+-- Iteration 14 --
+-4100.03
+-4100.03
+-4100.03
+-- Iteration 15 --
+0.004100003
+0.004100003
+0.004100003
+-- Iteration 16 --
+4100.003
+4100.003
+4100.003
+-- Iteration 17 --
+100000
+100000
+100000
+-- Iteration 18 --
+-100000
+-100000
+-100000
+-- Iteration 19 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 20 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 21 --
+100000
+100000
+100000
+-- Iteration 22 --
+-100000
+-100000
+-100000
+-- Iteration 23 --
+100000
+100000
+100000
+-- Iteration 24 --
+-100000
+-100000
+-100000
+-- Iteration 25 --
+100000
+100000
+100000
+-- Iteration 26 --
+-100000
+-100000
+-100000
+-- Iteration 27 --
+1.0E-5
+1.0E-5
+1.0E-5
+-- Iteration 28 --
+-1.0E-5
+-1.0E-5
+-1.0E-5
+-- Iteration 29 --
+-2147483649
+-2147483649
+-2147483649
+-- Iteration 30 --
+2147483649
+2147483649
+2147483649
+-- Iteration 31 --
+2147483649
+2147483649
+2147483649
+-- Iteration 32 --
+-2147483649
+-2147483649
+-2147483649
+*** Testing print_r() on string variables ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+-- Iteration 5 --
+0
+0
+0
+-- Iteration 6 --
+
+
+
+-- Iteration 7 --
+\0
+\0
+\0
+-- Iteration 8 --
+
+
+
+-- Iteration 9 --
+\t
+\t
+\t
+-- Iteration 10 --
+PHP
+PHP
+PHP
+-- Iteration 11 --
+PHP
+PHP
+PHP
+-- Iteration 12 --
+abcd
+abcd
+abcd
+-- Iteration 13 --
+abcd
+abcd
+abcd
+-- Iteration 14 --
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+1234
+5678
+ 9100 abcda
+*** Testing print_r() on boolean variables ***
+
+-- Iteration 1 --
+1
+1
+1
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+1
+1
+1
+-- Iteration 4 --
+
+
+bool(true)
+
+bool(true)
+
+*** Testing print_r() on array variables ***
+
+-- Iteration 1 --
+Array
+(
+)
+
+Array
+(
+)
+
+Array
+(
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+Array
+(
+ [0] => 1
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+Array
+(
+ [0] =>
+)
+
+-- Iteration 7 --
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+)
+
+-- Iteration 8 --
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+Array
+(
+ [0] => Array
+ (
+ [0] => 1
+ [1] => 2
+ )
+
+ [1] => Array
+ (
+ [0] => a
+ [1] => b
+ )
+
+)
+
+-- Iteration 9 --
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+Array
+(
+ [1] => One
+)
+
+-- Iteration 10 --
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+Array
+(
+ [test] => is_array
+)
+
+-- Iteration 11 --
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+Array
+(
+ [0] => 0
+)
+
+-- Iteration 12 --
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+Array
+(
+ [0] => -1
+)
+
+-- Iteration 13 --
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+Array
+(
+ [0] => 10.5
+ [1] => 5.6
+)
+
+-- Iteration 14 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+-- Iteration 15 --
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+Array
+(
+ [0] => string
+ [1] => test
+)
+
+*** Testing print_r() on object variables ***
+
+-- Iteration 1 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 2 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 3 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 4 --
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+contains_object_class Object
+(
+ [p] => 30
+ [class_object1] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object2] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object3:contains_object_class:private] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [class_object4:protected] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ )
+
+ [no_member_class_object] => no_member_class Object
+ (
+ )
+
+ [class_object5] => contains_object_class Object
+ *RECURSION*
+)
+
+-- Iteration 5 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 6 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 7 --
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+no_member_class Object
+(
+)
+
+-- Iteration 8 --
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+)
+
+-- Iteration 9 --
+
+
+
+** Testing print_r() on objects having circular reference **
+object_class Object
+(
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ (
+ [value] => 50
+ [public_var1] => 10
+ [private_var1:object_class:private] => 20
+ [private_var2:object_class:private] => 21
+ [protected_var1:protected] => string_1
+ [protected_var2:protected] => string_2
+ [public_var2] => 11
+ [obj] => object_class Object
+ *RECURSION*
+ )
+
+)
+
+*** Testing print_r() on resources ***
+
+-- Iteration 1 --
+Resource id #5
+Resource id #5
+Resource id #5
+-- Iteration 2 --
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
+
+-- Iteration 1 --
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+Array
+(
+ [0] => 123
+ [1] => -1.2345
+ [2] => a
+)
+
+-- Iteration 2 --
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+Array
+(
+ [0] => d
+ [1] => Array
+ (
+ [0] => 1
+ [1] => 3
+ [2] => 5
+ )
+
+ [2] => 1
+ [3] =>
+)
+
+-- Iteration 3 --
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+Array
+(
+ [0] => no_member_class Object
+ (
+ )
+
+ [1] => Array
+ (
+ )
+
+ [2] =>
+ [3] => 0
+)
+
+-- Iteration 4 --
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+Array
+(
+ [0] => 0
+ [1] => Where am I?
+ [2] => Array
+ (
+ [0] => 7
+ [1] => 8
+ [2] => 9
+ )
+
+ [3] => 1
+ [4] => A
+ [5] => 987654321
+)
+
+-- Iteration 5 --
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+Array
+(
+ [0] =>
+ [1] => 20000000000
+ [2] => 79.1
+ [3] => 4.599998
+)
+
+-- Iteration 6 --
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+Array
+(
+ [0] => array(1,2,3,4)1.0000002TRUE
+ [1] =>
+ [2] => 4611333
+ [3] => /00\7
+)
+
+*** Testing print_r() on miscelleneous input arguments ***
+
+-- Iteration 1 --
+
+
+
+-- Iteration 2 --
+
+
+
+-- Iteration 3 --
+
+
+
+-- Iteration 4 --
+
+
+
+*** Testing print_r() on anonymous functions ***
+New anonymous function:
+2 * 3 = 6
+
+*** Testing error conditions ***
+
+Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Notice: Undefined variable: value in %s on line %d
+string(0) ""
+Done
diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt
new file mode 100644
index 0000000..83b5165
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+proc_nice() basic behaviour
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+ function getNice($id)
+ {
+ $res = shell_exec('ps -p ' . $id .' -o "pid,nice"');
+ preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches);
+ if (count($matches) > 2)
+ return $matches[2];
+ else
+ return -1;
+ }
+ $delta = 10;
+ $pid = getmypid();
+ $niceBefore = getNice($pid);
+ proc_nice($delta);
+ $niceAfter = getNice($pid);
+ var_dump($niceBefore == ($niceAfter - $delta));
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/standard/tests/general_functions/proc_nice_error.phpt b/ext/standard/tests/general_functions/proc_nice_error.phpt
new file mode 100644
index 0000000..a05a182
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_error.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test function proc_nice() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
+
+$priority = 1;
+
+$extra_arg = 1;
+
+var_dump(proc_nice( $priority, $extra_arg) );
+
+var_dump(proc_nice( ) );
+
+
+?>
+--EXPECTF--
+*** Test by calling method or function with incorrect numbers of arguments ***
+
+Warning: proc_nice() expects exactly 1 parameter, 2 given in %s line %d
+bool(false)
+
+Warning: proc_nice() expects exactly 1 parameter, 0 given in %s line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation1.phpt b/ext/standard/tests/general_functions/proc_nice_variation1.phpt
new file mode 100644
index 0000000..8c2bdf0
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with array values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with array values ***\n";
+
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation_array = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with array values ***
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, array given in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation2.phpt b/ext/standard/tests/general_functions/proc_nice_variation2.phpt
new file mode 100644
index 0000000..42cbf9e
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation2.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with boolean values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with boolean values ***\n";
+
+
+
+$variation_array = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with boolean values ***
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation3.phpt b/ext/standard/tests/general_functions/proc_nice_variation3.phpt
new file mode 100644
index 0000000..46b4443
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation3.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with emptyUnsetUndefNull values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
+
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation_array = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with emptyUnsetUndefNull values ***
+bool(true)
+bool(true)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation5.phpt b/ext/standard/tests/general_functions/proc_nice_variation5.phpt
new file mode 100644
index 0000000..c22ca56
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation5.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with int values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+ if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+ if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with int values ***\n";
+
+
+
+$variation_array = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with int values ***
+bool(true)
+bool(true)
+bool(true)
+
+Warning: proc_nice(): Only a super user may attempt to increase the priority of a process in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation6.phpt b/ext/standard/tests/general_functions/proc_nice_variation6.phpt
new file mode 100644
index 0000000..d52c0c0
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation6.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with object values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with object values ***\n";
+
+
+
+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');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation_array = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with object values ***
+Error: 2 - proc_nice() expects parameter 1 to be long, object given, %s(%d)
+bool(false)
+Error: 2 - proc_nice() expects parameter 1 to be long, object given, %s(%d)
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_nice_variation7.phpt b/ext/standard/tests/general_functions/proc_nice_variation7.phpt
new file mode 100644
index 0000000..26dbab5
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_nice_variation7.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test function proc_nice() by substituting argument 1 with string values.
+--CREDITS--
+Italian PHP TestFest 2009 Cesena 19-20-21 june
+Fabio Fabbrucci (fabbrucci@grupporetina.com)
+Michele Orselli (mo@ideato.it)
+Simone Gentili (sensorario@gmail.com)
+--SKIPIF--
+<?php
+if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
+?>
+--FILE--
+<?php
+
+
+echo "*** Test substituting argument 1 with string values ***\n";
+
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(proc_nice( $var ) );
+}
+?>
+--EXPECTF--
+*** Test substituting argument 1 with string values ***
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
+
+Warning: proc_nice() expects parameter 1 to be long, string given in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt
new file mode 100644
index 0000000..ecf8d8a
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_open.phpt
@@ -0,0 +1,28 @@
+--TEST--
+proc_open
+--SKIPIF--
+<?php # vim:syn=php
+if (!is_executable("/bin/cat")) echo "skip";
+if (!function_exists("proc_open")) echo "skip proc_open() is not available";
+?>
+--FILE--
+<?php
+$ds = array(
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w")
+ );
+
+$cat = proc_open(
+ "/bin/cat",
+ $ds,
+ $pipes
+ );
+
+proc_close($cat);
+
+echo "I didn't segfault!\n";
+
+?>
+--EXPECT--
+I didn't segfault!
diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt
new file mode 100644
index 0000000..d5d878e
--- /dev/null
+++ b/ext/standard/tests/general_functions/proc_open02.phpt
@@ -0,0 +1,72 @@
+--TEST--
+proc_open
+--SKIPIF--
+<?php
+if (!is_executable('/bin/sleep')) echo 'skip no sleep';
+if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
+?>
+--FILE--
+<?php
+$ds = array(array('pipe', 'r'));
+
+$cat = proc_open(
+ '/bin/sleep 2',
+ $ds,
+ $pipes
+);
+
+usleep(20000); // let the OS run the sleep process before sending the signal
+
+var_dump(proc_terminate($cat, 0)); // status check
+usleep(20000);
+var_dump(proc_get_status($cat));
+
+var_dump(proc_terminate($cat)); // now really quit it
+usleep(20000);
+var_dump(proc_get_status($cat));
+
+proc_close($cat);
+
+echo "Done!\n";
+
+?>
+--EXPECTF--
+bool(true)
+array(8) {
+ ["command"]=>
+ string(12) "/bin/sleep 2"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(true)
+ ["signaled"]=>
+ bool(false)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(0)
+ ["stopsig"]=>
+ int(0)
+}
+bool(true)
+array(8) {
+ ["command"]=>
+ string(12) "/bin/sleep 2"
+ ["pid"]=>
+ int(%d)
+ ["running"]=>
+ bool(false)
+ ["signaled"]=>
+ bool(true)
+ ["stopped"]=>
+ bool(false)
+ ["exitcode"]=>
+ int(-1)
+ ["termsig"]=>
+ int(15)
+ ["stopsig"]=>
+ int(0)
+}
+Done!
diff --git a/ext/standard/tests/general_functions/putenv.phpt b/ext/standard/tests/general_functions/putenv.phpt
new file mode 100644
index 0000000..afe1bad
--- /dev/null
+++ b/ext/standard/tests/general_functions/putenv.phpt
@@ -0,0 +1,28 @@
+--TEST--
+putenv() basic tests
+--FILE--
+<?php
+
+$var_name="SUCHVARSHOULDNOTEXIST";
+
+var_dump(getenv($var_name));
+var_dump(putenv($var_name."=value"));
+var_dump(getenv($var_name));
+
+var_dump(putenv($var_name."="));
+var_dump(getenv($var_name));
+
+var_dump(putenv($var_name));
+var_dump(getenv($var_name));
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+bool(true)
+string(5) "value"
+bool(true)
+string(0) ""
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt
new file mode 100644
index 0000000..e3ad8de
--- /dev/null
+++ b/ext/standard/tests/general_functions/rand.phpt
@@ -0,0 +1,63 @@
+--TEST--
+rand() and mt_rand() tests
+--FILE--
+<?php
+
+var_dump(mt_rand());
+var_dump(mt_rand(-1));
+var_dump(mt_rand(-1,1));
+var_dump(mt_rand(0,3));
+
+var_dump(rand());
+var_dump(rand(-1));
+var_dump(rand(-1,1));
+var_dump(rand(0,3));
+
+var_dump(srand());
+var_dump(srand(-1));
+var_dump(srand(array()));
+
+var_dump(mt_srand());
+var_dump(mt_srand(-1));
+var_dump(mt_srand(array()));
+
+var_dump(getrandmax());
+var_dump(getrandmax(1));
+
+var_dump(mt_getrandmax());
+var_dump(mt_getrandmax(1));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(%d)
+
+Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+int(%i)
+int(%d)
+int(%d)
+
+Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+int(%i)
+int(%d)
+NULL
+NULL
+
+Warning: srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+NULL
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+int(%d)
+
+Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+int(%d)
+
+Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt b/ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt
new file mode 100644
index 0000000..ad786fb
--- /dev/null
+++ b/ext/standard/tests/general_functions/set_magic_quotes_runtime_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test set_magic_quotes_runtime() function - basic test
+--INI--
+magic_quotes_runtime = 0
+--FILE--
+<?php
+/* Prototype: bool set_magic_quotes_runtime ( int $new_setting )
+ * Description: Sets the current active configuration setting of magic_quotes_runtime
+*/
+
+echo "Simple testcase for set_magic_quotes_runtime() function - basic test\n";
+
+$g = get_magic_quotes_runtime();
+echo "\n-- magic quotes runtime set in INI file: " . $g . "--\n";
+
+echo "\n-- Set magic quotes runtime to 0: --\n";
+var_dump(set_magic_quotes_runtime(0));
+$g = get_magic_quotes_runtime();
+echo "\n-- magic quotes runtime after set: " . $g . " --\n";
+
+echo "\n-- Set magic quotes runtime to 1: --\n";
+var_dump(set_magic_quotes_runtime(1));
+$g = get_magic_quotes_runtime();
+echo "\n-- magic quotes runtime after set: " . $g . " --\n";
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for set_magic_quotes_runtime() function - basic test
+
+-- magic quotes runtime set in INI file: --
+
+-- Set magic quotes runtime to 0: --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+bool(false)
+
+-- magic quotes runtime after set: --
+
+-- Set magic quotes runtime to 1: --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+
+Fatal error: set_magic_quotes_runtime(): magic_quotes_runtime is not supported anymore in Unknown on line 0
+
+
diff --git a/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt b/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt
new file mode 100644
index 0000000..c54846c
--- /dev/null
+++ b/ext/standard/tests/general_functions/set_magic_quotes_runtime_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test set_magic_quotes_runtime() function - error conditions - pass function incorrect arguments
+--FILE--
+<?php
+/* Prototype: bool set_magic_quotes_runtime ( int $new_setting )
+ * Description: Sets the current active configuration setting of magic_quotes_runtime
+*/
+
+echo "Simple testcase for set_magic_quotes_runtime() - error test\n";
+
+//Note: No error msgs on invalid input; just a return value of FALSE
+
+echo "\n-- Testing set_magic_quotes_runtime() function with less than expected no. of arguments --\n";
+var_dump(set_magic_quotes_runtime());
+
+echo "\n-- Testing set_magic_quotes_runtime() function with more than expected no. of arguments --\n";
+var_dump(set_magic_quotes_runtime(1, true));
+
+?>
+===DONE===
+--EXPECTF--
+Simple testcase for set_magic_quotes_runtime() - error test
+
+-- Testing set_magic_quotes_runtime() function with less than expected no. of arguments --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+
+Warning: set_magic_quotes_runtime() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing set_magic_quotes_runtime() function with more than expected no. of arguments --
+
+Deprecated: Function set_magic_quotes_runtime() is deprecated in %s on line %d
+
+Warning: set_magic_quotes_runtime() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt
new file mode 100644
index 0000000..5d7fe53
--- /dev/null
+++ b/ext/standard/tests/general_functions/sleep_basic.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sleep() function : basic functionality
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--FILE--
+<?php
+/* Prototype : int sleep ( int $seconds )
+ * Description: Delays the program execution for the given number of seconds .
+ * Source code: ext/standard/basic_functions.c
+ */
+
+echo "*** Testing sleep() : basic functionality ***\n";
+
+$sleeptime = 5; // sleep for 5 seconds
+
+set_time_limit(20);
+
+$time_start = microtime(true);
+
+// Sleep for a while
+sleep($sleeptime);
+
+// Test passes if sleeps for at least 98% of specified time
+$sleeplow = $sleeptime - ($sleeptime * 2 /100);
+
+$time_end = microtime(true);
+$time = $time_end - $time_start;
+
+echo "Thread slept for " . $time . " seconds\n";
+
+if ($time >= $sleeplow) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing sleep() : basic functionality ***
+Thread slept for %f seconds
+TEST PASSED
+===DONE===
diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt
new file mode 100644
index 0000000..199bd8e
--- /dev/null
+++ b/ext/standard/tests/general_functions/sleep_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test sleep() function : error conditions
+--FILE--
+<?php
+/* Prototype : int sleep ( int $seconds )
+ * Description: Delays the program execution for the given number of seconds .
+ * Source code: ext/standard/basic_functions.c
+ */
+ set_time_limit(20);
+
+echo "*** Testing sleep() : error conditions ***\n";
+
+echo "\n-- Testing sleep() function with zero arguments --\n";
+var_dump( sleep() );
+
+echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
+$seconds = 10;
+$extra_arg = 10;
+var_dump( sleep($seconds, $extra_arg) );
+
+echo "\n-- Testing sleep() function with negative interval --\n";
+$seconds = -10;
+var_dump( sleep($seconds) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing sleep() : error conditions ***
+
+-- Testing sleep() function with zero arguments --
+
+Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing sleep() function with more than expected no. of arguments --
+
+Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- Testing sleep() function with negative interval --
+
+Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt
new file mode 100644
index 0000000..b92be41
--- /dev/null
+++ b/ext/standard/tests/general_functions/strval.phpt
@@ -0,0 +1,317 @@
+--TEST--
+Test strval() function
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: string strval ( mixed $var );
+ * Description: Returns the string value of var
+ */
+
+echo "*** Testing str_val() with scalar values***\n";
+$heredoc_string = <<<EOD
+This is a multiline heredoc
+string. Numeric = 1232455.
+EOD;
+/* heredoc string with only numeric values */
+$heredoc_numeric_string = <<<EOD
+12345
+2345
+EOD;
+/* null heredoc string */
+$heredoc_empty_string = <<<EOD
+EOD;
+/* heredoc string with NULL */
+$heredoc_NULL_string = <<<EOD
+NULL
+EOD;
+
+// different valid scalar vlaues
+$scalars = array(
+ /* integers */
+ 0,
+ 1,
+ -1,
+ -2147483648, // max negative integer value
+ -2147483647,
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ 0x12ab,
+ 0Xfff,
+ 0XFA,
+
+ /* floats */
+ -0x80000000, // max negative integer as hexadecimal
+ 0x7fffffff, // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ 0123, // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e-5,
+ .5e+7,
+ .6e-19,
+ .05E+44,
+ .0034E-30,
+
+ /* booleans */
+ true,
+ TRUE,
+ FALSE,
+ false,
+
+ /* strings */
+ "",
+ '',
+ " ",
+ ' ',
+ '0',
+ "0",
+ "testing",
+ "0x564",
+ "0123",
+ "new\n",
+ 'new\n',
+ "@#$$%^&&*()",
+ " ",
+ "null",
+ 'null',
+ 'true',
+ "true",
+ /*"\0123",
+ "\0x12FF",*/
+ $heredoc_string,
+ $heredoc_numeric_string,
+ $heredoc_empty_string
+);
+/* loop to check that strval() recognizes different
+ scalar values and retuns the string conversion of same */
+$loop_counter = 1;
+foreach ($scalars as $scalar ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( strval($scalar) );
+}
+
+echo "\n*** Testing strval() with non_scalar values ***\n";
+// get a resource type variable
+$fp = fopen(__FILE__, "r");
+$dfp = opendir( dirname(__FILE__) );
+
+// unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// non_scalar values, objects, arrays, resources and boolean
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+
+$not_scalars = array (
+ new foo, //object
+ $fp, // resource
+ $dfp,
+ array(), // arrays
+ array(NULL),
+ array(1,2,3,4),
+ array("string"),
+ NULL, // nulls
+ null,
+ @$unset_var, // unset variable
+ @$undefined_var
+);
+/* loop through the $not_scalars to see working of
+ strval() on objects, arrays, boolean and others */
+$loop_counter = 1;
+foreach ($not_scalars as $value ) {
+ echo "-- Iteration $loop_counter --\n"; $loop_counter++;
+ var_dump( strval($value) );
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_dump( strval() );
+
+//arguments more than expected
+var_dump( strval( $scalars[0], $scalars[1]) );
+
+echo "Done\n";
+
+// close the resources used
+fclose($fp);
+closedir($dfp);
+
+?>
+--EXPECTF--
+*** Testing str_val() with scalar values***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(2) "-1"
+-- Iteration 4 --
+string(11) "-2147483648"
+-- Iteration 5 --
+string(11) "-2147483647"
+-- Iteration 6 --
+string(10) "2147483647"
+-- Iteration 7 --
+string(10) "2147483640"
+-- Iteration 8 --
+string(4) "4667"
+-- Iteration 9 --
+string(4) "4779"
+-- Iteration 10 --
+string(4) "4095"
+-- Iteration 11 --
+string(3) "250"
+-- Iteration 12 --
+string(11) "-2147483648"
+-- Iteration 13 --
+string(10) "2147483647"
+-- Iteration 14 --
+string(10) "2147483647"
+-- Iteration 15 --
+string(2) "83"
+-- Iteration 16 --
+string(1) "1"
+-- Iteration 17 --
+string(11) "-2147483648"
+-- Iteration 18 --
+string(10) "2147483647"
+-- Iteration 19 --
+string(11) "-2147483649"
+-- Iteration 20 --
+string(10) "2147483648"
+-- Iteration 21 --
+string(11) "-2147483649"
+-- Iteration 22 --
+string(11) "34359738369"
+-- Iteration 23 --
+string(10) "2147483649"
+-- Iteration 24 --
+string(11) "-2147483649"
+-- Iteration 25 --
+string(1) "0"
+-- Iteration 26 --
+string(4) "-0.1"
+-- Iteration 27 --
+string(2) "10"
+-- Iteration 28 --
+string(7) "1050000"
+-- Iteration 29 --
+string(6) "1.0E-5"
+-- Iteration 30 --
+string(7) "5000000"
+-- Iteration 31 --
+string(7) "6.0E-20"
+-- Iteration 32 --
+string(7) "5.0E+42"
+-- Iteration 33 --
+string(7) "3.4E-33"
+-- Iteration 34 --
+string(1) "1"
+-- Iteration 35 --
+string(1) "1"
+-- Iteration 36 --
+string(0) ""
+-- Iteration 37 --
+string(0) ""
+-- Iteration 38 --
+string(0) ""
+-- Iteration 39 --
+string(0) ""
+-- Iteration 40 --
+string(1) " "
+-- Iteration 41 --
+string(1) " "
+-- Iteration 42 --
+string(1) "0"
+-- Iteration 43 --
+string(1) "0"
+-- Iteration 44 --
+string(7) "testing"
+-- Iteration 45 --
+string(5) "0x564"
+-- Iteration 46 --
+string(4) "0123"
+-- Iteration 47 --
+string(4) "new
+"
+-- Iteration 48 --
+string(5) "new\n"
+-- Iteration 49 --
+string(11) "@#$$%^&&*()"
+-- Iteration 50 --
+string(8) " "
+-- Iteration 51 --
+string(4) "null"
+-- Iteration 52 --
+string(4) "null"
+-- Iteration 53 --
+string(4) "true"
+-- Iteration 54 --
+string(4) "true"
+-- Iteration 55 --
+string(5%d) "This is a multiline heredoc
+string. Numeric = 1232455."
+-- Iteration 56 --
+string(1%d) "12345
+2345"
+-- Iteration 57 --
+string(0) ""
+
+*** Testing strval() with non_scalar values ***
+-- Iteration 1 --
+string(6) "Object"
+-- Iteration 2 --
+string(14) "Resource id #5"
+-- Iteration 3 --
+string(14) "Resource id #6"
+-- Iteration 4 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 5 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 6 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %sstrval.php on line %d
+string(5) "Array"
+-- Iteration 8 --
+string(0) ""
+-- Iteration 9 --
+string(0) ""
+-- Iteration 10 --
+string(0) ""
+-- Iteration 11 --
+string(0) ""
+
+*** Testing error conditions ***
+
+Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt
new file mode 100644
index 0000000..a788e32
--- /dev/null
+++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt
@@ -0,0 +1,27 @@
+--TEST--
+sys_getloadavg() tests
+--SKIPIF--
+<?php
+if (!function_exists("sys_getloadavg")) die("skip");
+?>
+--FILE--
+<?php
+
+var_dump(sys_getloadavg(""));
+var_dump(sys_getloadavg());
+
+echo "Done\n";
+?>
+--EXPECTF--
+
+Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s
+NULL
+array(3) {
+ [0]=>
+ float(%f)
+ [1]=>
+ float(%f)
+ [2]=>
+ float(%f)
+}
+Done
diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt
new file mode 100644
index 0000000..98eccbb
--- /dev/null
+++ b/ext/standard/tests/general_functions/type.phpt
@@ -0,0 +1,351 @@
+--TEST--
+gettype(), settype() and friends
+--FILE--
+<?php
+
+function foo($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
+}
+
+set_error_handler("foo");
+
+$fp = fopen(__FILE__, "r");
+fclose($fp);
+$fp1 = fopen(__FILE__, "r");
+
+$var1 = "another string";
+$var2 = array(2,3,4);
+
+$array = array(
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ 2.0,
+ NULL,
+ false,
+ "some string",
+ $fp,
+ $fp1,
+ new stdclass,
+);
+
+$types = array(
+ "null",
+ "integer",
+ "double",
+ "boolean",
+ "resource",
+ "array",
+ "object",
+ "string"
+ );
+
+foreach ($array as $var) {
+ var_dump(gettype($var));
+}
+
+foreach ($types as $type) {
+ foreach ($array as $var) {
+ var_dump(settype($var, $type));
+ var_dump($var);
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) "array"
+string(6) "string"
+string(5) "array"
+string(7) "integer"
+string(6) "double"
+string(4) "NULL"
+string(7) "boolean"
+string(6) "string"
+string(12) "unknown type"
+string(8) "resource"
+string(6) "object"
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+NULL
+bool(true)
+int(1)
+bool(true)
+int(0)
+bool(true)
+int(1)
+bool(true)
+int(1)
+bool(true)
+int(2)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(0)
+bool(true)
+int(5)
+bool(true)
+int(6)
+string(54) "Object of class stdClass could not be converted to int"
+bool(true)
+int(%d)
+bool(true)
+float(1)
+bool(true)
+float(0)
+bool(true)
+float(1)
+bool(true)
+float(1)
+bool(true)
+float(2)
+bool(true)
+float(0)
+bool(true)
+float(0)
+bool(true)
+float(0)
+bool(true)
+float(5)
+bool(true)
+float(6)
+string(57) "Object of class stdClass could not be converted to double"
+bool(true)
+float(%d)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+string(14) "another string"
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+int(1)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+float(2)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+NULL
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+bool(false)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+string(11) "some string"
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+resource(%d) of type (Unknown)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+resource(%d) of type (stream)
+string(42) "settype(): Cannot convert to resource type"
+bool(false)
+object(stdClass)#%d (0) {
+}
+bool(true)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(14) "another string"
+}
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+bool(true)
+array(1) {
+ [0]=>
+ int(1)
+}
+bool(true)
+array(1) {
+ [0]=>
+ float(2)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+array(1) {
+ [0]=>
+ bool(false)
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(11) "some string"
+}
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (Unknown)
+}
+bool(true)
+array(1) {
+ [0]=>
+ resource(%d) of type (stream)
+}
+bool(true)
+array(0) {
+}
+bool(true)
+object(stdClass)#%d (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ string(14) "another string"
+}
+bool(true)
+object(stdClass)#%d (3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ int(1)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ float(2)
+}
+bool(true)
+object(stdClass)#%d (0) {
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ bool(false)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ string(11) "some string"
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ resource(%d) of type (Unknown)
+}
+bool(true)
+object(stdClass)#%d (1) {
+ ["scalar"]=>
+ resource(%d) of type (stream)
+}
+bool(true)
+object(stdClass)#%d (0) {
+}
+string(26) "Array to string conversion"
+bool(true)
+string(5) "Array"
+bool(true)
+string(14) "another string"
+string(26) "Array to string conversion"
+bool(true)
+string(5) "Array"
+bool(true)
+string(1) "1"
+bool(true)
+string(1) "2"
+bool(true)
+string(0) ""
+bool(true)
+string(0) ""
+bool(true)
+string(11) "some string"
+bool(true)
+string(14) "Resource id #%d"
+bool(true)
+string(14) "Resource id #%d"
+string(57) "Object of class stdClass could not be converted to string"
+string(45) "Object of class stdClass to string conversion"
+bool(true)
+string(6) "Object"
+Done
diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt
new file mode 100644
index 0000000..2da832b
--- /dev/null
+++ b/ext/standard/tests/general_functions/uniqid_basic.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test uniqid() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : basic functionality ***\n";
+
+echo "\nuniqid() without a prefix\n";
+var_dump(uniqid());
+var_dump(uniqid(null, true));
+var_dump(uniqid(null, false));
+echo "\n\n";
+
+echo "uniqid() with a prefix\n";
+
+// Use a fixed prefix so we can ensure length of o/p id is fixed
+$prefix = array (
+ 99999,
+ "99999",
+ 10.5e2,
+ null,
+ true,
+ false
+ );
+
+for ($i = 0; $i < count($prefix); $i++) {
+ var_dump(uniqid($prefix[$i]));
+ var_dump(uniqid($prefix[$i], true));
+ var_dump(uniqid($prefix[$i], false));
+ echo "\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uniqid() : basic functionality ***
+
+uniqid() without a prefix
+string(13) "%s"
+string(23) "%s.%s"
+string(13) "%s"
+
+
+uniqid() with a prefix
+string(18) "99999%s"
+string(28) "99999%s.%s"
+string(18) "99999%s"
+
+string(18) "99999%s"
+string(28) "99999%s.%s"
+string(18) "99999%s"
+
+string(17) "1050%s"
+string(27) "1050%s.%s"
+string(17) "1050%s"
+
+string(13) "%s"
+string(23) "%s.%s"
+string(13) "%s"
+
+string(14) "1%s"
+string(24) "1%s.%s"
+string(14) "1%s"
+
+string(13) "%s"
+string(23) "%s.%s"
+string(13) "%s"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/uniqid_error.phpt b/ext/standard/tests/general_functions/uniqid_error.phpt
new file mode 100644
index 0000000..9608431
--- /dev/null
+++ b/ext/standard/tests/general_functions/uniqid_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test uniqid() function : error conditions
+--FILE--
+<?php
+/* Prototype : string uniqid ([ string $prefix= "" [, bool $more_entropy= false ]] )
+ * Description: Gets a prefixed unique identifier based on the current time in microseconds.
+ * Source code: ext/standard/uniqid.c
+*/
+echo "*** Testing uniqid() : error conditions ***\n";
+
+echo "\n-- Testing uniqid() function with more than expected no. of arguments --\n";
+$prefix = null;
+$more_entropy = false;
+$extra_arg = false;
+var_dump(uniqid($prefix, $more_entropy, $extra_arg));
+
+echo "\n-- Testing uniqid() function with invalid values for \$prefix --\n";
+class class1{}
+$obj = new class1();
+$res = fopen(__FILE__, "r");
+$array = array(1,2,3);
+
+uniqid($array, false);
+uniqid($res, false);
+uniqid($obj, false);
+
+fclose($res);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing uniqid() : error conditions ***
+
+-- Testing uniqid() function with more than expected no. of arguments --
+
+Warning: uniqid() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing uniqid() function with invalid values for $prefix --
+
+Warning: uniqid() expects parameter 1 to be string, array given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, resource given in %s on line %d
+
+Warning: uniqid() expects parameter 1 to be string, object given in %s on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt
new file mode 100644
index 0000000..d6f312e
--- /dev/null
+++ b/ext/standard/tests/general_functions/usleep_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test usleep() function
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+?>
+--FILE--
+<?php
+/* Prototype : void usleep ( int $micro_seconds )
+ * Description: Delays program execution for the given number of micro seconds.
+ * Source code: ext/standard/basic_functions.c
+ */
+
+set_time_limit(20);
+
+echo "*** Testing usleep() : basic functionality ***\n";
+
+$sleeptime = 5000000; // == 5 seconds
+// Test passes if sleeps for at least 98% of specified time
+$sleeplow = $sleeptime - ($sleeptime * 2 /100);
+
+$time_start = microtime(true);
+
+// Sleep for a while
+usleep($sleeptime);
+
+$time_end = microtime(true);
+$time = ($time_end - $time_start) * 1000 * 1000;
+
+echo "Thread slept for " . $time . " micro-seconds\n";
+
+if ($time >= $sleeplow) {
+ echo "TEST PASSED\n";
+} else {
+ echo "TEST FAILED\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing usleep() : basic functionality ***
+Thread slept for %f micro-seconds
+TEST PASSED
+===DONE===
diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt
new file mode 100644
index 0000000..bdd120c
--- /dev/null
+++ b/ext/standard/tests/general_functions/usleep_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test usleep() function : error conditions
+--FILE--
+<?php
+/* Prototype : void usleep ( int $micro_seconds )
+ * Description: Delays program execution for the given number of micro seconds.
+ * Source code: ext/standard/basic_functions.c
+ */
+
+set_time_limit(20);
+
+echo "*** Testing usleep() : error conditions ***\n";
+
+echo "\n-- Testing usleep() function with zero arguments --\n";
+var_dump( usleep() );
+
+echo "\n-- Testing usleep() function with more than expected no. of arguments --\n";
+$seconds = 10;
+$extra_arg = 10;
+var_dump( usleep($seconds, $extra_arg) );
+
+echo "\n-- Testing usleep() function with negative interval --\n";
+$seconds = -10;
+var_dump( usleep($seconds) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing usleep() : error conditions ***
+
+-- Testing usleep() function with zero arguments --
+
+Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing usleep() function with more than expected no. of arguments --
+
+Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Testing usleep() function with negative interval --
+
+Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt
new file mode 100644
index 0000000..09e9f3b
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_dump.phpt
@@ -0,0 +1,1574 @@
+--TEST--
+Test var_dump() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: void var_dump ( mixed $expression [, mixed $expression [, $...]] );
+ Description: Displays structured information about one or more expressions that includes its type and value.
+*/
+
+/* Prototype: void check_vardump( $variables );
+ Description: use var_dump() to display the variables */
+function check_vardump( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "-- Iteration $counter --\n";
+ var_dump($variable);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing var_dump() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_vardump() to display contents of integer variables
+ using var_dump() */
+check_vardump($integers);
+
+echo "\n*** Testing var_dump() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_vardump() to display contents of float variables
+ using var_dump() */
+check_vardump($floats);
+
+echo "\n*** Testing var_dump() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_vardump() to display contents of strings
+ using var_dump() */
+check_vardump($strings);
+
+echo "\n*** Testing var_dump() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_vardump() to display boolean variables
+ using var_dump() */
+check_vardump($booleans);
+
+echo "\n*** Testing var_dump() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_vardump() to display contents of an array
+ using var_dump() */
+check_vardump($arrays);
+
+echo "\n*** Testing var_dump() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_vardump() to display contents of the objects
+ using var_dump() */
+check_vardump($objects);
+
+echo "\n** Testing var_dump() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+var_dump($recursion_obj2);
+
+echo "\n*** Testing var_dump() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_vardump() to display the resource content type
+ using var_dump() */
+check_vardump($resources);
+
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_vardump() to display combinations of scalar and
+ non-scalar variables using var_dump() */
+check_vardump($variations);
+
+echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_vardump() to display miscelleneous data using var_dump() */
+check_vardump($misc_values);
+
+echo "\n*** Testing var_dump() on multiple arguments ***\n";
+var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
+ $objects, $misc_values, $variations );
+
+/* checking var_dump() on functions */
+echo "\n*** Testing var_dump() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+var_dump( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump();
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing var_dump() on integer variables ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(83)
+-- Iteration 3 --
+int(123000000)
+-- Iteration 4 --
+int(-83)
+-- Iteration 5 --
+int(-12300000)
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+}
+-- Iteration 8 --
+int(2147483647)
+-- Iteration 9 --
+float(2147483648)
+-- Iteration 10 --
+float(-2147483648)
+-- Iteration 11 --
+int(-2147483647)
+-- Iteration 12 --
+int(2147483647)
+-- Iteration 13 --
+float(-2147483648)
+-- Iteration 14 --
+int(2147483647)
+-- Iteration 15 --
+float(-2147483648)
+
+*** Testing var_dump() on float variables ***
+-- Iteration 1 --
+float(0)
+-- Iteration 2 --
+float(0)
+-- Iteration 3 --
+float(1.234)
+-- Iteration 4 --
+float(-1.234)
+-- Iteration 5 --
+float(-2)
+-- Iteration 6 --
+float(2)
+-- Iteration 7 --
+float(-0.5)
+-- Iteration 8 --
+float(0.567)
+-- Iteration 9 --
+float(-0.00067)
+-- Iteration 10 --
+float(-670)
+-- Iteration 11 --
+float(670)
+-- Iteration 12 --
+float(670)
+-- Iteration 13 --
+float(-0.00410003)
+-- Iteration 14 --
+float(-4100.03)
+-- Iteration 15 --
+float(0.004100003)
+-- Iteration 16 --
+float(4100.003)
+-- Iteration 17 --
+float(100000)
+-- Iteration 18 --
+float(-100000)
+-- Iteration 19 --
+float(1.0E-5)
+-- Iteration 20 --
+float(-1.0E-5)
+-- Iteration 21 --
+float(100000)
+-- Iteration 22 --
+float(-100000)
+-- Iteration 23 --
+float(100000)
+-- Iteration 24 --
+float(-100000)
+-- Iteration 25 --
+float(100000)
+-- Iteration 26 --
+float(-100000)
+-- Iteration 27 --
+float(1.0E-5)
+-- Iteration 28 --
+float(-1.0E-5)
+-- Iteration 29 --
+float(-2147483649)
+-- Iteration 30 --
+float(2147483649)
+-- Iteration 31 --
+float(2147483649)
+-- Iteration 32 --
+float(-2147483649)
+
+*** Testing var_dump() on string variables ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(1) " "
+-- Iteration 4 --
+string(1) " "
+-- Iteration 5 --
+string(1) "0"
+-- Iteration 6 --
+string(1) "
+-- Iteration 7 --
+string(2) "\0"
+-- Iteration 8 --
+string(1) " "
+-- Iteration 9 --
+string(2) "\t"
+-- Iteration 10 --
+string(3) "PHP"
+-- Iteration 11 --
+string(3) "PHP"
+-- Iteration 12 --
+string(29) "abcd
+-- Iteration 13 --
+string(34) "abcd
+-- Iteration 14 --
+string(22) "1234
+5678
+ 9100 abcda"
+
+*** Testing var_dump() on boolean variables ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+
+*** Testing var_dump() on array variables ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+-- Iteration 9 --
+array(1) {
+ [1]=>
+ string(3) "One"
+}
+-- Iteration 10 --
+array(1) {
+ ["test"]=>
+ string(8) "is_array"
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ int(-1)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+
+*** Testing var_dump() on object variables ***
+-- Iteration 1 --
+object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 2 --
+object(no_member_class)#7 (0) {
+}
+-- Iteration 3 --
+object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 4 --
+object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 5 --
+object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 6 --
+object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 7 --
+object(no_member_class)#4 (0) {
+}
+-- Iteration 8 --
+object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 9 --
+NULL
+
+** Testing var_dump() on objects having circular reference **
+object(object_class)#13 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#12 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ *RECURSION*
+ }
+}
+
+*** Testing var_dump() on resources ***
+-- Iteration 1 --
+resource(5) of type (stream)
+-- Iteration 2 --
+resource(6) of type (stream)
+
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+}
+
+*** Testing var_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL
+-- Iteration 2 --
+NULL
+-- Iteration 3 --
+NULL
+-- Iteration 4 --
+NULL
+
+*** Testing var_dump() on multiple arguments ***
+array(15) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(83)
+ [2]=>
+ int(123000000)
+ [3]=>
+ int(-83)
+ [4]=>
+ int(-12300000)
+ [5]=>
+ array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+ }
+ [6]=>
+ array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+ }
+ [7]=>
+ int(2147483647)
+ [8]=>
+ float(2147483648)
+ [9]=>
+ float(-2147483648)
+ [10]=>
+ int(-2147483647)
+ [11]=>
+ int(2147483647)
+ [12]=>
+ float(-2147483648)
+ [13]=>
+ int(2147483647)
+ [14]=>
+ float(-2147483648)
+}
+array(32) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(0)
+ [2]=>
+ float(1.234)
+ [3]=>
+ float(-1.234)
+ [4]=>
+ float(-2)
+ [5]=>
+ float(2)
+ [6]=>
+ float(-0.5)
+ [7]=>
+ float(0.567)
+ [8]=>
+ float(-0.00067)
+ [9]=>
+ float(-670)
+ [10]=>
+ float(670)
+ [11]=>
+ float(670)
+ [12]=>
+ float(-0.00410003)
+ [13]=>
+ float(-4100.03)
+ [14]=>
+ float(0.004100003)
+ [15]=>
+ float(4100.003)
+ [16]=>
+ float(100000)
+ [17]=>
+ float(-100000)
+ [18]=>
+ float(1.0E-5)
+ [19]=>
+ float(-1.0E-5)
+ [20]=>
+ float(100000)
+ [21]=>
+ float(-100000)
+ [22]=>
+ float(100000)
+ [23]=>
+ float(-100000)
+ [24]=>
+ float(100000)
+ [25]=>
+ float(-100000)
+ [26]=>
+ float(1.0E-5)
+ [27]=>
+ float(-1.0E-5)
+ [28]=>
+ float(-2147483649)
+ [29]=>
+ float(2147483649)
+ [30]=>
+ float(2147483649)
+ [31]=>
+ float(-2147483649)
+}
+array(14) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(1) "
+ [6]=>
+ string(2) "\0"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(3) "PHP"
+ [10]=>
+ string(3) "PHP"
+ [11]=>
+ string(29) "abcd
+ [12]=>
+ string(34) "abcd
+ [13]=>
+ string(22) "1234
+5678
+ 9100 abcda"
+}
+array(15) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ bool(true)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [5]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [6]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ }
+ [7]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ }
+ [8]=>
+ array(1) {
+ [1]=>
+ string(3) "One"
+ }
+ [9]=>
+ array(1) {
+ ["test"]=>
+ string(8) "is_array"
+ }
+ [10]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [11]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [12]=>
+ array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+ }
+ [13]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+ [14]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(2) {
+ [0]=>
+ resource(5) of type (stream)
+ [1]=>
+ resource(6) of type (stream)
+}
+array(9) {
+ [0]=>
+ object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [1]=>
+ object(no_member_class)#7 (0) {
+ }
+ [2]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [3]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [4]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [5]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [6]=>
+ object(no_member_class)#4 (0) {
+ }
+ [7]=>
+ object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [8]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+ }
+ [3]=>
+ array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+ }
+ [4]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+ }
+ [5]=>
+ array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+ }
+}
+
+*** Testing var_dump() on anonymous functions ***
+New anonymous function:
+string(9) "2 * 3 = 6"
+string(9) "
+
+*** Testing error conditions ***
+
+Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
+Done
+
diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt
new file mode 100644
index 0000000..a81980c
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt
@@ -0,0 +1,1574 @@
+--TEST--
+Test var_dump() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: void var_dump ( mixed $expression [, mixed $expression [, $...]] );
+ Description: Displays structured information about one or more expressions that includes its type and value.
+*/
+
+/* Prototype: void check_vardump( $variables );
+ Description: use var_dump() to display the variables */
+function check_vardump( $variables ) {
+ $counter = 1;
+ foreach( $variables as $variable ) {
+ echo "-- Iteration $counter --\n";
+ var_dump($variable);
+ $counter++;
+ }
+}
+
+echo "\n*** Testing var_dump() on integer variables ***\n";
+$integers = array (
+ 0, // zero as argument
+ 000000123, //octal value of 83
+ 123000000,
+ -00000123, //octal value of 83
+ -12300000,
+ range(1,10), // positive values
+ range(-1,-10), // negative values
+ +2147483647, // max positive integer
+ +2147483648, // max positive integer + 1
+ -2147483648, // min range of integer
+ -2147483647, // min range of integer + 1
+ 0x7FFFFFFF, // max positive hexadecimal integer
+ -0x80000000, // min range of hexadecimal integer
+ 017777777777, // max posotive octal integer
+ -020000000000 // min range of octal integer
+);
+/* calling check_vardump() to display contents of integer variables
+ using var_dump() */
+check_vardump($integers);
+
+echo "\n*** Testing var_dump() on float variables ***\n";
+$floats = array (
+ -0.0,
+ +0.0,
+ 1.234,
+ -1.234,
+ -2.000000,
+ 000002.00,
+ -.5,
+ .567,
+ -.6700000e-3,
+ -.6700000E+3,
+ .6700000E+3,
+ .6700000e+3,
+ -4.10003e-3,
+ -4.10003E+3,
+ 4.100003e-3,
+ 4.100003E+3,
+ 1e5,
+ -1e5,
+ 1e-5,
+ -1e-5,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ 1E-5,
+ -1E-5,
+ -0x80000001, // float value, beyond max negative int
+ 0x80000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001 // float value, beyond max negative int
+);
+/* calling check_vardump() to display contents of float variables
+ using var_dump() */
+check_vardump($floats);
+
+echo "\n*** Testing var_dump() on string variables ***\n";
+$strings = array (
+ "",
+ '',
+ " ",
+ ' ',
+ "0",
+ "\0",
+ '\0',
+ "\t",
+ '\t',
+ "PHP",
+ 'PHP',
+ "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
+ "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
+ "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+);
+/* calling check_vardump() to display contents of strings
+ using var_dump() */
+check_vardump($strings);
+
+echo "\n*** Testing var_dump() on boolean variables ***\n";
+$booleans = array (
+ TRUE,
+ FALSE,
+ true,
+ false
+);
+/* calling check_vardump() to display boolean variables
+ using var_dump() */
+check_vardump($booleans);
+
+echo "\n*** Testing var_dump() on array variables ***\n";
+$arrays = array (
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test'),
+);
+/* calling check_vardump() to display contents of an array
+ using var_dump() */
+check_vardump($arrays);
+
+echo "\n*** Testing var_dump() on object variables ***\n";
+class object_class
+{
+ var $value;
+ public $public_var1 = 10;
+ private $private_var1 = 20;
+ private $private_var2;
+ protected $protected_var1 = "string_1";
+ protected $protected_var2;
+
+ function object_class ( ) {
+ $this->value = 50;
+ $this->public_var2 = 11;
+ $this->private_var2 = 21;
+ $this->protected_var2 = "string_2";
+ }
+
+ public function foo1() {
+ echo "foo1() is called\n";
+ }
+ protected function foo2() {
+ echo "foo2() is called\n";
+ }
+ private function foo3() {
+ echo "foo3() is called\n";
+ }
+}
+/* class with no member */
+class no_member_class {
+ // no members
+}
+
+/* class with member as object of other class */
+class contains_object_class
+{
+ var $p = 30;
+ var $class_object1;
+ public $class_object2;
+ private $class_object3;
+ protected $class_object4;
+ var $no_member_class_object;
+
+ public function func() {
+ echo "func() is called \n";
+ }
+
+ function contains_object_class () {
+ $this->class_object1 = new object_class();
+ $this->class_object2 = new object_class();
+ $this->class_object3 = $this->class_object1;
+ $this->class_object4 = $this->class_object2;
+ $this->no_member_class_object = new no_member_class();
+ $this->class_object5 = $this; //recursive reference
+ }
+}
+
+/* objects of different classes */
+$obj = new contains_object_class;
+$temp_class_obj = new object_class();
+
+/* object which is unset */
+$unset_obj = new object_class();
+unset($unset_obj);
+
+$objects = array (
+ new object_class,
+ new no_member_class,
+ new contains_object_class,
+ $obj,
+ $obj->class_object1,
+ $obj->class_object2,
+ $obj->no_member_class_object,
+ $temp_class_obj,
+ @$unset_obj
+);
+/* calling check_vardump() to display contents of the objects
+ using var_dump() */
+check_vardump($objects);
+
+echo "\n** Testing var_dump() on objects having circular reference **\n";
+$recursion_obj1 = new object_class();
+$recursion_obj2 = new object_class();
+$recursion_obj1->obj = &$recursion_obj2; //circular reference
+$recursion_obj2->obj = &$recursion_obj1; //circular reference
+var_dump($recursion_obj2);
+
+echo "\n*** Testing var_dump() on resources ***\n";
+/* file type resource */
+$file_handle = fopen(__FILE__, "r");
+
+/* directory type resource */
+$dir_handle = opendir( dirname(__FILE__) );
+
+$resources = array (
+ $file_handle,
+ $dir_handle
+);
+/* calling check_vardump() to display the resource content type
+ using var_dump() */
+check_vardump($resources);
+
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
+/* a variable which is unset */
+$unset_var = 10.5;
+unset($unset_var);
+
+/* unset file type resource */
+unset($file_handle);
+
+$variations = array (
+ array( 123, -1.2345, "a" ),
+ array( "d", array(1, 3, 5), true, null),
+ array( new no_member_class, array(), false, 0 ),
+ array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
+ array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ), //unusual data
+ array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
+);
+/* calling check_vardump() to display combinations of scalar and
+ non-scalar variables using var_dump() */
+check_vardump($variations);
+
+echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+$misc_values = array (
+ @$unset_var,
+ NULL, // NULL argument
+ @$undef_variable, //undefined variable
+ null
+);
+/* calling check_vardump() to display miscelleneous data using var_dump() */
+check_vardump($misc_values);
+
+echo "\n*** Testing var_dump() on multiple arguments ***\n";
+var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
+ $objects, $misc_values, $variations );
+
+/* checking var_dump() on functions */
+echo "\n*** Testing var_dump() on anonymous functions ***\n";
+$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
+echo "New anonymous function: $newfunc\n";
+var_dump( $newfunc(2, 3) );
+/* creating anonymous function dynamically */
+var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
+
+echo "\n*** Testing error conditions ***\n";
+//passing zero argument
+var_dump();
+
+/* closing resource handle used */
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing var_dump() on integer variables ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(83)
+-- Iteration 3 --
+int(123000000)
+-- Iteration 4 --
+int(-83)
+-- Iteration 5 --
+int(-12300000)
+-- Iteration 6 --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+-- Iteration 7 --
+array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+}
+-- Iteration 8 --
+int(2147483647)
+-- Iteration 9 --
+int(2147483648)
+-- Iteration 10 --
+int(-2147483648)
+-- Iteration 11 --
+int(-2147483647)
+-- Iteration 12 --
+int(2147483647)
+-- Iteration 13 --
+int(-2147483648)
+-- Iteration 14 --
+int(2147483647)
+-- Iteration 15 --
+int(-2147483648)
+
+*** Testing var_dump() on float variables ***
+-- Iteration 1 --
+float(0)
+-- Iteration 2 --
+float(0)
+-- Iteration 3 --
+float(1.234)
+-- Iteration 4 --
+float(-1.234)
+-- Iteration 5 --
+float(-2)
+-- Iteration 6 --
+float(2)
+-- Iteration 7 --
+float(-0.5)
+-- Iteration 8 --
+float(0.567)
+-- Iteration 9 --
+float(-0.00067)
+-- Iteration 10 --
+float(-670)
+-- Iteration 11 --
+float(670)
+-- Iteration 12 --
+float(670)
+-- Iteration 13 --
+float(-0.00410003)
+-- Iteration 14 --
+float(-4100.03)
+-- Iteration 15 --
+float(0.004100003)
+-- Iteration 16 --
+float(4100.003)
+-- Iteration 17 --
+float(100000)
+-- Iteration 18 --
+float(-100000)
+-- Iteration 19 --
+float(1.0E-5)
+-- Iteration 20 --
+float(-1.0E-5)
+-- Iteration 21 --
+float(100000)
+-- Iteration 22 --
+float(-100000)
+-- Iteration 23 --
+float(100000)
+-- Iteration 24 --
+float(-100000)
+-- Iteration 25 --
+float(100000)
+-- Iteration 26 --
+float(-100000)
+-- Iteration 27 --
+float(1.0E-5)
+-- Iteration 28 --
+float(-1.0E-5)
+-- Iteration 29 --
+int(-2147483649)
+-- Iteration 30 --
+int(2147483649)
+-- Iteration 31 --
+int(2147483649)
+-- Iteration 32 --
+int(-2147483649)
+
+*** Testing var_dump() on string variables ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(1) " "
+-- Iteration 4 --
+string(1) " "
+-- Iteration 5 --
+string(1) "0"
+-- Iteration 6 --
+string(1) "
+-- Iteration 7 --
+string(2) "\0"
+-- Iteration 8 --
+string(1) " "
+-- Iteration 9 --
+string(2) "\t"
+-- Iteration 10 --
+string(3) "PHP"
+-- Iteration 11 --
+string(3) "PHP"
+-- Iteration 12 --
+string(29) "abcd
+-- Iteration 13 --
+string(34) "abcd
+-- Iteration 14 --
+string(22) "1234
+5678
+ 9100 abcda"
+
+*** Testing var_dump() on boolean variables ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+
+*** Testing var_dump() on array variables ***
+-- Iteration 1 --
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ bool(true)
+}
+-- Iteration 5 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+}
+-- Iteration 9 --
+array(1) {
+ [1]=>
+ string(3) "One"
+}
+-- Iteration 10 --
+array(1) {
+ ["test"]=>
+ string(8) "is_array"
+}
+-- Iteration 11 --
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 12 --
+array(1) {
+ [0]=>
+ int(-1)
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+}
+-- Iteration 14 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+-- Iteration 15 --
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+}
+
+*** Testing var_dump() on object variables ***
+-- Iteration 1 --
+object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 2 --
+object(no_member_class)#7 (0) {
+}
+-- Iteration 3 --
+object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 4 --
+object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+}
+-- Iteration 5 --
+object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 6 --
+object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 7 --
+object(no_member_class)#4 (0) {
+}
+-- Iteration 8 --
+object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+}
+-- Iteration 9 --
+NULL
+
+** Testing var_dump() on objects having circular reference **
+object(object_class)#13 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ &object(object_class)#12 (8) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ ["obj"]=>
+ *RECURSION*
+ }
+}
+
+*** Testing var_dump() on resources ***
+-- Iteration 1 --
+resource(5) of type (stream)
+-- Iteration 2 --
+resource(6) of type (stream)
+
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
+-- Iteration 1 --
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+}
+-- Iteration 2 --
+array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+}
+-- Iteration 3 --
+array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+}
+-- Iteration 4 --
+array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+}
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+}
+
+*** Testing var_dump() on miscelleneous input arguments ***
+-- Iteration 1 --
+NULL
+-- Iteration 2 --
+NULL
+-- Iteration 3 --
+NULL
+-- Iteration 4 --
+NULL
+
+*** Testing var_dump() on multiple arguments ***
+array(15) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(83)
+ [2]=>
+ int(123000000)
+ [3]=>
+ int(-83)
+ [4]=>
+ int(-12300000)
+ [5]=>
+ array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+ }
+ [6]=>
+ array(10) {
+ [0]=>
+ int(-1)
+ [1]=>
+ int(-2)
+ [2]=>
+ int(-3)
+ [3]=>
+ int(-4)
+ [4]=>
+ int(-5)
+ [5]=>
+ int(-6)
+ [6]=>
+ int(-7)
+ [7]=>
+ int(-8)
+ [8]=>
+ int(-9)
+ [9]=>
+ int(-10)
+ }
+ [7]=>
+ int(2147483647)
+ [8]=>
+ int(2147483648)
+ [9]=>
+ int(-2147483648)
+ [10]=>
+ int(-2147483647)
+ [11]=>
+ int(2147483647)
+ [12]=>
+ int(-2147483648)
+ [13]=>
+ int(2147483647)
+ [14]=>
+ int(-2147483648)
+}
+array(32) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(0)
+ [2]=>
+ float(1.234)
+ [3]=>
+ float(-1.234)
+ [4]=>
+ float(-2)
+ [5]=>
+ float(2)
+ [6]=>
+ float(-0.5)
+ [7]=>
+ float(0.567)
+ [8]=>
+ float(-0.00067)
+ [9]=>
+ float(-670)
+ [10]=>
+ float(670)
+ [11]=>
+ float(670)
+ [12]=>
+ float(-0.00410003)
+ [13]=>
+ float(-4100.03)
+ [14]=>
+ float(0.004100003)
+ [15]=>
+ float(4100.003)
+ [16]=>
+ float(100000)
+ [17]=>
+ float(-100000)
+ [18]=>
+ float(1.0E-5)
+ [19]=>
+ float(-1.0E-5)
+ [20]=>
+ float(100000)
+ [21]=>
+ float(-100000)
+ [22]=>
+ float(100000)
+ [23]=>
+ float(-100000)
+ [24]=>
+ float(100000)
+ [25]=>
+ float(-100000)
+ [26]=>
+ float(1.0E-5)
+ [27]=>
+ float(-1.0E-5)
+ [28]=>
+ int(-2147483649)
+ [29]=>
+ int(2147483649)
+ [30]=>
+ int(2147483649)
+ [31]=>
+ int(-2147483649)
+}
+array(14) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(1) "0"
+ [5]=>
+ string(1) "
+ [6]=>
+ string(2) "\0"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(2) "\t"
+ [9]=>
+ string(3) "PHP"
+ [10]=>
+ string(3) "PHP"
+ [11]=>
+ string(29) "abcd
+ [12]=>
+ string(34) "abcd
+ [13]=>
+ string(22) "1234
+5678
+ 9100 abcda"
+}
+array(15) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ bool(true)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [5]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ [6]=>
+ array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ }
+ [7]=>
+ array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ }
+ [8]=>
+ array(1) {
+ [1]=>
+ string(3) "One"
+ }
+ [9]=>
+ array(1) {
+ ["test"]=>
+ string(8) "is_array"
+ }
+ [10]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [11]=>
+ array(1) {
+ [0]=>
+ int(-1)
+ }
+ [12]=>
+ array(2) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ float(5.6)
+ }
+ [13]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+ [14]=>
+ array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(4) "test"
+ }
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(2) {
+ [0]=>
+ resource(5) of type (stream)
+ [1]=>
+ resource(6) of type (stream)
+}
+array(9) {
+ [0]=>
+ object(object_class)#6 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [1]=>
+ object(no_member_class)#7 (0) {
+ }
+ [2]=>
+ object(contains_object_class)#8 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#9 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#10 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#11 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [3]=>
+ object(contains_object_class)#1 (7) {
+ ["p"]=>
+ int(30)
+ ["class_object1"]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object2"]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object3":"contains_object_class":private]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["class_object4":protected]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ ["no_member_class_object"]=>
+ object(no_member_class)#4 (0) {
+ }
+ ["class_object5"]=>
+ *RECURSION*
+ }
+ [4]=>
+ object(object_class)#2 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [5]=>
+ object(object_class)#3 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [6]=>
+ object(no_member_class)#4 (0) {
+ }
+ [7]=>
+ object(object_class)#5 (7) {
+ ["value"]=>
+ int(50)
+ ["public_var1"]=>
+ int(10)
+ ["private_var1":"object_class":private]=>
+ int(20)
+ ["private_var2":"object_class":private]=>
+ int(21)
+ ["protected_var1":protected]=>
+ string(8) "string_1"
+ ["protected_var2":protected]=>
+ string(8) "string_2"
+ ["public_var2"]=>
+ int(11)
+ }
+ [8]=>
+ NULL
+}
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+}
+array(6) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ float(-1.2345)
+ [2]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(1) "d"
+ [1]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+ [2]=>
+ int(5)
+ }
+ [2]=>
+ bool(true)
+ [3]=>
+ NULL
+ }
+ [2]=>
+ array(4) {
+ [0]=>
+ object(no_member_class)#14 (0) {
+ }
+ [1]=>
+ array(0) {
+ }
+ [2]=>
+ bool(false)
+ [3]=>
+ int(0)
+ }
+ [3]=>
+ array(6) {
+ [0]=>
+ float(0)
+ [1]=>
+ string(11) "Where am I?"
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+ [3]=>
+ bool(true)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ int(987654321)
+ }
+ [4]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ float(20000000000)
+ [2]=>
+ float(79.1)
+ [3]=>
+ float(4.599998)
+ }
+ [5]=>
+ array(4) {
+ [0]=>
+ string(27) "array(1,2,3,4)1.0000002TRUE"
+ [1]=>
+ NULL
+ [2]=>
+ float(4611333)
+ [3]=>
+ string(5) "/00\7"
+ }
+}
+
+*** Testing var_dump() on anonymous functions ***
+New anonymous function:
+string(9) "2 * 3 = 6"
+string(9) "
+
+*** Testing error conditions ***
+
+Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
+Done
+
diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt
new file mode 100644
index 0000000..37142cf
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export-locale.phpt
@@ -0,0 +1,1061 @@
+--TEST--
+Test var_export() function with locale
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (!setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8")) {
+ die("skip locale needed for this test is not supported on this platform");
+}
+?>
+--FILE--
+<?php
+setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8");
+/* Prototype: mixed var_export( mixed expression [, bool return]);
+ * Description: Returns the variable representation when the return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL.
+
+*/
+
+echo "*** Testing var_export() with integer values ***\n";
+// different integer vlaues
+$valid_ints = array(
+ '0',
+ '1',
+ '-1',
+ '-2147483648', // max negative integer value
+ '-2147483647',
+ 2147483647, // max positive integer value
+ 2147483640,
+ 0x123B, // integer as hexadecimal
+ '0x12ab',
+ '0Xfff',
+ '0XFA',
+ -0x80000000, // max negative integer as hexadecimal
+ '0x7fffffff', // max postive integer as hexadecimal
+ 0x7FFFFFFF, // max postive integer as hexadecimal
+ '0123', // integer as octal
+ 01912, // should be quivalent to octal 1
+ -020000000000, // max negative integer as octal
+ 017777777777, // max positive integer as octal
+ );
+$counter = 1;
+/* Loop to check for above integer values with var_export() */
+echo "\n*** Output for integer values ***\n";
+foreach($valid_ints as $int_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $int_value );
+echo "\n";
+var_export( $int_value, FALSE);
+echo "\n";
+var_dump( var_export( $int_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bool = array(
+ 1,
+ TRUE,
+ true,
+ 0,
+ FALSE,
+ false
+ );
+$counter = 1;
+/* Loop to check for above boolean values with var_export() */
+echo "\n*** Output for boolean values ***\n";
+foreach($valid_bool as $bool_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $bool_value );
+echo "\n";
+var_export( $bool_value, FALSE);
+echo "\n";
+var_dump( var_export( $bool_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid float values ***\n";
+// different valid float vlaues
+$valid_floats = array(
+ -2147483649, // float value
+ 2147483648, // float value
+ -0x80000001, // float value, beyond max negative int
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ -020000000001, // float value, beyond max negative int
+ 0.0,
+ -0.1,
+ 10.0000000000000000005,
+ 10.5e+5,
+ 1e5,
+ 1e-5,
+ 1e+5,
+ 1E5,
+ 1E+5,
+ 1E-5,
+ .5e+7,
+ .6e-19,
+ .05E+44,
+ .0034E-30
+);
+$counter = 1;
+/* Loop to check for above float values with var_export() */
+echo "\n*** Output for float values ***\n";
+foreach($valid_bool as $float_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $float_value );
+echo "\n";
+var_export( $float_value, FALSE);
+echo "\n";
+var_dump( var_export( $float_value, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid strings ***\n";
+// different valid string
+$valid_strings = array(
+ "",
+ " ",
+ '',
+ ' ',
+ "string",
+ 'string',
+ "NULL",
+ 'null',
+ "FALSE",
+ 'false',
+ "\x0b",
+ "\0",
+ '\0',
+ '\060',
+ "\070"
+ );
+$counter = 1;
+/* Loop to check for above strings with var_export() */
+echo "\n*** Output for strings ***\n";
+foreach($valid_strings as $str) {
+echo "\nIteration ".$counter."\n";
+var_export( $str );
+echo "\n";
+var_export( $str, FALSE);
+echo "\n";
+var_dump( var_export( $str, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid arrays ***\n";
+// different valid arrays
+$valid_arrays = array(
+ array(),
+ array(NULL),
+ array(null),
+ array(true),
+ array(""),
+ array(''),
+ array(array(), array()),
+ array(array(1, 2), array('a', 'b')),
+ array(1 => 'One'),
+ array("test" => "is_array"),
+ array(0),
+ array(-1),
+ array(10.5, 5.6),
+ array("string", "test"),
+ array('string', 'test')
+ );
+$counter = 1;
+/* Loop to check for above arrays with var_export() */
+echo "\n*** Output for arrays ***\n";
+foreach($valid_arrays as $arr) {
+echo "\nIteration ".$counter."\n";
+var_export( $arr );
+echo "\n";
+var_export( $arr, FALSE);
+echo "\n";
+var_dump( var_export( $arr, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface iValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+// implement the interface
+class Value implements iValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_export ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ new stdclass,
+ new foo,
+ new concreteClass,
+ new Value,
+ new myClass,
+ $myClass_object,
+ $myClass_object->foo_object,
+ $myClass_object->public_var1,
+ $foo_object,
+ $Value_object,
+ $concreteClass_object
+ );
+ $counter = 1;
+/* Loop to check for above objects with var_export() */
+echo "\n*** Output for objects ***\n";
+foreach($valid_objects as $obj) {
+echo "\nIteration ".$counter."\n";
+var_export( $obj );
+echo "\n";
+var_export( $obj, FALSE);
+echo "\n";
+var_dump( var_export( $obj, TRUE) );
+echo "\n";
+$counter++;
+}
+
+echo "*** Testing var_export() with valid null values ***\n";
+// different valid null vlaues
+$unset_var = array();
+unset ($unset_var); // now a null
+$null_var = NULL;
+
+$valid_nulls = array(
+ NULL,
+ null,
+ $null_var,
+ );
+ $counter = 1;
+/* Loop to check for above null values with var_export() */
+echo "\n*** Output for null values ***\n";
+foreach($valid_nulls as $null_value) {
+echo "\nIteration ".$counter."\n";
+var_export( $null_value );
+echo "\n";
+var_export( $null_value, FALSE);
+echo "\n";
+var_dump( var_export( $null_value, true) );
+echo "\n";
+$counter++;
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument
+var_export( var_export() );
+
+//arguments more than expected
+var_export( var_export(TRUE, FALSE, TRUE) );
+
+echo "\n\nDone";
+
+
+?>
+--EXPECTF--
+*** Testing var_export() with integer values ***
+
+*** Output for integer values ***
+
+Iteration 1
+'0'
+'0'
+string(3) "'0'"
+
+
+Iteration 2
+'1'
+'1'
+string(3) "'1'"
+
+
+Iteration 3
+'-1'
+'-1'
+string(4) "'-1'"
+
+
+Iteration 4
+'-2147483648'
+'-2147483648'
+string(13) "'-2147483648'"
+
+
+Iteration 5
+'-2147483647'
+'-2147483647'
+string(13) "'-2147483647'"
+
+
+Iteration 6
+2147483647
+2147483647
+string(10) "2147483647"
+
+
+Iteration 7
+2147483640
+2147483640
+string(10) "2147483640"
+
+
+Iteration 8
+4667
+4667
+string(4) "4667"
+
+
+Iteration 9
+'0x12ab'
+'0x12ab'
+string(8) "'0x12ab'"
+
+
+Iteration 10
+'0Xfff'
+'0Xfff'
+string(7) "'0Xfff'"
+
+
+Iteration 11
+'0XFA'
+'0XFA'
+string(6) "'0XFA'"
+
+
+Iteration 12
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+
+Iteration 13
+'0x7fffffff'
+'0x7fffffff'
+string(12) "'0x7fffffff'"
+
+
+Iteration 14
+2147483647
+2147483647
+string(10) "2147483647"
+
+
+Iteration 15
+'0123'
+'0123'
+string(6) "'0123'"
+
+
+Iteration 16
+1
+1
+string(1) "1"
+
+
+Iteration 17
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+
+Iteration 18
+2147483647
+2147483647
+string(10) "2147483647"
+
+*** Testing var_export() with valid boolean values ***
+
+*** Output for boolean values ***
+
+Iteration 1
+1
+1
+string(1) "1"
+
+
+Iteration 2
+true
+true
+string(4) "true"
+
+
+Iteration 3
+true
+true
+string(4) "true"
+
+
+Iteration 4
+0
+0
+string(1) "0"
+
+
+Iteration 5
+false
+false
+string(5) "false"
+
+
+Iteration 6
+false
+false
+string(5) "false"
+
+*** Testing var_export() with valid float values ***
+
+*** Output for float values ***
+
+Iteration 1
+1
+1
+string(1) "1"
+
+
+Iteration 2
+true
+true
+string(4) "true"
+
+
+Iteration 3
+true
+true
+string(4) "true"
+
+
+Iteration 4
+0
+0
+string(1) "0"
+
+
+Iteration 5
+false
+false
+string(5) "false"
+
+
+Iteration 6
+false
+false
+string(5) "false"
+
+*** Testing var_export() with valid strings ***
+
+*** Output for strings ***
+
+Iteration 1
+''
+''
+string(2) "''"
+
+
+Iteration 2
+' '
+' '
+string(3) "' '"
+
+
+Iteration 3
+''
+''
+string(2) "''"
+
+
+Iteration 4
+' '
+' '
+string(3) "' '"
+
+
+Iteration 5
+'string'
+'string'
+string(8) "'string'"
+
+
+Iteration 6
+'string'
+'string'
+string(8) "'string'"
+
+
+Iteration 7
+'NULL'
+'NULL'
+string(6) "'NULL'"
+
+
+Iteration 8
+'null'
+'null'
+string(6) "'null'"
+
+
+Iteration 9
+'FALSE'
+'FALSE'
+string(7) "'FALSE'"
+
+
+Iteration 10
+'false'
+'false'
+string(7) "'false'"
+
+
+Iteration 11
+' '
+' '
+string(3) "' '"
+
+
+Iteration 12
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
+
+
+Iteration 13
+'\\0'
+'\\0'
+string(5) "'\\0'"
+
+
+Iteration 14
+'\\060'
+'\\060'
+string(7) "'\\060'"
+
+
+Iteration 15
+'8'
+'8'
+string(3) "'8'"
+
+*** Testing var_export() with valid arrays ***
+
+*** Output for arrays ***
+
+Iteration 1
+array (
+)
+array (
+)
+string(9) "array (
+)"
+
+
+Iteration 2
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+Iteration 3
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+Iteration 4
+array (
+ 0 => true,
+)
+array (
+ 0 => true,
+)
+string(22) "array (
+ 0 => true,
+)"
+
+
+Iteration 5
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+Iteration 6
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+Iteration 7
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+string(55) "array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)"
+
+
+Iteration 8
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+string(107) "array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)"
+
+
+Iteration 9
+array (
+ 1 => 'One',
+)
+array (
+ 1 => 'One',
+)
+string(23) "array (
+ 1 => 'One',
+)"
+
+
+Iteration 10
+array (
+ 'test' => 'is_array',
+)
+array (
+ 'test' => 'is_array',
+)
+string(33) "array (
+ 'test' => 'is_array',
+)"
+
+
+Iteration 11
+array (
+ 0 => 0,
+)
+array (
+ 0 => 0,
+)
+string(19) "array (
+ 0 => 0,
+)"
+
+
+Iteration 12
+array (
+ 0 => -1,
+)
+array (
+ 0 => -1,
+)
+string(20) "array (
+ 0 => -1,
+)"
+
+
+Iteration 13
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+string(34) "array (
+ 0 => 10.5,
+ 1 => 5.6,
+)"
+
+
+Iteration 14
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+
+Iteration 15
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+*** Testing var_export() with valid objects ***
+
+*** Output for objects ***
+
+Iteration 1
+stdClass::__set_state(array(
+))
+stdClass::__set_state(array(
+))
+string(31) "stdClass::__set_state(array(
+))"
+
+
+Iteration 2
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 3
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+
+Iteration 4
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+Iteration 5
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+Iteration 6
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+Iteration 7
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 8
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 9
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+Iteration 10
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+Iteration 11
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+*** Testing var_export() with valid null values ***
+
+*** Output for null values ***
+
+Iteration 1
+NULL
+NULL
+string(4) "NULL"
+
+
+Iteration 2
+NULL
+NULL
+string(4) "NULL"
+
+
+Iteration 3
+NULL
+NULL
+string(4) "NULL"
+
+
+*** Testing error conditions ***
+
+Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Done
diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt
new file mode 100644
index 0000000..3a734c7
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic1.phpt
@@ -0,0 +1,141 @@
+--TEST--
+Test var_export() function with integer values
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with integer values ***\n";
+// different integer vlaues
+$valid_ints = array(
+ '0' => '0',
+ '1' => '1',
+ '-1' => '-1',
+ '-2147483648' => '-2147483648', // max negative integer value
+ '-2147483647' => '-2147483647',
+ '2147483647' => 2147483647, // max positive integer value
+ '2147483640' => 2147483640,
+ '0x123B' => 0x123B, // integer as hexadecimal
+ "'0x12ab'" => '0x12ab',
+ "'0Xfff'" => '0Xfff',
+ "'0XFA'" => '0XFA',
+ "-0x80000000" => -0x80000000, // max negative integer as hexadecimal
+ "'0x7fffffff'" => '0x7fffffff', // max postive integer as hexadecimal
+ "0x7FFFFFFF" => 0x7FFFFFFF, // max postive integer as hexadecimal
+ "'0123'" => '0123', // integer as octal
+ "01912" => 01912, // should be quivalent to octal 1
+ "-020000000000" => -020000000000, // max negative integer as octal
+ "017777777777" => 017777777777, // max positive integer as octal
+);
+
+/* Loop to check for above integer values with var_export() */
+echo "\n*** Output for integer values ***\n";
+foreach($valid_ints as $key => $int_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $int_value );
+ echo "\n";
+ var_export( $int_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $int_value, TRUE) );
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with integer values ***
+
+*** Output for integer values ***
+
+-- Iteration: 0 --
+'0'
+'0'
+string(3) "'0'"
+
+-- Iteration: 1 --
+'1'
+'1'
+string(3) "'1'"
+
+-- Iteration: -1 --
+'-1'
+'-1'
+string(4) "'-1'"
+
+-- Iteration: -2147483648 --
+'-2147483648'
+'-2147483648'
+string(13) "'-2147483648'"
+
+-- Iteration: -2147483647 --
+'-2147483647'
+'-2147483647'
+string(13) "'-2147483647'"
+
+-- Iteration: 2147483647 --
+2147483647
+2147483647
+string(10) "2147483647"
+
+-- Iteration: 2147483640 --
+2147483640
+2147483640
+string(10) "2147483640"
+
+-- Iteration: 0x123B --
+4667
+4667
+string(4) "4667"
+
+-- Iteration: '0x12ab' --
+'0x12ab'
+'0x12ab'
+string(8) "'0x12ab'"
+
+-- Iteration: '0Xfff' --
+'0Xfff'
+'0Xfff'
+string(7) "'0Xfff'"
+
+-- Iteration: '0XFA' --
+'0XFA'
+'0XFA'
+string(6) "'0XFA'"
+
+-- Iteration: -0x80000000 --
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+-- Iteration: '0x7fffffff' --
+'0x7fffffff'
+'0x7fffffff'
+string(12) "'0x7fffffff'"
+
+-- Iteration: 0x7FFFFFFF --
+2147483647
+2147483647
+string(10) "2147483647"
+
+-- Iteration: '0123' --
+'0123'
+'0123'
+string(6) "'0123'"
+
+-- Iteration: 01912 --
+1
+1
+string(1) "1"
+
+-- Iteration: -020000000000 --
+-2147483648
+-2147483648
+string(11) "-2147483648"
+
+-- Iteration: 017777777777 --
+2147483647
+2147483647
+string(10) "2147483647"
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic2.phpt b/ext/standard/tests/general_functions/var_export_basic2.phpt
new file mode 100644
index 0000000..33ca400
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic2.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test var_export() function with valid boolean values
+--FILE--
+<?php
+
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid boolean values ***\n";
+// different valid boolean vlaues
+$valid_bool = array(
+ "1" => 1,
+ "TRUE" => TRUE,
+ "true" => true,
+ "0" => 0,
+ "FALSE" => FALSE,
+ "false" => false
+);
+
+/* Loop to check for above boolean values with var_export() */
+echo "\n*** Output for boolean values ***\n";
+foreach($valid_bool as $key => $bool_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $bool_value );
+ echo "\n";
+ var_export( $bool_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $bool_value, TRUE) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid boolean values ***
+
+*** Output for boolean values ***
+
+-- Iteration: 1 --
+1
+1
+string(1) "1"
+
+
+-- Iteration: TRUE --
+true
+true
+string(4) "true"
+
+
+-- Iteration: true --
+true
+true
+string(4) "true"
+
+
+-- Iteration: 0 --
+0
+0
+string(1) "0"
+
+
+-- Iteration: FALSE --
+false
+false
+string(5) "false"
+
+
+-- Iteration: false --
+false
+false
+string(5) "false"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt
new file mode 100644
index 0000000..2997215
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic3.phpt
@@ -0,0 +1,175 @@
+--TEST--
+Test var_export() function with valid float values
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid float values ***\n";
+// different valid float vlaues
+$valid_floats = array(
+ "-2147483649" => -2147483649, // float value
+ "2147483648" => 2147483648, // float value
+ "-0x80000001" => -0x80000001, // float value, beyond max negative int
+ "0x800000001" => 0x800000001, // float value, beyond max positive int
+ "020000000001" => 020000000001, // float value, beyond max positive int
+ "-020000000001" => -020000000001, // float value, beyond max negative int
+ "0.0" => 0.0,
+ "-0.1" => -0.1,
+ "10.0000000000000000005" => 10.0000000000000000005,
+ "10.5e+5" => 10.5e+5,
+ "1e5" => 1e5,
+ "1e-5" => 1e-5,
+ "1e+5" => 1e+5,
+ "1E5" => 1E5,
+ "1E+5" => 1E+5,
+ "1E-5" => 1E-5,
+ ".5e+7" => .5e+7,
+ ".6e-19" => .6e-19,
+ ".05E+44" => .05E+44,
+ ".0034E-30" => .0034E-30
+);
+/* Loop to check for above float values with var_export() */
+echo "\n*** Output for float values ***\n";
+foreach($valid_floats as $key => $float_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $float_value );
+ echo "\n";
+ var_export( $float_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $float_value, TRUE) );
+ echo "\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid float values ***
+
+*** Output for float values ***
+
+-- Iteration: -2147483649 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 2147483648 --
+2147483648
+2147483648
+string(10) "2147483648"
+
+
+-- Iteration: -0x80000001 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 0x800000001 --
+34359738369
+34359738369
+string(11) "34359738369"
+
+
+-- Iteration: 020000000001 --
+2147483649
+2147483649
+string(10) "2147483649"
+
+
+-- Iteration: -020000000001 --
+-2147483649
+-2147483649
+string(11) "-2147483649"
+
+
+-- Iteration: 0.0 --
+0
+0
+string(1) "0"
+
+
+-- Iteration: -0.1 --
+-0.1
+-0.1
+string(4) "-0.1"
+
+
+-- Iteration: 10.0000000000000000005 --
+10
+10
+string(2) "10"
+
+
+-- Iteration: 10.5e+5 --
+1050000
+1050000
+string(7) "1050000"
+
+
+-- Iteration: 1e5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1e-5 --
+1.0E-5
+1.0E-5
+string(6) "1.0E-5"
+
+
+-- Iteration: 1e+5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E+5 --
+100000
+100000
+string(6) "100000"
+
+
+-- Iteration: 1E-5 --
+1.0E-5
+1.0E-5
+string(6) "1.0E-5"
+
+
+-- Iteration: .5e+7 --
+5000000
+5000000
+string(7) "5000000"
+
+
+-- Iteration: .6e-19 --
+6.0E-20
+6.0E-20
+string(7) "6.0E-20"
+
+
+-- Iteration: .05E+44 --
+5.0E+42
+5.0E+42
+string(7) "5.0E+42"
+
+
+-- Iteration: .0034E-30 --
+3.4E-33
+3.4E-33
+string(7) "3.4E-33"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic4.phpt b/ext/standard/tests/general_functions/var_export_basic4.phpt
new file mode 100644
index 0000000..4668ace
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic4.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test var_export() function with valid strings
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing var_export() with valid strings ***\n";
+// different valid string
+$valid_strings = array(
+ "\"\"" => "",
+ "\" \"" => " ",
+ "''" => '',
+ "' '" => ' ',
+ "\"string\"" => "string",
+ "'string'" => 'string',
+ "\"\\0Hello\\0 World\\0\"" => "\0Hello\0 World\0",
+ "\"NULL\"" => "NULL",
+ "'null'" => 'null',
+ "\"FALSE\"" => "FALSE",
+ "'false'" => 'false',
+ "\"\\x0b\"" => "\x0b",
+ "\"\\0\"" => "\0",
+ "'\\0'" => '\0',
+ "'\\060'" => '\060',
+ "\"\\070\"" => "\070"
+);
+
+/* Loop to check for above strings with var_export() */
+echo "\n*** Output for strings ***\n";
+foreach($valid_strings as $key => $str) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $str );
+ echo "\n";
+ var_export( $str, FALSE);
+ echo "\n";
+ var_dump( var_export( $str, TRUE) );
+ echo "\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid strings ***
+
+*** Output for strings ***
+
+-- Iteration: "" --
+''
+''
+string(2) "''"
+
+
+-- Iteration: " " --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: '' --
+''
+''
+string(2) "''"
+
+
+-- Iteration: ' ' --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: "string" --
+'string'
+'string'
+string(8) "'string'"
+
+
+-- Iteration: 'string' --
+'string'
+'string'
+string(8) "'string'"
+
+
+-- Iteration: "\0Hello\0 World\0" --
+'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
+'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''
+string(49) "'' . "\0" . 'Hello' . "\0" . ' World' . "\0" . ''"
+
+
+-- Iteration: "NULL" --
+'NULL'
+'NULL'
+string(6) "'NULL'"
+
+
+-- Iteration: 'null' --
+'null'
+'null'
+string(6) "'null'"
+
+
+-- Iteration: "FALSE" --
+'FALSE'
+'FALSE'
+string(7) "'FALSE'"
+
+
+-- Iteration: 'false' --
+'false'
+'false'
+string(7) "'false'"
+
+
+-- Iteration: "\x0b" --
+' '
+' '
+string(3) "' '"
+
+
+-- Iteration: "\0" --
+'' . "\0" . ''
+'' . "\0" . ''
+string(14) "'' . "\0" . ''"
+
+
+-- Iteration: '\0' --
+'\\0'
+'\\0'
+string(5) "'\\0'"
+
+
+-- Iteration: '\060' --
+'\\060'
+'\\060'
+string(7) "'\\060'"
+
+
+-- Iteration: "\070" --
+'8'
+'8'
+string(3) "'8'"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt
new file mode 100644
index 0000000..96b3f54
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic5.phpt
@@ -0,0 +1,277 @@
+--TEST--
+Test var_export() function with valid arrays
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing var_export() with valid arrays ***\n";
+// different valid arrays
+$valid_arrays = array(
+ "array()" => array(),
+ "array(NULL)" => array(NULL),
+ "array(null)" => array(null),
+ "array(true)" => array(true),
+ "array(\"\")" => array(""),
+ "array('')" => array(''),
+ "array(array(), array())" => array(array(), array()),
+ "array(array(1, 2), array('a', 'b'))" => array(array(1, 2), array('a', 'b')),
+ "array(1 => 'One')" => array(1 => 'One'),
+ "array(\"test\" => \"is_array\")" => array("test" => "is_array"),
+ "array(0)" => array(0),
+ "array(-1)" => array(-1),
+ "array(10.5, 5.6)" => array(10.5, 5.6),
+ "array(\"string\", \"test\")" => array("string", "test"),
+ "array('string', 'test')" => array('string', 'test')
+);
+
+/* Loop to check for above arrays with var_export() */
+echo "\n*** Output for arrays ***\n";
+foreach($valid_arrays as $key => $arr) {
+ echo "\n--Iteration: $key --\n";
+ var_export( $arr );
+ echo "\n";
+ var_export( $arr, FALSE);
+ echo "\n";
+ var_dump( var_export( $arr, TRUE) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid arrays ***
+
+*** Output for arrays ***
+
+--Iteration: array() --
+array (
+)
+array (
+)
+string(9) "array (
+)"
+
+
+--Iteration: array(NULL) --
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+--Iteration: array(null) --
+array (
+ 0 => NULL,
+)
+array (
+ 0 => NULL,
+)
+string(22) "array (
+ 0 => NULL,
+)"
+
+
+--Iteration: array(true) --
+array (
+ 0 => true,
+)
+array (
+ 0 => true,
+)
+string(22) "array (
+ 0 => true,
+)"
+
+
+--Iteration: array("") --
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+--Iteration: array('') --
+array (
+ 0 => '',
+)
+array (
+ 0 => '',
+)
+string(20) "array (
+ 0 => '',
+)"
+
+
+--Iteration: array(array(), array()) --
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)
+string(55) "array (
+ 0 =>
+ array (
+ ),
+ 1 =>
+ array (
+ ),
+)"
+
+
+--Iteration: array(array(1, 2), array('a', 'b')) --
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)
+string(107) "array (
+ 0 =>
+ array (
+ 0 => 1,
+ 1 => 2,
+ ),
+ 1 =>
+ array (
+ 0 => 'a',
+ 1 => 'b',
+ ),
+)"
+
+
+--Iteration: array(1 => 'One') --
+array (
+ 1 => 'One',
+)
+array (
+ 1 => 'One',
+)
+string(23) "array (
+ 1 => 'One',
+)"
+
+
+--Iteration: array("test" => "is_array") --
+array (
+ 'test' => 'is_array',
+)
+array (
+ 'test' => 'is_array',
+)
+string(33) "array (
+ 'test' => 'is_array',
+)"
+
+
+--Iteration: array(0) --
+array (
+ 0 => 0,
+)
+array (
+ 0 => 0,
+)
+string(19) "array (
+ 0 => 0,
+)"
+
+
+--Iteration: array(-1) --
+array (
+ 0 => -1,
+)
+array (
+ 0 => -1,
+)
+string(20) "array (
+ 0 => -1,
+)"
+
+
+--Iteration: array(10.5, 5.6) --
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+array (
+ 0 => 10.5,
+ 1 => 5.6,
+)
+string(34) "array (
+ 0 => 10.5,
+ 1 => 5.6,
+)"
+
+
+--Iteration: array("string", "test") --
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+
+--Iteration: array('string', 'test') --
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+array (
+ 0 => 'string',
+ 1 => 'test',
+)
+string(41) "array (
+ 0 => 'string',
+ 1 => 'test',
+)"
+
+===DONE=== \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/var_export_basic6.phpt b/ext/standard/tests/general_functions/var_export_basic6.phpt
new file mode 100644
index 0000000..8935d0e
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic6.phpt
@@ -0,0 +1,310 @@
+--TEST--
+Test var_export() function with valid objects
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid objects ***\n";
+
+// class with no members
+class foo
+{
+// no members
+}
+
+// abstract class
+abstract class abstractClass
+{
+ abstract protected function getClassName();
+ public function printClassName () {
+ echo $this->getClassName() . "\n";
+ }
+}
+// implement abstract class
+class concreteClass extends abstractClass
+{
+ protected function getClassName() {
+ return "concreteClass";
+ }
+}
+
+// interface class
+interface iValue
+{
+ public function setVal ($name, $val);
+ public function dumpVal ();
+}
+// implement the interface
+class Value implements iValue
+{
+ private $vars = array ();
+
+ public function setVal ( $name, $val ) {
+ $this->vars[$name] = $val;
+ }
+
+ public function dumpVal () {
+ var_export ( $vars );
+ }
+}
+
+// a gereral class
+class myClass
+{
+ var $foo_object;
+ public $public_var;
+ public $public_var1;
+ private $private_var;
+ protected $protected_var;
+
+ function myClass ( ) {
+ $this->foo_object = new foo();
+ $this->public_var = 10;
+ $this->public_var1 = new foo();
+ $this->private_var = new foo();
+ $this->proected_var = new foo();
+ }
+}
+
+// create a object of each class defined above
+$myClass_object = new myClass();
+$foo_object = new foo();
+$Value_object = new Value();
+$concreteClass_object = new concreteClass();
+
+$valid_objects = array(
+ "new stdclass" => new stdclass,
+ "new foo" => new foo,
+ "new concreteClass" => new concreteClass,
+ "new Value" => new Value,
+ "new myClass" => new myClass,
+ "myClass_object" => $myClass_object,
+ "myClass_object->foo_object" => $myClass_object->foo_object,
+ "myClass_object->public_var1" => $myClass_object->public_var1,
+ "foo_object" => $foo_object,
+ "Value_object" => $Value_object,
+ "concreteClass_object" => $concreteClass_object
+ );
+/* Loop to check for above objects with var_export() */
+echo "\n*** Output for objects ***\n";
+foreach($valid_objects as $key => $obj) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $obj );
+ echo "\n";
+ var_export( $obj, FALSE);
+ echo "\n";
+ var_dump( var_export( $obj, TRUE) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid objects ***
+
+*** Output for objects ***
+
+-- Iteration: new stdclass --
+stdClass::__set_state(array(
+))
+stdClass::__set_state(array(
+))
+string(31) "stdClass::__set_state(array(
+))"
+
+
+-- Iteration: new foo --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: new concreteClass --
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+
+-- Iteration: new Value --
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+-- Iteration: new myClass --
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+-- Iteration: myClass_object --
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))
+string(293) "myClass::__set_state(array(
+ 'foo_object' =>
+ foo::__set_state(array(
+ )),
+ 'public_var' => 10,
+ 'public_var1' =>
+ foo::__set_state(array(
+ )),
+ 'private_var' =>
+ foo::__set_state(array(
+ )),
+ 'protected_var' => NULL,
+ 'proected_var' =>
+ foo::__set_state(array(
+ )),
+))"
+
+
+-- Iteration: myClass_object->foo_object --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: myClass_object->public_var1 --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: foo_object --
+foo::__set_state(array(
+))
+foo::__set_state(array(
+))
+string(26) "foo::__set_state(array(
+))"
+
+
+-- Iteration: Value_object --
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))
+string(57) "Value::__set_state(array(
+ 'vars' =>
+ array (
+ ),
+))"
+
+
+-- Iteration: concreteClass_object --
+concreteClass::__set_state(array(
+))
+concreteClass::__set_state(array(
+))
+string(36) "concreteClass::__set_state(array(
+))"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic7.phpt b/ext/standard/tests/general_functions/var_export_basic7.phpt
new file mode 100644
index 0000000..10dc032
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic7.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test var_export() function with valid null values
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() with valid null values ***\n";
+
+// different valid null vlaues
+$unset_var = array();
+unset ($unset_var); // now a null
+$null_var = NULL;
+
+$valid_nulls = array(
+ "NULL" => NULL,
+ "null" => null,
+ "null_var" => $null_var,
+);
+
+/* Loop to check for above null values with var_export() */
+echo "\n*** Output for null values ***\n";
+foreach($valid_nulls as $key => $null_value) {
+ echo "\n-- Iteration: $key --\n";
+ var_export( $null_value );
+ echo "\n";
+ var_export( $null_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $null_value, true) );
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing var_export() with valid null values ***
+
+*** Output for null values ***
+
+-- Iteration: NULL --
+NULL
+NULL
+string(4) "NULL"
+
+
+-- Iteration: null --
+NULL
+NULL
+string(4) "NULL"
+
+
+-- Iteration: null_var --
+NULL
+NULL
+string(4) "NULL"
+
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic8.phpt b/ext/standard/tests/general_functions/var_export_basic8.phpt
new file mode 100644
index 0000000..6e6263d
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic8.phpt
@@ -0,0 +1,71 @@
+--TEST--
+var_export(): simple test with arrays and objects
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "\n\n-- Var export on a simple object --\n";
+$o1 = new stdclass;
+$o1->p = '22';
+$o2 = new stdclass;
+$o2->a = 1;
+$o2->b = array('k'=>2);
+$o2->x = $o1;
+var_export($o2);
+
+echo "\n\n-- Var export on an simple array --\n";
+$a = array(1,2,3,4);
+var_export($a);
+
+echo "\n\n-- Var export on an nested array --\n";
+$a = array('one' => 'first');
+$b = array('foo' => $a, 'bar' => $o2);
+var_export($b);
+
+?>
+===DONE===
+--EXPECTF--
+-- Var export on a simple object --
+stdClass::__set_state(array(
+ 'a' => 1,
+ 'b' =>
+ array (
+ 'k' => 2,
+ ),
+ 'x' =>
+ stdClass::__set_state(array(
+ 'p' => '22',
+ )),
+))
+
+-- Var export on an simple array --
+array (
+ 0 => 1,
+ 1 => 2,
+ 2 => 3,
+ 3 => 4,
+)
+
+-- Var export on an nested array --
+array (
+ 'foo' =>
+ array (
+ 'one' => 'first',
+ ),
+ 'bar' =>
+ stdClass::__set_state(array(
+ 'a' => 1,
+ 'b' =>
+ array (
+ 'k' => 2,
+ ),
+ 'x' =>
+ stdClass::__set_state(array(
+ 'p' => '22',
+ )),
+ )),
+)===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic9.phpt b/ext/standard/tests/general_functions/var_export_basic9.phpt
new file mode 100644
index 0000000..3c9706e
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_basic9.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #55082: var_export() doesn't escape properties properly
+--FILE--
+<?php
+ $x = new stdClass();
+ $x->{'\'\\'} = 7;
+ echo var_export($x);
+--EXPECT--
+stdClass::__set_state(array(
+ '\'\\' => 7,
+))
diff --git a/ext/standard/tests/general_functions/var_export_error1.phpt b/ext/standard/tests/general_functions/var_export_error1.phpt
new file mode 100644
index 0000000..d9c5eee
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_error1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test var_export() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+echo "*** Testing var_export() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing var_export() function with Zero arguments --\n";
+var_dump( var_export() );
+
+//Test var_export with one more than the expected number of arguments
+echo "\n-- Testing var_export() function with more than expected no. of arguments --\n";
+$var = 1;
+$return = true;
+$extra_arg = 10;
+var_dump( var_export($var, $return, $extra_arg) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing var_export() : error conditions ***
+
+-- Testing var_export() function with Zero arguments --
+
+Warning: var_export() expects at least 1 parameter, 0 given in %s on line 12
+NULL
+
+-- Testing var_export() function with more than expected no. of arguments --
+
+Warning: var_export() expects at most 2 parameters, 3 given in %s on line 19
+NULL
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt
new file mode 100644
index 0000000..a6403e6
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_error2.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test var_export() function : error conditions - recursive object
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+@$obj->p =& $obj;
+var_export($obj, true);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: var_export does not handle circular references in %s on line 9
+===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt
new file mode 100644
index 0000000..c862691
--- /dev/null
+++ b/ext/standard/tests/general_functions/var_export_error3.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test var_export() function : error conditions - recursive array
+--FILE--
+<?php
+/* Prototype : mixed var_export(mixed var [, bool return])
+ * Description: Outputs or returns a string representation of a variable
+ * Source code: ext/standard/var.c
+ * Alias to functions:
+ */
+
+$a[] =& $a;
+var_export($a, true);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: var_export does not handle circular references in %s on line 9
+===DONE===