summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:30 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:38:30 -0400
commit1f589a2bd44ba835ad1b009a5d83abd453724829 (patch)
treeec84d715d1ff049cc61f5eaf18db21eb7f3bab40 /ext
parentbb01389fbd53ec1cbcb80d0681a37cca1267891a (diff)
downloadphp-1f589a2bd44ba835ad1b009a5d83abd453724829.tar.gz
Imported Upstream version 5.2.5upstream/5.2.5
Diffstat (limited to 'ext')
-rw-r--r--ext/bz2/php_bz2.h4
-rw-r--r--ext/bz2/tests/005.phpt4
-rw-r--r--ext/curl/interface.c16
-rw-r--r--ext/date/lib/parse_tz.c12
-rw-r--r--ext/date/lib/timezonedb.h1987
-rw-r--r--ext/date/tests/bug20382-2.phpt2
-rw-r--r--ext/date/tests/bug34304.phpt2
-rw-r--r--ext/date/tests/bug35885.phpt5
-rw-r--r--ext/dom/php_dom.c3
-rw-r--r--ext/gd/gd.c9
-rw-r--r--ext/gd/libgd/gd.c48
-rw-r--r--ext/gd/libgd/gd.h2
-rw-r--r--ext/gd/libgd/gd_security.c6
-rw-r--r--ext/gd/tests/bug43121.gifbin0 -> 347 bytes
-rw-r--r--ext/gd/tests/bug43121.phpt21
-rw-r--r--ext/hash/hash_tiger.c12
-rw-r--r--ext/iconv/iconv.c101
-rw-r--r--ext/iconv/php_iconv.h6
-rwxr-xr-xext/iconv/tests/iconv-charset-length-cve-2007-4840.phpt17
-rwxr-xr-xext/iconv/tests/iconv_mime_decode-charset-length-cve-2007-4840.phpt13
-rwxr-xr-xext/iconv/tests/iconv_mime_decode_headers-charset-length-cve-2007-4840.phpt13
-rwxr-xr-xext/iconv/tests/iconv_set_encoding-charset-length-cve-2007-4840.phpt21
-rwxr-xr-xext/iconv/tests/iconv_strlen-charset-length-cve-2007-4840.phpt13
-rwxr-xr-xext/iconv/tests/iconv_strpos-charset-length-cve-2007-4840.phpt13
-rwxr-xr-xext/iconv/tests/iconv_strrpos-charset-length-cve-2007-4840.phpt13
-rwxr-xr-xext/iconv/tests/iconv_substr-charset-length-cve-2007-4783.phpt14
-rwxr-xr-xext/iconv/tests/ob_iconv_handler-charset-length-cve-2007-4840.phpt12
-rw-r--r--ext/json/json.c4
-rw-r--r--ext/json/tests/bug42785.phpt26
-rw-r--r--ext/mbstring/config.m47
-rw-r--r--ext/mbstring/libmbfl/mbfl/mbfilter.h1
-rw-r--r--ext/mbstring/libmbfl/mbfl/mbfl_convert.c10
-rw-r--r--ext/mbstring/libmbfl/nls/nls_ru.c42
-rw-r--r--ext/mbstring/libmbfl/nls/nls_ru.h18
-rw-r--r--ext/mbstring/mbstring.c13
-rw-r--r--ext/mbstring/oniguruma/php_onig_compat.h6
-rw-r--r--ext/mbstring/php_unicode.c6
-rw-r--r--ext/mssql/php_mssql.c7
-rw-r--r--ext/mysql/php_mysql.c14
-rw-r--r--ext/mysql/php_mysql.h94
-rw-r--r--ext/mysql/php_mysql_structs.h128
-rw-r--r--ext/mysqli/mysqli.c25
-rw-r--r--ext/mysqli/mysqli_api.c23
-rw-r--r--ext/mysqli/mysqli_nonapi.c29
-rw-r--r--ext/mysqli/mysqli_prop.c6
-rw-r--r--ext/mysqli/php_mysqli.h5
-rw-r--r--ext/mysqli/tests/061.phpt2
-rwxr-xr-xext/mysqli/tests/bug38710.phpt11
-rw-r--r--ext/oci8/oci8.c8
-rw-r--r--ext/oci8/package2.xml23
-rw-r--r--ext/oci8/tests/rowid_bind.phpt86
-rw-r--r--ext/oci8/tests/xmltype_01.phpt120
-rw-r--r--ext/odbc/birdstep.c3
-rw-r--r--ext/openssl/openssl.c5
-rw-r--r--ext/pcre/config.w322
-rw-r--r--ext/pcre/config0.m42
-rw-r--r--ext/pcre/pcrelib/ChangeLog167
-rw-r--r--ext/pcre/pcrelib/HACKING19
-rw-r--r--ext/pcre/pcrelib/NEWS24
-rw-r--r--ext/pcre/pcrelib/NON-UNIX-USE181
-rw-r--r--ext/pcre/pcrelib/config.h13
-rw-r--r--ext/pcre/pcrelib/dftables.c7
-rw-r--r--ext/pcre/pcrelib/doc/pcre.txt2246
-rw-r--r--ext/pcre/pcrelib/pcre.h36
-rw-r--r--ext/pcre/pcrelib/pcre_chartables.c4
-rw-r--r--ext/pcre/pcrelib/pcre_compile.c408
-rw-r--r--ext/pcre/pcrelib/pcre_config.c2
-rw-r--r--ext/pcre/pcrelib/pcre_exec.c280
-rw-r--r--ext/pcre/pcrelib/pcre_fullinfo.c6
-rw-r--r--ext/pcre/pcrelib/pcre_get.c2
-rw-r--r--ext/pcre/pcrelib/pcre_globals.c2
-rw-r--r--ext/pcre/pcrelib/pcre_info.c2
-rw-r--r--ext/pcre/pcrelib/pcre_internal.h55
-rw-r--r--ext/pcre/pcrelib/pcre_maketables.c3
-rw-r--r--ext/pcre/pcrelib/pcre_newline.c6
-rw-r--r--ext/pcre/pcrelib/pcre_ord2utf8.c1
-rw-r--r--ext/pcre/pcrelib/pcre_printint.src2
-rw-r--r--ext/pcre/pcrelib/pcre_refcount.c3
-rw-r--r--ext/pcre/pcrelib/pcre_study.c2
-rw-r--r--ext/pcre/pcrelib/pcre_tables.c2
-rw-r--r--ext/pcre/pcrelib/pcre_try_flipped.c2
-rw-r--r--ext/pcre/pcrelib/pcre_ucp_searchfuncs.c2
-rw-r--r--ext/pcre/pcrelib/pcre_valid_utf8.c44
-rw-r--r--ext/pcre/pcrelib/pcre_version.c2
-rw-r--r--ext/pcre/pcrelib/pcre_xclass.c2
-rw-r--r--ext/pcre/pcrelib/pcredemo.c7
-rw-r--r--ext/pcre/pcrelib/pcregrep.c48
-rw-r--r--ext/pcre/pcrelib/pcreposix.c18
-rw-r--r--ext/pcre/pcrelib/pcreposix.h11
-rw-r--r--ext/pcre/pcrelib/testdata/grepoutput2
-rw-r--r--ext/pcre/pcrelib/testdata/testinput19
-rw-r--r--ext/pcre/pcrelib/testdata/testinput1020
-rw-r--r--ext/pcre/pcrelib/testdata/testinput2138
-rw-r--r--ext/pcre/pcrelib/testdata/testinput412
-rw-r--r--ext/pcre/pcrelib/testdata/testinput524
-rw-r--r--ext/pcre/pcrelib/testdata/testinput658
-rw-r--r--ext/pcre/pcrelib/testdata/testinput712
-rw-r--r--ext/pcre/pcrelib/testdata/testinput94
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput117
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput10238
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput2954
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput32
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput420
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput5241
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput6102
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput716
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput94
-rw-r--r--ext/pcre/php_pcre.c11
-rw-r--r--ext/pcre/tests/006.phpt22
-rw-r--r--ext/pcre/tests/bug42298.phpt46
-rw-r--r--ext/pcre/upgrade-pcre.php23
-rwxr-xr-xext/pdo/pdo_dbh.c58
-rw-r--r--ext/pdo/pdo_sql_parser.c322
-rw-r--r--ext/pdo/pdo_sql_parser.c.orig342
-rw-r--r--ext/pdo/pdo_sql_parser.re4
-rwxr-xr-xext/pdo/pdo_stmt.c119
-rw-r--r--ext/pdo/tests/bug_42917.phpt40
-rw-r--r--ext/pdo/tests/bug_43130.phpt31
-rw-r--r--ext/pdo/tests/bug_43139.phpt34
-rwxr-xr-xext/pdo/tests/pdo_029.phpt2
-rwxr-xr-xext/pdo/tests/pdo_030.phpt2
-rwxr-xr-xext/pdo_oci/config.m412
-rwxr-xr-xext/pdo_oci/oci_driver.c90
-rwxr-xr-xext/pdo_oci/oci_statement.c12
-rwxr-xr-xext/pdo_oci/php_pdo_oci_int.h21
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt64
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt127
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt51
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_case.phpt81
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_client.phpt43
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt21
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt61
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt37
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt47
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_server.phpt40
-rw-r--r--ext/pgsql/pgsql.c17
-rw-r--r--ext/pgsql/tests/80_bug42783.phpt34
-rw-r--r--ext/reflection/php_reflection.c22
-rw-r--r--ext/reflection/tests/bug42976.phpt34
-rw-r--r--ext/session/mod_files.c4
-rw-r--r--ext/soap/php_encoding.c64
-rw-r--r--ext/soap/php_http.c4
-rw-r--r--ext/soap/php_schema.c30
-rw-r--r--ext/soap/php_soap.h3
-rw-r--r--ext/soap/soap.c172
-rwxr-xr-xext/soap/tests/bugs/bug42086.phpt31
-rwxr-xr-xext/soap/tests/bugs/bug42086.wsdl141
-rwxr-xr-xext/soap/tests/bugs/bug42214.phpt24
-rwxr-xr-xext/soap/tests/bugs/bug42326.phpt49
-rwxr-xr-xext/soap/tests/bugs/bug42326.wsdl82
-rwxr-xr-xext/soap/tests/bugs/bug42359.phpt20
-rwxr-xr-xext/soap/tests/bugs/bug42359.wsdl58
-rwxr-xr-xext/soap/tests/bugs/bug42488.phpt22
-rwxr-xr-xext/soap/tests/classmap004.phpt66
-rw-r--r--ext/sockets/sockets.c4
-rwxr-xr-xext/spl/spl_array.c9
-rwxr-xr-xext/spl/spl_directory.c4
-rwxr-xr-xext/spl/spl_iterators.c10
-rw-r--r--ext/spl/tests/bug42259.phpt2
-rwxr-xr-xext/spl/tests/bug42654.phpt134
-rwxr-xr-xext/spl/tests/bug42703.phpt41
-rw-r--r--ext/standard/array.c304
-rw-r--r--ext/standard/basic_functions.c62
-rw-r--r--ext/standard/browscap.c4
-rw-r--r--ext/standard/dir.c50
-rw-r--r--ext/standard/dl.c19
-rw-r--r--ext/standard/exec.c4
-rw-r--r--ext/standard/file.c9
-rw-r--r--ext/standard/filestat.c25
-rw-r--r--ext/standard/filters.c4
-rw-r--r--ext/standard/formatted_print.c8
-rw-r--r--ext/standard/ftp_fopen_wrapper.c54
-rw-r--r--ext/standard/html.c59
-rw-r--r--ext/standard/http.c6
-rw-r--r--ext/standard/http_fopen_wrapper.c4
-rw-r--r--ext/standard/image.c5
-rw-r--r--ext/standard/mail.c4
-rw-r--r--ext/standard/pack.c5
-rw-r--r--ext/standard/php_filestat.h3
-rw-r--r--ext/standard/php_fopen_wrapper.c4
-rw-r--r--ext/standard/proc_open.c8
-rw-r--r--ext/standard/streamsfuncs.c20
-rw-r--r--ext/standard/string.c76
-rw-r--r--ext/standard/tests/array/array_fill_basic.phpt97
-rw-r--r--ext/standard/tests/array/array_fill_error.phpt61
-rw-r--r--ext/standard/tests/array/array_fill_object.phpt432
-rw-r--r--ext/standard/tests/array/array_fill_variation1.phpt235
-rw-r--r--ext/standard/tests/array/array_fill_variation1_64bit.phpt235
-rw-r--r--ext/standard/tests/array/array_fill_variation2.phpt213
-rw-r--r--ext/standard/tests/array/array_fill_variation3.phpt110
-rw-r--r--ext/standard/tests/array/array_fill_variation4.phpt168
-rw-r--r--ext/standard/tests/array/array_fill_variation5.phpt291
-rw-r--r--ext/standard/tests/array/array_filter_basic.phpt55
-rw-r--r--ext/standard/tests/array/array_filter_error.phpt50
-rw-r--r--ext/standard/tests/array/array_filter_object.phpt155
-rw-r--r--ext/standard/tests/array/array_filter_variation1.phpt195
-rw-r--r--ext/standard/tests/array/array_filter_variation2.phpt184
-rw-r--r--ext/standard/tests/array/array_filter_variation3.phpt216
-rw-r--r--ext/standard/tests/array/array_filter_variation4.phpt97
-rw-r--r--ext/standard/tests/array/array_filter_variation5.phpt109
-rw-r--r--ext/standard/tests/array/array_filter_variation6.phpt94
-rw-r--r--ext/standard/tests/array/array_filter_variation7.phpt80
-rw-r--r--ext/standard/tests/array/array_filter_variation8.phpt151
-rw-r--r--ext/standard/tests/array/array_filter_variation9.phpt72
-rw-r--r--ext/standard/tests/array/array_flip_basic.phpt71
-rw-r--r--ext/standard/tests/array/array_flip_error.phpt34
-rw-r--r--ext/standard/tests/array/array_flip_variation1.phpt178
-rw-r--r--ext/standard/tests/array/array_flip_variation2.phptbin0 -> 2306 bytes
-rw-r--r--ext/standard/tests/array/array_flip_variation3.phptbin0 -> 2978 bytes
-rw-r--r--ext/standard/tests/array/array_flip_variation4.phpt90
-rw-r--r--ext/standard/tests/array/array_flip_variation5.phpt82
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_basic.phpt69
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_error.phpt36
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation1.phpt281
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation10.phpt54
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation2.phpt282
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation3.phpt243
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation4.phpt254
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation5.phpt197
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation6.phpt197
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation7.phpt212
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation8.phpt212
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation9.phpt128
-rw-r--r--ext/standard/tests/array/array_intersect_basic.phpt80
-rw-r--r--ext/standard/tests/array/array_intersect_error.phpt35
-rw-r--r--ext/standard/tests/array/array_intersect_variation1.phpt280
-rw-r--r--ext/standard/tests/array/array_intersect_variation10.phpt53
-rw-r--r--ext/standard/tests/array/array_intersect_variation2.phpt281
-rw-r--r--ext/standard/tests/array/array_intersect_variation3.phpt342
-rw-r--r--ext/standard/tests/array/array_intersect_variation4.phpt349
-rw-r--r--ext/standard/tests/array/array_intersect_variation5.phpt214
-rw-r--r--ext/standard/tests/array/array_intersect_variation6.phpt214
-rw-r--r--ext/standard/tests/array/array_intersect_variation7.phpt211
-rw-r--r--ext/standard/tests/array/array_intersect_variation8.phpt219
-rw-r--r--ext/standard/tests/array/array_intersect_variation9.phpt163
-rw-r--r--ext/standard/tests/array/array_map_001.phpt23
-rw-r--r--ext/standard/tests/array/array_rand_basic1.phpt52
-rw-r--r--ext/standard/tests/array/array_rand_basic2.phpt57
-rw-r--r--ext/standard/tests/array/array_rand_error.phpt37
-rw-r--r--ext/standard/tests/array/array_rand_variation1.phpt216
-rw-r--r--ext/standard/tests/array/array_rand_variation2.phpt214
-rw-r--r--ext/standard/tests/array/array_rand_variation3.phpt149
-rw-r--r--ext/standard/tests/array/array_rand_variation4.phpt167
-rw-r--r--ext/standard/tests/array/array_rand_variation5.phpt74
-rw-r--r--ext/standard/tests/array/array_rand_variation6.phpt103
-rw-r--r--ext/standard/tests/array/array_reverse_basic1.phpt72
-rw-r--r--ext/standard/tests/array/array_reverse_basic2.phpt60
-rw-r--r--ext/standard/tests/array/array_reverse_error.phpt40
-rw-r--r--ext/standard/tests/array/array_reverse_variation1.phpt340
-rw-r--r--ext/standard/tests/array/array_reverse_variation2.phpt491
-rw-r--r--ext/standard/tests/array/array_reverse_variation3.phpt602
-rw-r--r--ext/standard/tests/array/array_reverse_variation4.phpt377
-rw-r--r--ext/standard/tests/array/array_reverse_variation5.phpt397
-rw-r--r--ext/standard/tests/array/array_reverse_variation6.phpt209
-rw-r--r--ext/standard/tests/array/array_search_errors.phpt35
-rw-r--r--ext/standard/tests/array/array_search_variation1.phpt678
-rw-r--r--ext/standard/tests/array/array_search_variation2.phpt129
-rw-r--r--ext/standard/tests/array/array_search_variation3.phpt105
-rw-r--r--ext/standard/tests/array/array_search_variation4.phpt74
-rw-r--r--ext/standard/tests/array/array_splice_basic.phpt117
-rw-r--r--ext/standard/tests/array/array_splice_errors.phpt41
-rw-r--r--ext/standard/tests/array/array_splice_variation1.phpt109
-rw-r--r--ext/standard/tests/array/array_splice_variation2.phpt27
-rw-r--r--ext/standard/tests/array/array_splice_variation3.phpt856
-rw-r--r--ext/standard/tests/array/array_splice_variation4.phpt69
-rw-r--r--ext/standard/tests/array/array_unshift_basic1.phpt63
-rw-r--r--ext/standard/tests/array/array_unshift_basic2.phpt71
-rw-r--r--ext/standard/tests/array/array_unshift_error.phpt34
-rw-r--r--ext/standard/tests/array/array_unshift_object.phpt325
-rw-r--r--ext/standard/tests/array/array_unshift_variation1.phpt338
-rw-r--r--ext/standard/tests/array/array_unshift_variation2.phpt1061
-rw-r--r--ext/standard/tests/array/array_unshift_variation3.phpt571
-rw-r--r--ext/standard/tests/array/array_unshift_variation4.phpt390
-rw-r--r--ext/standard/tests/array/array_unshift_variation5.phpt396
-rw-r--r--ext/standard/tests/array/array_unshift_variation6.phpt196
-rw-r--r--ext/standard/tests/array/array_unshift_variation7.phpt216
-rw-r--r--ext/standard/tests/array/array_unshift_variation8.phpt214
-rw-r--r--ext/standard/tests/array/array_unshift_variation9.phpt309
-rw-r--r--ext/standard/tests/array/asort_basic.phpt133
-rw-r--r--ext/standard/tests/array/asort_error.phpt79
-rw-r--r--ext/standard/tests/array/asort_object1.phpt245
-rw-r--r--ext/standard/tests/array/asort_object2.phpt253
-rw-r--r--ext/standard/tests/array/asort_variation1.phpt399
-rw-r--r--ext/standard/tests/array/asort_variation10.phpt114
-rw-r--r--ext/standard/tests/array/asort_variation11.phptbin0 -> 3374 bytes
-rw-r--r--ext/standard/tests/array/asort_variation2.phpt308
-rw-r--r--ext/standard/tests/array/asort_variation3.phpt326
-rw-r--r--ext/standard/tests/array/asort_variation4.phpt79
-rw-r--r--ext/standard/tests/array/asort_variation5.phpt242
-rw-r--r--ext/standard/tests/array/asort_variation6.phpt114
-rw-r--r--ext/standard/tests/array/asort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/asort_variation8.phpt180
-rw-r--r--ext/standard/tests/array/asort_variation9.phpt258
-rw-r--r--ext/standard/tests/array/in_array_errors.phpt45
-rw-r--r--ext/standard/tests/array/in_array_variation1.phpt (renamed from ext/standard/tests/array/array_search_variation.phpt)15
-rw-r--r--ext/standard/tests/array/in_array_variation2.phpt102
-rw-r--r--ext/standard/tests/array/in_array_variation3.phpt61
-rw-r--r--ext/standard/tests/array/in_array_variation4.phpt77
-rw-r--r--ext/standard/tests/array/max.phpt4
-rw-r--r--ext/standard/tests/array/max_basic.phpt42
-rw-r--r--ext/standard/tests/array/max_error.phpt33
-rw-r--r--ext/standard/tests/array/max_variation1.phpt37
-rw-r--r--ext/standard/tests/array/max_variation2.phpt55
-rw-r--r--ext/standard/tests/array/min.phpt4
-rw-r--r--ext/standard/tests/array/min_basic.phpt37
-rw-r--r--ext/standard/tests/array/min_error.phpt33
-rw-r--r--ext/standard/tests/array/min_variation1.phpt37
-rw-r--r--ext/standard/tests/array/min_variation2.phpt50
-rw-r--r--ext/standard/tests/array/shuffle_basic1.phpt149
-rw-r--r--ext/standard/tests/array/shuffle_basic2.phpt88
-rw-r--r--ext/standard/tests/array/shuffle_error.phpt53
-rw-r--r--ext/standard/tests/array/shuffle_variation1.phpt212
-rw-r--r--ext/standard/tests/array/shuffle_variation2.phpt211
-rw-r--r--ext/standard/tests/array/shuffle_variation3.phpt232
-rw-r--r--ext/standard/tests/array/shuffle_variation4.phpt230
-rw-r--r--ext/standard/tests/array/shuffle_variation5.phpt119
-rw-r--r--ext/standard/tests/array/sort_basic.phpt134
-rw-r--r--ext/standard/tests/array/sort_error.phpt79
-rw-r--r--ext/standard/tests/array/sort_object1.phpt242
-rw-r--r--ext/standard/tests/array/sort_object2.phpt257
-rw-r--r--ext/standard/tests/array/sort_variation1.phpt398
-rw-r--r--ext/standard/tests/array/sort_variation10.phpt112
-rw-r--r--ext/standard/tests/array/sort_variation11.phptbin0 -> 3144 bytes
-rw-r--r--ext/standard/tests/array/sort_variation2.phpt311
-rw-r--r--ext/standard/tests/array/sort_variation3.phpt328
-rw-r--r--ext/standard/tests/array/sort_variation4.phpt79
-rw-r--r--ext/standard/tests/array/sort_variation5.phpt233
-rw-r--r--ext/standard/tests/array/sort_variation6.phpt123
-rw-r--r--ext/standard/tests/array/sort_variation7.phpt98
-rw-r--r--ext/standard/tests/array/sort_variation8.phpt178
-rw-r--r--ext/standard/tests/array/sort_variation9.phpt259
-rw-r--r--ext/standard/tests/file/005_basic.phpt2
-rw-r--r--ext/standard/tests/file/005_error.phpt2
-rw-r--r--ext/standard/tests/file/006_basic.phpt2
-rw-r--r--ext/standard/tests/file/006_error.phpt4
-rw-r--r--ext/standard/tests/file/006_variation1.phpt2
-rw-r--r--ext/standard/tests/file/006_variation2.phpt2
-rw-r--r--ext/standard/tests/file/007_variation1.phpt2
-rw-r--r--ext/standard/tests/file/007_variation10.phpt2
-rw-r--r--ext/standard/tests/file/007_variation11-win32.phpt2
-rw-r--r--ext/standard/tests/file/007_variation11.phpt2
-rw-r--r--ext/standard/tests/file/007_variation12-win32.phpt2
-rw-r--r--ext/standard/tests/file/007_variation12.phpt2
-rw-r--r--ext/standard/tests/file/007_variation13-win32.phpt2
-rw-r--r--ext/standard/tests/file/007_variation13.phpt2
-rw-r--r--ext/standard/tests/file/007_variation14.phpt2
-rw-r--r--ext/standard/tests/file/007_variation15.phpt2
-rw-r--r--ext/standard/tests/file/007_variation16.phpt2
-rw-r--r--ext/standard/tests/file/007_variation17.phpt2
-rw-r--r--ext/standard/tests/file/007_variation18.phpt2
-rw-r--r--ext/standard/tests/file/007_variation19.phpt2
-rw-r--r--ext/standard/tests/file/007_variation2.phpt2
-rw-r--r--ext/standard/tests/file/007_variation20.phpt2
-rw-r--r--ext/standard/tests/file/007_variation21.phpt2
-rw-r--r--ext/standard/tests/file/007_variation22.phpt2
-rw-r--r--ext/standard/tests/file/007_variation23.phpt2
-rw-r--r--ext/standard/tests/file/007_variation24.phpt2
-rw-r--r--ext/standard/tests/file/007_variation3.phpt2
-rw-r--r--ext/standard/tests/file/007_variation4.phpt2
-rw-r--r--ext/standard/tests/file/007_variation5.phpt2
-rw-r--r--ext/standard/tests/file/007_variation6.phpt2
-rw-r--r--ext/standard/tests/file/007_variation7.phpt2
-rw-r--r--ext/standard/tests/file/007_variation8.phpt2
-rw-r--r--ext/standard/tests/file/007_variation9.phpt2
-rw-r--r--ext/standard/tests/file/bug41655_1.phpt8
-rw-r--r--ext/standard/tests/file/bug41655_2.phpt7
-rw-r--r--ext/standard/tests/file/bug43137.phpt20
-rw-r--r--ext/standard/tests/file/copy_variation15.phpt6
-rw-r--r--ext/standard/tests/file/copy_variation5.phpt4
-rw-r--r--ext/standard/tests/file/copy_variation9.phpt6
-rw-r--r--ext/standard/tests/file/fgetc_basic.phpt8
-rw-r--r--ext/standard/tests/file/fgetc_variation4.phpt2
-rw-r--r--ext/standard/tests/file/file_basic.phpt12
-rw-r--r--ext/standard/tests/file/file_variation.phpt14
-rw-r--r--ext/standard/tests/file/fileinode_error.phpt11
-rw-r--r--ext/standard/tests/file/fileinode_variation.phpt47
-rw-r--r--ext/standard/tests/file/fileowner_basic.phpt36
-rw-r--r--ext/standard/tests/file/filetype_variation.phpt45
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt804
-rw-r--r--ext/standard/tests/file/is_executable_basic.phpt4
-rw-r--r--ext/standard/tests/file/is_executable_variation1.phpt4
-rw-r--r--ext/standard/tests/file/is_executable_variation2.phpt4
-rw-r--r--ext/standard/tests/file/is_executable_variation3.phpt4
-rw-r--r--ext/standard/tests/file/is_file_variation4.phpt2
-rw-r--r--ext/standard/tests/file/is_readable_basic.phpt4
-rw-r--r--ext/standard/tests/file/is_readable_variation1.phpt4
-rw-r--r--ext/standard/tests/file/is_readable_variation2.phpt4
-rw-r--r--ext/standard/tests/file/is_readable_variation3.phpt4
-rw-r--r--ext/standard/tests/file/is_writable_basic.phpt2
-rw-r--r--ext/standard/tests/file/is_writable_variation1.phpt2
-rw-r--r--ext/standard/tests/file/is_writable_variation2.phpt2
-rw-r--r--ext/standard/tests/file/is_writable_variation3.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_basic.phpt1
-rwxr-xr-xext/standard/tests/file/lstat_stat_variation6.phpt17
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation1.phpt2
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation2.phpt2
-rw-r--r--ext/standard/tests/file/readlink_realpath_basic1.phpt2
-rw-r--r--ext/standard/tests/file/readlink_realpath_variation1.phpt2
-rw-r--r--ext/standard/tests/file/readlink_realpath_variation2.phpt2
-rw-r--r--ext/standard/tests/file/rename_variation.phpt2
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt2
-rw-r--r--ext/standard/tests/file/unlink_variation1.phpt2
-rw-r--r--ext/standard/tests/general_functions/bug32647.phpt4
-rwxr-xr-xext/standard/tests/general_functions/dl-cve-2007-4887.phpt10
-rw-r--r--ext/standard/tests/general_functions/import_request.phpt2
-rw-r--r--ext/standard/tests/general_functions/is_callable.phpt1
-rw-r--r--ext/standard/tests/general_functions/phpcredits.phpt18
-rw-r--r--ext/standard/tests/general_functions/phpcredits2.phpt4
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt15
-rw-r--r--ext/standard/tests/general_functions/phpinfo2.phpt6
-rw-r--r--ext/standard/tests/math/acos_basic.phpt69
-rw-r--r--ext/standard/tests/math/acos_error.phpt30
-rw-r--r--ext/standard/tests/math/acos_variation.phpt52
-rw-r--r--ext/standard/tests/math/acosh_basic.phpt46
-rw-r--r--ext/standard/tests/math/acosh_error.phpt35
-rw-r--r--ext/standard/tests/math/acosh_variation.phpt57
-rw-r--r--ext/standard/tests/math/allowed_rounding_error.inc18
-rw-r--r--ext/standard/tests/math/asin_basic.phpt68
-rw-r--r--ext/standard/tests/math/asin_error.phpt30
-rw-r--r--ext/standard/tests/math/asin_variation.phpt52
-rw-r--r--ext/standard/tests/math/asinh_basic.phpt45
-rw-r--r--ext/standard/tests/math/asinh_error.phpt35
-rw-r--r--ext/standard/tests/math/asinh_variation.phpt57
-rw-r--r--ext/standard/tests/math/atan_basic.phpt40
-rw-r--r--ext/standard/tests/math/atan_error.phpt30
-rw-r--r--ext/standard/tests/math/atan_variation.phpt52
-rw-r--r--ext/standard/tests/math/atanh_basic.phpt46
-rw-r--r--ext/standard/tests/math/atanh_error.phpt35
-rw-r--r--ext/standard/tests/math/atanh_variation.phpt57
-rw-r--r--ext/standard/tests/math/cos_basic.phpt92
-rw-r--r--ext/standard/tests/math/cos_error.phpt30
-rw-r--r--ext/standard/tests/math/cos_variation.phpt52
-rw-r--r--ext/standard/tests/math/cosh_basic.phpt61
-rw-r--r--ext/standard/tests/math/cosh_error.phpt30
-rw-r--r--ext/standard/tests/math/cosh_variation.phpt52
-rw-r--r--ext/standard/tests/math/sin_basic.phpt92
-rw-r--r--ext/standard/tests/math/sin_error.phpt30
-rw-r--r--ext/standard/tests/math/sin_variation.phpt52
-rw-r--r--ext/standard/tests/math/sinh_basic.phpt60
-rw-r--r--ext/standard/tests/math/sinh_error.phpt30
-rw-r--r--ext/standard/tests/math/sinh_variation.phpt52
-rw-r--r--ext/standard/tests/math/tan_basic.phpt41
-rw-r--r--ext/standard/tests/math/tan_error.phpt30
-rw-r--r--ext/standard/tests/math/tan_variation.phpt52
-rw-r--r--ext/standard/tests/math/tanh_basic.phpt60
-rw-r--r--ext/standard/tests/math/tanh_error.phpt30
-rw-r--r--ext/standard/tests/math/tanh_variation.phpt52
-rw-r--r--ext/standard/tests/network/ip_x86_64.phpt67
-rw-r--r--ext/standard/tests/strings/addcslashes.phptbin4128 -> 0 bytes
-rw-r--r--ext/standard/tests/strings/addcslashes_001.phptbin0 -> 1604 bytes
-rw-r--r--ext/standard/tests/strings/addcslashes_002.phpt33
-rw-r--r--ext/standard/tests/strings/addcslashes_003.phptbin0 -> 1314 bytes
-rw-r--r--ext/standard/tests/strings/addcslashes_004.phpt30
-rw-r--r--ext/standard/tests/strings/addslashes_basic.phpt39
-rw-r--r--ext/standard/tests/strings/addslashes_error.phpt44
-rw-r--r--ext/standard/tests/strings/addslashes_variation1.phpt170
-rw-r--r--ext/standard/tests/strings/addslashes_variation2.phpt195
-rw-r--r--ext/standard/tests/strings/addslashes_variation3.phpt197
-rw-r--r--ext/standard/tests/strings/bug40754.phpt12
-rw-r--r--ext/standard/tests/strings/chop_basic.phptbin0 -> 861 bytes
-rw-r--r--ext/standard/tests/strings/chop_error.phpt44
-rw-r--r--ext/standard/tests/strings/chop_variation1.phpt210
-rw-r--r--ext/standard/tests/strings/chop_variation2.phpt173
-rw-r--r--ext/standard/tests/strings/chop_variation3.phptbin0 -> 1974 bytes
-rw-r--r--ext/standard/tests/strings/chop_variation4.phptbin0 -> 1836 bytes
-rw-r--r--ext/standard/tests/strings/chop_variation5.phpt39
-rw-r--r--ext/standard/tests/strings/chunk_split_basic.phpt53
-rw-r--r--ext/standard/tests/strings/chunk_split_error.phpt40
-rw-r--r--ext/standard/tests/strings/chunk_split_variation1.phpt167
-rw-r--r--ext/standard/tests/strings/chunk_split_variation10.phpt86
-rw-r--r--ext/standard/tests/strings/chunk_split_variation11.phpt95
-rw-r--r--ext/standard/tests/strings/chunk_split_variation12.phpt145
-rw-r--r--ext/standard/tests/strings/chunk_split_variation13.phpt42
-rw-r--r--ext/standard/tests/strings/chunk_split_variation2.phpt172
-rw-r--r--ext/standard/tests/strings/chunk_split_variation3.phpt158
-rw-r--r--ext/standard/tests/strings/chunk_split_variation4.phpt176
-rw-r--r--ext/standard/tests/strings/chunk_split_variation5.phptbin0 -> 2191 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split_variation6.phpt76
-rw-r--r--ext/standard/tests/strings/chunk_split_variation7.phptbin0 -> 2462 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split_variation8.phpt88
-rw-r--r--ext/standard/tests/strings/chunk_split_variation9.phptbin0 -> 3344 bytes
-rw-r--r--ext/standard/tests/strings/crc32_basic.phpt41
-rw-r--r--ext/standard/tests/strings/crc32_error.phpt47
-rw-r--r--ext/standard/tests/strings/crc32_variation1.phpt196
-rw-r--r--ext/standard/tests/strings/crc32_variation2.phpt149
-rw-r--r--ext/standard/tests/strings/crc32_variation3.phpt161
-rw-r--r--ext/standard/tests/strings/crc32_variation4.phpt117
-rw-r--r--ext/standard/tests/strings/explode1.phpt24
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic1-win32.phpt269
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic1.phpt269
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic2-win32.phpt673
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic2.phpt672
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic3-win32.phpt79
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_basic3.phpt78
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_error.phpt29
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_variation1-win32.phpt1117
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_variation1.phpt1116
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_variation2-win32.phpt220
-rw-r--r--ext/standard/tests/strings/get_html_translation_table_variation2.phpt219
-rwxr-xr-xext/standard/tests/strings/htmlentities-utf.phpt34
-rw-r--r--ext/standard/tests/strings/htmlentities04.phpt1
-rw-r--r--ext/standard/tests/strings/htmlentities15.phpt1
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt42
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_error.phpt37
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt160
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt191
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt99
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt65
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt76
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation6.phptbin0 -> 1373 bytes
-rw-r--r--ext/standard/tests/strings/implode1.phptbin5836 -> 5852 bytes
-rw-r--r--ext/standard/tests/strings/join_basic.phpt43
-rw-r--r--ext/standard/tests/strings/join_error.phpt50
-rw-r--r--ext/standard/tests/strings/join_variation1.phpt167
-rw-r--r--ext/standard/tests/strings/join_variation2.phpt198
-rw-r--r--ext/standard/tests/strings/join_variation3.phpt99
-rw-r--r--ext/standard/tests/strings/join_variation4.phptbin0 -> 2213 bytes
-rw-r--r--ext/standard/tests/strings/join_variation5.phpt50
-rw-r--r--ext/standard/tests/strings/join_variation6.phptbin0 -> 737 bytes
-rw-r--r--ext/standard/tests/strings/nl2br_error.phpt34
-rw-r--r--ext/standard/tests/strings/nl2br_variation1.phpt80
-rw-r--r--ext/standard/tests/strings/nl2br_variation2.phpt70
-rw-r--r--ext/standard/tests/strings/nl2br_variation3.phpt64
-rw-r--r--ext/standard/tests/strings/nl2br_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/nl2br_variation5.phpt150
-rw-r--r--ext/standard/tests/strings/setlocale_basic1.phpt121
-rw-r--r--ext/standard/tests/strings/setlocale_basic2.phpt126
-rw-r--r--ext/standard/tests/strings/setlocale_basic3.phpt100
-rw-r--r--ext/standard/tests/strings/setlocale_error.phpt68
-rw-r--r--ext/standard/tests/strings/setlocale_variation1.phpt99
-rw-r--r--ext/standard/tests/strings/setlocale_variation2.phpt90
-rw-r--r--ext/standard/tests/strings/setlocale_variation3.phpt156
-rw-r--r--ext/standard/tests/strings/setlocale_variation4.phpt154
-rw-r--r--ext/standard/tests/strings/setlocale_variation5.phpt158
-rw-r--r--ext/standard/tests/strings/sha1.phpt4
-rw-r--r--ext/standard/tests/strings/sprintf_basic1.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic2.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic3.phpt53
-rw-r--r--ext/standard/tests/strings/sprintf_basic4.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic5.phpt42
-rw-r--r--ext/standard/tests/strings/sprintf_basic6.phpt41
-rw-r--r--ext/standard/tests/strings/sprintf_basic7.phpt48
-rw-r--r--ext/standard/tests/strings/sprintf_basic8.phpt47
-rw-r--r--ext/standard/tests/strings/sprintf_basic9.phpt54
-rw-r--r--ext/standard/tests/strings/sprintf_error.phpt64
-rw-r--r--ext/standard/tests/strings/sprintf_variation1.phpt270
-rw-r--r--ext/standard/tests/strings/sprintf_variation10.phpt327
-rw-r--r--ext/standard/tests/strings/sprintf_variation11.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation12.phpt263
-rw-r--r--ext/standard/tests/strings/sprintf_variation13.phpt358
-rw-r--r--ext/standard/tests/strings/sprintf_variation14.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation15.phptbin0 -> 7416 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation16.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation17.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation18.phpt230
-rw-r--r--ext/standard/tests/strings/sprintf_variation19.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation2.phpt219
-rw-r--r--ext/standard/tests/strings/sprintf_variation20.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation21.phptbin0 -> 5046 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation22.phptbin0 -> 2517 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation23.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation24.phptbin0 -> 3464 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation25.phptbin0 -> 4657 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation26.phptbin0 -> 1699 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation27.phptbin0 -> 2693 bytes
-rw-r--r--ext/standard/tests/strings/sprintf_variation28.phpt332
-rw-r--r--ext/standard/tests/strings/sprintf_variation29.phpt172
-rw-r--r--ext/standard/tests/strings/sprintf_variation3.phpt325
-rw-r--r--ext/standard/tests/strings/sprintf_variation30.phpt78
-rw-r--r--ext/standard/tests/strings/sprintf_variation31.phpt246
-rw-r--r--ext/standard/tests/strings/sprintf_variation32.phpt342
-rw-r--r--ext/standard/tests/strings/sprintf_variation33.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation34.phpt332
-rw-r--r--ext/standard/tests/strings/sprintf_variation35.phpt237
-rw-r--r--ext/standard/tests/strings/sprintf_variation36.phpt74
-rw-r--r--ext/standard/tests/strings/sprintf_variation37.phpt230
-rw-r--r--ext/standard/tests/strings/sprintf_variation38.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation39.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation4.phpt237
-rw-r--r--ext/standard/tests/strings/sprintf_variation40.phpt333
-rw-r--r--ext/standard/tests/strings/sprintf_variation41.phpt316
-rw-r--r--ext/standard/tests/strings/sprintf_variation42.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation43.phpt262
-rw-r--r--ext/standard/tests/strings/sprintf_variation44.phpt365
-rw-r--r--ext/standard/tests/strings/sprintf_variation45.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation46.phpt326
-rw-r--r--ext/standard/tests/strings/sprintf_variation47.phpt343
-rw-r--r--ext/standard/tests/strings/sprintf_variation48.phpt79
-rw-r--r--ext/standard/tests/strings/sprintf_variation49.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation5.phpt70
-rw-r--r--ext/standard/tests/strings/sprintf_variation50.phpt343
-rw-r--r--ext/standard/tests/strings/sprintf_variation51.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation52.phpt63
-rw-r--r--ext/standard/tests/strings/sprintf_variation53.phpt70
-rw-r--r--ext/standard/tests/strings/sprintf_variation6.phpt278
-rw-r--r--ext/standard/tests/strings/sprintf_variation7.phpt102
-rw-r--r--ext/standard/tests/strings/sprintf_variation8.phpt374
-rw-r--r--ext/standard/tests/strings/sprintf_variation9.phpt519
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin9783 -> 9780 bytes
-rw-r--r--ext/standard/tests/strings/str_repeat.phptbin10822 -> 10821 bytes
-rw-r--r--ext/standard/tests/strings/str_split_basic.phpt91
-rw-r--r--ext/standard/tests/strings/str_split_error.phpt38
-rw-r--r--ext/standard/tests/strings/str_split_variation1.phpt241
-rw-r--r--ext/standard/tests/strings/str_split_variation2.phpt290
-rw-r--r--ext/standard/tests/strings/str_split_variation2_64bit.phpt291
-rw-r--r--ext/standard/tests/strings/str_split_variation3.phptbin0 -> 3006 bytes
-rw-r--r--ext/standard/tests/strings/str_split_variation4.phpt196
-rw-r--r--ext/standard/tests/strings/str_split_variation5.phpt176
-rw-r--r--ext/standard/tests/strings/str_split_variation6.phpt166
-rw-r--r--ext/standard/tests/strings/str_split_variation6_64bit.phpt167
-rw-r--r--ext/standard/tests/strings/str_split_variation7.phpt144
-rw-r--r--ext/standard/tests/strings/str_split_variation7_64bit.phpt145
-rw-r--r--ext/standard/tests/strings/strcspn_basic.phpt41
-rw-r--r--ext/standard/tests/strings/strcspn_error.phpt57
-rw-r--r--ext/standard/tests/strings/strcspn_variation1.phpt276
-rw-r--r--ext/standard/tests/strings/strcspn_variation10.phpt272
-rw-r--r--ext/standard/tests/strings/strcspn_variation11.phpt1306
-rw-r--r--ext/standard/tests/strings/strcspn_variation12.phpt2482
-rw-r--r--ext/standard/tests/strings/strcspn_variation2.phpt274
-rw-r--r--ext/standard/tests/strings/strcspn_variation3.phpt245
-rw-r--r--ext/standard/tests/strings/strcspn_variation4.phpt198
-rw-r--r--ext/standard/tests/strings/strcspn_variation5.phptbin0 -> 2421 bytes
-rw-r--r--ext/standard/tests/strings/strcspn_variation6.phpt177
-rw-r--r--ext/standard/tests/strings/strcspn_variation7.phpt612
-rw-r--r--ext/standard/tests/strings/strcspn_variation8.phpt1892
-rw-r--r--ext/standard/tests/strings/strcspn_variation9.phptbin0 -> 2539 bytes
-rw-r--r--ext/standard/tests/strings/strip_tags_basic1.phpt75
-rw-r--r--ext/standard/tests/strings/strip_tags_basic2.phpt61
-rw-r--r--ext/standard/tests/strings/strip_tags_error.phpt40
-rw-r--r--ext/standard/tests/strings/strip_tags_variation1.phpt157
-rw-r--r--ext/standard/tests/strings/strip_tags_variation10.phpt55
-rw-r--r--ext/standard/tests/strings/strip_tags_variation2.phpt159
-rw-r--r--ext/standard/tests/strings/strip_tags_variation3.phpt167
-rw-r--r--ext/standard/tests/strings/strip_tags_variation4.phpt74
-rw-r--r--ext/standard/tests/strings/strip_tags_variation5.phpt104
-rw-r--r--ext/standard/tests/strings/strip_tags_variation6.phpt47
-rw-r--r--ext/standard/tests/strings/strip_tags_variation7.phpt72
-rw-r--r--ext/standard/tests/strings/strip_tags_variation8.phpt59
-rw-r--r--ext/standard/tests/strings/strip_tags_variation9.phpt54
-rw-r--r--ext/standard/tests/strings/stripos_basic1.phpt48
-rw-r--r--ext/standard/tests/strings/stripos_basic2.phpt52
-rw-r--r--ext/standard/tests/strings/stripos_error.phpt35
-rw-r--r--ext/standard/tests/strings/stripos_variation1.phpt226
-rw-r--r--ext/standard/tests/strings/stripos_variation10.phpt196
-rw-r--r--ext/standard/tests/strings/stripos_variation11.phpt215
-rw-r--r--ext/standard/tests/strings/stripos_variation12.phpt47
-rw-r--r--ext/standard/tests/strings/stripos_variation13.phpt49
-rw-r--r--ext/standard/tests/strings/stripos_variation14.phpt155
-rw-r--r--ext/standard/tests/strings/stripos_variation15.phpt171
-rw-r--r--ext/standard/tests/strings/stripos_variation2.phpt234
-rw-r--r--ext/standard/tests/strings/stripos_variation3.phpt37
-rw-r--r--ext/standard/tests/strings/stripos_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/stripos_variation5.phpt34
-rw-r--r--ext/standard/tests/strings/stripos_variation6.phpt35
-rw-r--r--ext/standard/tests/strings/stripos_variation7.phpt34
-rw-r--r--ext/standard/tests/strings/stripos_variation8.phpt216
-rw-r--r--ext/standard/tests/strings/stripos_variation9.phpt184
-rw-r--r--ext/standard/tests/strings/stripslashes_basic.phptbin0 -> 2036 bytes
-rw-r--r--ext/standard/tests/strings/stripslashes_error.phpt43
-rw-r--r--ext/standard/tests/strings/stripslashes_variation1.phpt170
-rw-r--r--ext/standard/tests/strings/stripslashes_variation2.phptbin0 -> 9548 bytes
-rw-r--r--ext/standard/tests/strings/stripslashes_variation3.phpt124
-rw-r--r--ext/standard/tests/strings/stripslashes_variation4.phpt133
-rw-r--r--ext/standard/tests/strings/stripslashes_variation5.phptbin0 -> 8397 bytes
-rw-r--r--ext/standard/tests/strings/stristr.phpt2
-rw-r--r--ext/standard/tests/strings/strncasecmp_basic.phpt46
-rw-r--r--ext/standard/tests/strings/strncasecmp_error.phpt52
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation1.phpt135
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation10.phpt184
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation11.phpt185
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation2.phpt63
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation3.phpt39
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation4.phpt195
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation5.phpt147
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation6.phpt810
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation7.phpt27
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation8.phpt52
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation9.phpt92
-rw-r--r--ext/standard/tests/strings/strncmp_basic.phpt46
-rw-r--r--ext/standard/tests/strings/strncmp_error.phpt45
-rw-r--r--ext/standard/tests/strings/strncmp_variation1.phpt135
-rw-r--r--ext/standard/tests/strings/strncmp_variation2.phpt63
-rw-r--r--ext/standard/tests/strings/strncmp_variation3.phpt39
-rw-r--r--ext/standard/tests/strings/strncmp_variation4.phpt198
-rw-r--r--ext/standard/tests/strings/strncmp_variation5.phpt161
-rw-r--r--ext/standard/tests/strings/strncmp_variation6.phpt811
-rw-r--r--ext/standard/tests/strings/strncmp_variation7.phpt24
-rw-r--r--ext/standard/tests/strings/strncmp_variation8.phpt52
-rw-r--r--ext/standard/tests/strings/strncmp_variation9.phpt61
-rw-r--r--ext/standard/tests/strings/strpos.phptbin9401 -> 9396 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_basic.phpt57
-rw-r--r--ext/standard/tests/strings/strrchr_error.phpt40
-rw-r--r--ext/standard/tests/strings/strrchr_variation1.phptbin0 -> 4406 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation10.phpt188
-rw-r--r--ext/standard/tests/strings/strrchr_variation11.phpt159
-rw-r--r--ext/standard/tests/strings/strrchr_variation12.phptbin0 -> 1128 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation2.phpt220
-rw-r--r--ext/standard/tests/strings/strrchr_variation3.phpt43
-rw-r--r--ext/standard/tests/strings/strrchr_variation4.phpt58
-rw-r--r--ext/standard/tests/strings/strrchr_variation5.phpt50
-rw-r--r--ext/standard/tests/strings/strrchr_variation6.phpt45
-rw-r--r--ext/standard/tests/strings/strrchr_variation7.phpt44
-rw-r--r--ext/standard/tests/strings/strrchr_variation8.phpt41
-rw-r--r--ext/standard/tests/strings/strrchr_variation9.phpt196
-rw-r--r--ext/standard/tests/strings/strrev_basic.phpt47
-rw-r--r--ext/standard/tests/strings/strrev_error.phpt27
-rw-r--r--ext/standard/tests/strings/strrev_variation1.phptbin0 -> 2941 bytes
-rw-r--r--ext/standard/tests/strings/strrev_variation2.phptbin0 -> 2955 bytes
-rw-r--r--ext/standard/tests/strings/strrev_variation3.phptbin0 -> 1628 bytes
-rw-r--r--ext/standard/tests/strings/strrev_variation4.phpt180
-rw-r--r--ext/standard/tests/strings/strrpos_basic1.phpt45
-rw-r--r--ext/standard/tests/strings/strrpos_basic2.phpt50
-rw-r--r--ext/standard/tests/strings/strrpos_error.phpt34
-rw-r--r--ext/standard/tests/strings/strrpos_variation1.phpt182
-rw-r--r--ext/standard/tests/strings/strrpos_variation10.phpt150
-rw-r--r--ext/standard/tests/strings/strrpos_variation11.phpt199
-rw-r--r--ext/standard/tests/strings/strrpos_variation12.phpt47
-rw-r--r--ext/standard/tests/strings/strrpos_variation13.phpt49
-rw-r--r--ext/standard/tests/strings/strrpos_variation14.phpt153
-rw-r--r--ext/standard/tests/strings/strrpos_variation15.phpt171
-rw-r--r--ext/standard/tests/strings/strrpos_variation2.phpt186
-rw-r--r--ext/standard/tests/strings/strrpos_variation3.phpt37
-rw-r--r--ext/standard/tests/strings/strrpos_variation4.phpt41
-rw-r--r--ext/standard/tests/strings/strrpos_variation5.phpt34
-rw-r--r--ext/standard/tests/strings/strrpos_variation6.phpt35
-rw-r--r--ext/standard/tests/strings/strrpos_variation7.phpt32
-rw-r--r--ext/standard/tests/strings/strrpos_variation8.phpt59
-rw-r--r--ext/standard/tests/strings/strrpos_variation9.phpt184
-rw-r--r--ext/standard/tests/strings/strspn_basic.phpt41
-rw-r--r--ext/standard/tests/strings/strspn_error.phpt57
-rw-r--r--ext/standard/tests/strings/strspn_variation1.phpt275
-rw-r--r--ext/standard/tests/strings/strspn_variation10.phpt274
-rw-r--r--ext/standard/tests/strings/strspn_variation11.phpt1306
-rw-r--r--ext/standard/tests/strings/strspn_variation12.phpt2878
-rw-r--r--ext/standard/tests/strings/strspn_variation2.phpt274
-rw-r--r--ext/standard/tests/strings/strspn_variation3.phpt245
-rw-r--r--ext/standard/tests/strings/strspn_variation4.phpt198
-rw-r--r--ext/standard/tests/strings/strspn_variation5.phptbin0 -> 2415 bytes
-rw-r--r--ext/standard/tests/strings/strspn_variation6.phpt179
-rw-r--r--ext/standard/tests/strings/strspn_variation7.phpt612
-rw-r--r--ext/standard/tests/strings/strspn_variation8.phpt1894
-rw-r--r--ext/standard/tests/strings/strspn_variation9.phptbin0 -> 2538 bytes
-rw-r--r--ext/standard/tests/strings/strstr.phptbin10390 -> 10387 bytes
-rw-r--r--ext/standard/tests/strings/strtok_basic.phpt63
-rw-r--r--ext/standard/tests/strings/strtok_error.phpt55
-rw-r--r--ext/standard/tests/strings/strtok_variation1.phpt172
-rw-r--r--ext/standard/tests/strings/strtok_variation2.phpt172
-rw-r--r--ext/standard/tests/strings/strtok_variation3.phpt150
-rw-r--r--ext/standard/tests/strings/strtok_variation4.phpt110
-rw-r--r--ext/standard/tests/strings/strtok_variation5.phpt150
-rw-r--r--ext/standard/tests/strings/strtok_variation6.phpt160
-rw-r--r--ext/standard/tests/strings/strtok_variation7.phpt108
-rw-r--r--ext/standard/tests/strings/strtolower.phptbin4806 -> 4773 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1.phptbin4817 -> 4785 bytes
-rw-r--r--ext/standard/tests/strings/strtr_basic.phpt54
-rw-r--r--ext/standard/tests/strings/strtr_error.phpt41
-rw-r--r--ext/standard/tests/strings/strtr_variation1.phpt86
-rw-r--r--ext/standard/tests/strings/strtr_variation2.phpt90
-rw-r--r--ext/standard/tests/strings/strtr_variation3.phpt103
-rw-r--r--ext/standard/tests/strings/strtr_variation4.phpt79
-rw-r--r--ext/standard/tests/strings/strtr_variation5.phpt137
-rw-r--r--ext/standard/tests/strings/strtr_variation6.phpt137
-rw-r--r--ext/standard/tests/strings/strtr_variation7.phpt156
-rw-r--r--ext/standard/tests/strings/strtr_variation8.phpt179
-rw-r--r--ext/standard/tests/strings/strtr_variation9.phpt243
-rw-r--r--ext/standard/tests/strings/substr_count_error.phpt10
-rw-r--r--ext/standard/tests/strings/ucwords_basic.phpt84
-rw-r--r--ext/standard/tests/strings/ucwords_error.phpt42
-rw-r--r--ext/standard/tests/strings/ucwords_variation1.phpt199
-rw-r--r--ext/standard/tests/strings/ucwords_variation2.phpt96
-rw-r--r--ext/standard/tests/strings/ucwords_variation3.phpt97
-rw-r--r--ext/standard/tests/strings/ucwords_variation4.phpt124
-rw-r--r--ext/standard/tests/strings/uuencode.phpt2
-rw-r--r--ext/standard/tests/strings/vsprintf_basic1.phpt33
-rw-r--r--ext/standard/tests/strings/vsprintf_basic2.phpt36
-rw-r--r--ext/standard/tests/strings/vsprintf_basic3.phpt45
-rw-r--r--ext/standard/tests/strings/vsprintf_basic4.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic5.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic6.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic7.phpt36
-rw-r--r--ext/standard/tests/strings/vsprintf_basic7_64bit.phpt36
-rw-r--r--ext/standard/tests/strings/vsprintf_basic8.phpt32
-rw-r--r--ext/standard/tests/strings/vsprintf_basic9.phpt45
-rw-r--r--ext/standard/tests/strings/vsprintf_error.phpt46
-rw-r--r--ext/standard/tests/strings/vsprintf_variation1.phpt191
-rw-r--r--ext/standard/tests/strings/vsprintf_variation10.phptbin0 -> 2779 bytes
-rw-r--r--ext/standard/tests/strings/vsprintf_variation11.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation11_64bit.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation12.phpt118
-rw-r--r--ext/standard/tests/strings/vsprintf_variation12_64bit.phpt118
-rw-r--r--ext/standard/tests/strings/vsprintf_variation13.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation13_64bit.phpt85
-rw-r--r--ext/standard/tests/strings/vsprintf_variation14.phpt119
-rw-r--r--ext/standard/tests/strings/vsprintf_variation14_64bit.phpt119
-rw-r--r--ext/standard/tests/strings/vsprintf_variation15.phpt68
-rw-r--r--ext/standard/tests/strings/vsprintf_variation15_64bit.phpt68
-rw-r--r--ext/standard/tests/strings/vsprintf_variation16.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation16_64bit.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation17.phpt64
-rw-r--r--ext/standard/tests/strings/vsprintf_variation18.phpt100
-rw-r--r--ext/standard/tests/strings/vsprintf_variation19.phpt91
-rw-r--r--ext/standard/tests/strings/vsprintf_variation19_64bit.phpt91
-rw-r--r--ext/standard/tests/strings/vsprintf_variation2.phpt177
-rw-r--r--ext/standard/tests/strings/vsprintf_variation3.phpt82
-rw-r--r--ext/standard/tests/strings/vsprintf_variation4.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation4_64bit.phpt104
-rw-r--r--ext/standard/tests/strings/vsprintf_variation5.phpt82
-rw-r--r--ext/standard/tests/strings/vsprintf_variation6.phpt100
-rw-r--r--ext/standard/tests/strings/vsprintf_variation7.phptbin0 -> 2238 bytes
-rw-r--r--ext/standard/tests/strings/vsprintf_variation8.phpt101
-rw-r--r--ext/standard/tests/strings/vsprintf_variation9.phptbin0 -> 1709 bytes
-rw-r--r--ext/standard/tests/strings/wordwrap_basic.phpt47
-rw-r--r--ext/standard/tests/strings/wordwrap_error.phpt78
-rw-r--r--ext/standard/tests/strings/wordwrap_variation1.phpt335
-rw-r--r--ext/standard/tests/strings/wordwrap_variation2.phpt340
-rw-r--r--ext/standard/tests/strings/wordwrap_variation3.phpt302
-rw-r--r--ext/standard/tests/strings/wordwrap_variation4.phpt144
-rw-r--r--ext/standard/tests/strings/wordwrap_variation5.phpt60
-rw-r--r--ext/standard/uniqid.c4
-rw-r--r--ext/standard/url.c4
-rw-r--r--ext/standard/url_scanner_ex.c53
-rw-r--r--ext/standard/url_scanner_ex.c.orig141
-rw-r--r--ext/standard/url_scanner_ex.re37
-rw-r--r--ext/standard/uuencode.c4
-rw-r--r--ext/standard/var.c6
-rw-r--r--ext/sybase/php_sybase_db.c3
-rw-r--r--ext/sysvshm/sysvshm.c3
-rw-r--r--ext/tidy/tests/029.phpt28
-rw-r--r--ext/tidy/tidy.c34
-rw-r--r--ext/xmlreader/php_xmlreader.c25
-rw-r--r--ext/xmlreader/tests/bug42139.phpt31
-rw-r--r--ext/xmlrpc/libxmlrpc/encodings.c12
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.c17
-rw-r--r--ext/xmlrpc/tests/bug42189.phpt15
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c10
-rw-r--r--ext/xmlwriter/php_xmlwriter.c5
-rw-r--r--ext/xmlwriter/tests/bug41326.phpt2
-rw-r--r--ext/xsl/xsl_fe.h11
-rw-r--r--ext/xsl/xsltprocessor.c31
-rw-r--r--ext/zlib/tests/005.phpt12
-rw-r--r--ext/zlib/tests/006.phpt10
841 files changed, 94869 insertions, 4016 deletions
diff --git a/ext/bz2/php_bz2.h b/ext/bz2/php_bz2.h
index 8abf33414..a547f8c5c 100644
--- a/ext/bz2/php_bz2.h
+++ b/ext/bz2/php_bz2.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_bz2.h,v 1.7.2.1.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: php_bz2.h,v 1.7.2.1.2.4 2007/09/12 11:44:25 jani Exp $ */
#ifndef PHP_BZ2_H
#define PHP_BZ2_H
@@ -51,7 +51,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, char *mode,
#define php_stream_bz2open_from_BZFILE(bz, mode, innerstream) _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC TSRMLS_CC)
#define php_stream_bz2open(wrapper, path, mode, options, opened_path) _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC TSRMLS_CC)
-php_stream_filter_factory php_bz2_filter_factory;
+extern php_stream_filter_factory php_bz2_filter_factory;
extern php_stream_ops php_stream_bz2io_ops;
#define PHP_STREAM_IS_BZIP2 &php_stream_bz2io_ops
diff --git a/ext/bz2/tests/005.phpt b/ext/bz2/tests/005.phpt
index 48323531e..fc2235d62 100644
--- a/ext/bz2/tests/005.phpt
+++ b/ext/bz2/tests/005.phpt
@@ -37,10 +37,10 @@ var_dump(bzdecompress($data2));
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: Wrong parameter count for bzcompress() in %s on line %d
NULL
-string(%d) "BZ%s"
+string(%d) "BZ%a"
int(-2)
int(-2)
int(-2)
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 52aaeb24d..683c36aec 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.62.2.14.2.27 2007/07/04 13:34:23 tony2001 Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.29 2007/10/13 11:35:35 bjori Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -174,7 +174,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
} \
\
if (!php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL '%s' contains unencoded control characters.", str); \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL '%s' contains unencoded control characters", str); \
php_url_free(tmp_url); \
php_curl_ret(__ret); \
} \
@@ -387,7 +387,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERPWD);
REGISTER_CURL_CONSTANT(CURLOPT_RANGE);
REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT);
-#ifdef CURLOPT_TIMEOUT_MS
+#if LIBCURL_VERSION_NUM > 0x071002
REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT_MS);
#endif
REGISTER_CURL_CONSTANT(CURLOPT_POSTFIELDS);
@@ -433,7 +433,7 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_RANDOM_FILE);
REGISTER_CURL_CONSTANT(CURLOPT_EGDSOCKET);
REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT);
-#ifdef CURLOPT_CONNECTTIMEOUT_MS
+#if LIBCURL_VERSION_NUM > 0x071002
REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT_MS);
#endif
REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYPEER);
@@ -980,7 +980,7 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
strlcpy(buf, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string.", Z_STRVAL_P(func));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func));
}
zval_ptr_dtor(&argv[0]);
@@ -1233,7 +1233,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_MUTE:
#endif
case CURLOPT_TIMEOUT:
-#ifdef CURLOPT_TIMEOUT_MS
+#if LIBCURL_VERSION_NUM > 0x071002
case CURLOPT_TIMEOUT_MS:
#endif
case CURLOPT_FTP_USE_EPSV:
@@ -1252,7 +1252,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
case CURLOPT_FRESH_CONNECT:
case CURLOPT_FORBID_REUSE:
case CURLOPT_CONNECTTIMEOUT:
-#ifdef CURLOPT_CONNECTTIMEOUT_MS
+#if LIBCURL_VERSION_NUM > 0x071002
case CURLOPT_CONNECTTIMEOUT_MS:
#endif
case CURLOPT_SSL_VERIFYHOST:
@@ -1645,7 +1645,7 @@ PHP_FUNCTION(curl_setopt_array)
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&entry, &pos) == SUCCESS) {
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &string_key, &str_key_len, &option, 0, &pos) == HASH_KEY_IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent interger values.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent integer values");
RETURN_FALSE;
}
if (_php_curl_setopt(ch, option, entry, return_value TSRMLS_CC)) {
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index d12667fbf..5aae8e036 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_tz.c,v 1.20.2.6.2.12 2007/01/25 14:38:45 tony2001 Exp $ */
+/* $Id: parse_tz.c,v 1.20.2.6.2.13 2007/09/04 18:46:21 tony2001 Exp $ */
#include "timelib.h"
@@ -33,6 +33,16 @@
#endif
#include "timezonedb.h"
+#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+# if defined(__LITTLE_ENDIAN__)
+# undef WORDS_BIGENDIAN
+# else
+# if defined(__BIG_ENDIAN__)
+# define WORDS_BIGENDIAN
+# endif
+# endif
+#endif
+
#ifdef WORDS_BIGENDIAN
#define timelib_conv_int(l) (l)
#else
diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h
index fa5135b69..cfab2c936 100644
--- a/ext/date/lib/timezonedb.h
+++ b/ext/date/lib/timezonedb.h
@@ -1,4 +1,4 @@
-const timelib_tzdb_index_entry timezonedb_idx_builtin[551] = {
+const timelib_tzdb_index_entry timezonedb_idx_builtin[552] = {
{ "Africa/Abidjan" , 0x000000 },
{ "Africa/Accra" , 0x000049 },
{ "Africa/Addis_Ababa" , 0x0000E5 },
@@ -85,474 +85,475 @@ const timelib_tzdb_index_entry timezonedb_idx_builtin[551] = {
{ "America/Campo_Grande" , 0x004D11 },
{ "America/Cancun" , 0x004FE2 },
{ "America/Caracas" , 0x0051FD },
- { "America/Catamarca" , 0x005253 },
- { "America/Cayenne" , 0x0053E3 },
- { "America/Cayman" , 0x005439 },
- { "America/Chicago" , 0x005482 },
- { "America/Chihuahua" , 0x005981 },
- { "America/Coral_Harbour" , 0x005BAB },
- { "America/Cordoba" , 0x005C31 },
- { "America/Costa_Rica" , 0x005DB7 },
- { "America/Cuiaba" , 0x005E35 },
- { "America/Curacao" , 0x0060FC },
- { "America/Danmarkshavn" , 0x006156 },
- { "America/Dawson" , 0x00626D },
- { "America/Dawson_Creek" , 0x006564 },
- { "America/Denver" , 0x0066E9 },
- { "America/Detroit" , 0x006A56 },
- { "America/Dominica" , 0x006D81 },
- { "America/Edmonton" , 0x006DCA },
- { "America/Eirunepe" , 0x007134 },
- { "America/El_Salvador" , 0x007220 },
- { "America/Ensenada" , 0x007289 },
- { "America/Fort_Wayne" , 0x0076FA },
- { "America/Fortaleza" , 0x0075E6 },
- { "America/Glace_Bay" , 0x007958 },
- { "America/Godthab" , 0x007C7C },
- { "America/Goose_Bay" , 0x007F26 },
- { "America/Grand_Turk" , 0x0083AE },
- { "America/Grenada" , 0x008651 },
- { "America/Guadeloupe" , 0x00869A },
- { "America/Guatemala" , 0x0086E3 },
- { "America/Guayaquil" , 0x008760 },
- { "America/Guyana" , 0x0087A9 },
- { "America/Halifax" , 0x00881E },
- { "America/Havana" , 0x008CFA },
- { "America/Hermosillo" , 0x009061 },
- { "America/Indiana/Indianapolis" , 0x009114 },
- { "America/Indiana/Knox" , 0x009372 },
- { "America/Indiana/Marengo" , 0x0096D7 },
- { "America/Indiana/Petersburg" , 0x009949 },
- { "America/Indiana/Vevay" , 0x009E4E },
- { "America/Indiana/Vincennes" , 0x00A052 },
- { "America/Indiana/Winamac" , 0x00A2BA },
- { "America/Indianapolis" , 0x009BF0 },
- { "America/Inuvik" , 0x00A540 },
- { "America/Iqaluit" , 0x00A801 },
- { "America/Jamaica" , 0x00AAEB },
- { "America/Jujuy" , 0x00ABA4 },
- { "America/Juneau" , 0x00AD38 },
- { "America/Kentucky/Louisville" , 0x00B08C },
- { "America/Kentucky/Monticello" , 0x00B475 },
- { "America/Knox_IN" , 0x00B7C8 },
- { "America/La_Paz" , 0x00BB2D },
- { "America/Lima" , 0x00BB88 },
- { "America/Los_Angeles" , 0x00BC24 },
- { "America/Louisville" , 0x00C01D },
- { "America/Maceio" , 0x00C406 },
- { "America/Managua" , 0x00C524 },
- { "America/Manaus" , 0x00C5CB },
- { "America/Martinique" , 0x00C6B7 },
- { "America/Mazatlan" , 0x00C717 },
- { "America/Mendoza" , 0x00C950 },
- { "America/Menominee" , 0x00CAEE },
- { "America/Merida" , 0x00CE1C },
- { "America/Mexico_City" , 0x00D02B },
- { "America/Miquelon" , 0x00D27D },
- { "America/Moncton" , 0x00D4E3 },
- { "America/Monterrey" , 0x00D951 },
- { "America/Montevideo" , 0x00DB54 },
- { "America/Montreal" , 0x00DE5A },
- { "America/Montserrat" , 0x00E33E },
- { "America/Nassau" , 0x00E387 },
- { "America/New_York" , 0x00E6C0 },
- { "America/Nipigon" , 0x00EBB3 },
- { "America/Nome" , 0x00EEAD },
- { "America/Noronha" , 0x00F206 },
- { "America/North_Dakota/Center" , 0x00F31A },
- { "America/North_Dakota/New_Salem" , 0x00F677 },
- { "America/Panama" , 0x00F9D4 },
- { "America/Pangnirtung" , 0x00FA1D },
- { "America/Paramaribo" , 0x00FD24 },
- { "America/Phoenix" , 0x00FDAA },
- { "America/Port-au-Prince" , 0x00FE2C },
- { "America/Port_of_Spain" , 0x01001E },
- { "America/Porto_Acre" , 0x00FF3C },
- { "America/Porto_Velho" , 0x010067 },
- { "America/Puerto_Rico" , 0x010149 },
- { "America/Rainy_River" , 0x0101A8 },
- { "America/Rankin_Inlet" , 0x0104A2 },
- { "America/Recife" , 0x01075E },
- { "America/Regina" , 0x010872 },
- { "America/Resolute" , 0x0109EF },
- { "America/Rio_Branco" , 0x010B75 },
- { "America/Rosario" , 0x010C57 },
- { "America/Santiago" , 0x010DDD },
- { "America/Santo_Domingo" , 0x01116C },
- { "America/Sao_Paulo" , 0x011226 },
- { "America/Scoresbysund" , 0x0114F7 },
- { "America/Shiprock" , 0x0117BA },
- { "America/St_Johns" , 0x011B27 },
- { "America/St_Kitts" , 0x012046 },
- { "America/St_Lucia" , 0x01208F },
- { "America/St_Thomas" , 0x0120D8 },
- { "America/St_Vincent" , 0x012121 },
- { "America/Swift_Current" , 0x01216A },
- { "America/Tegucigalpa" , 0x012251 },
- { "America/Thule" , 0x0122C4 },
- { "America/Thunder_Bay" , 0x0124EF },
- { "America/Tijuana" , 0x012809 },
- { "America/Toronto" , 0x012B66 },
- { "America/Tortola" , 0x01304A },
- { "America/Vancouver" , 0x013093 },
- { "America/Virgin" , 0x0134A0 },
- { "America/Whitehorse" , 0x0134E9 },
- { "America/Winnipeg" , 0x0137E0 },
- { "America/Yakutat" , 0x013BEE },
- { "America/Yellowknife" , 0x013F2A },
- { "Antarctica/Casey" , 0x014201 },
- { "Antarctica/Davis" , 0x01424A },
- { "Antarctica/DumontDUrville" , 0x01429E },
- { "Antarctica/Mawson" , 0x0142FE },
- { "Antarctica/McMurdo" , 0x014348 },
- { "Antarctica/Palmer" , 0x014622 },
- { "Antarctica/Rothera" , 0x014915 },
- { "Antarctica/South_Pole" , 0x01495F },
- { "Antarctica/Syowa" , 0x014C39 },
- { "Antarctica/Vostok" , 0x014C83 },
- { "Arctic/Longyearbyen" , 0x014CCD },
- { "Asia/Aden" , 0x014FF3 },
- { "Asia/Almaty" , 0x01503C },
- { "Asia/Amman" , 0x0151A1 },
- { "Asia/Anadyr" , 0x015455 },
- { "Asia/Aqtau" , 0x015721 },
- { "Asia/Aqtobe" , 0x0158E3 },
- { "Asia/Ashgabat" , 0x015A80 },
- { "Asia/Ashkhabad" , 0x015B91 },
- { "Asia/Baghdad" , 0x015CA2 },
- { "Asia/Bahrain" , 0x015F37 },
- { "Asia/Baku" , 0x015F91 },
- { "Asia/Bangkok" , 0x01626D },
- { "Asia/Beirut" , 0x0162B6 },
- { "Asia/Bishkek" , 0x0165B7 },
- { "Asia/Brunei" , 0x016757 },
- { "Asia/Calcutta" , 0x0167AD },
- { "Asia/Choibalsan" , 0x01681A },
- { "Asia/Chongqing" , 0x016968 },
- { "Asia/Chungking" , 0x016A0B },
- { "Asia/Colombo" , 0x016AAE },
- { "Asia/Dacca" , 0x016B3E },
- { "Asia/Damascus" , 0x016BC1 },
- { "Asia/Dhaka" , 0x016F05 },
- { "Asia/Dili" , 0x016F88 },
- { "Asia/Dubai" , 0x017005 },
- { "Asia/Dushanbe" , 0x01704E },
- { "Asia/Gaza" , 0x017145 },
- { "Asia/Harbin" , 0x017482 },
- { "Asia/Hong_Kong" , 0x01753C },
- { "Asia/Hovd" , 0x0176E6 },
- { "Asia/Irkutsk" , 0x017827 },
- { "Asia/Istanbul" , 0x017AEB },
- { "Asia/Jakarta" , 0x017ECC },
- { "Asia/Jayapura" , 0x017F5C },
- { "Asia/Jerusalem" , 0x017FBB },
- { "Asia/Kabul" , 0x0182DE },
- { "Asia/Kamchatka" , 0x018323 },
- { "Asia/Karachi" , 0x0185E7 },
- { "Asia/Kashgar" , 0x01867C },
- { "Asia/Katmandu" , 0x01872C },
- { "Asia/Krasnoyarsk" , 0x018786 },
- { "Asia/Kuala_Lumpur" , 0x018A4A },
- { "Asia/Kuching" , 0x018AE8 },
- { "Asia/Kuwait" , 0x018BBB },
- { "Asia/Macao" , 0x018C04 },
- { "Asia/Macau" , 0x018D33 },
- { "Asia/Magadan" , 0x018E62 },
- { "Asia/Makassar" , 0x019126 },
- { "Asia/Manila" , 0x019196 },
- { "Asia/Muscat" , 0x01920F },
- { "Asia/Nicosia" , 0x019258 },
- { "Asia/Novosibirsk" , 0x019534 },
- { "Asia/Omsk" , 0x019805 },
- { "Asia/Oral" , 0x019AC9 },
- { "Asia/Phnom_Penh" , 0x019C7E },
- { "Asia/Pontianak" , 0x019CEA },
- { "Asia/Pyongyang" , 0x019D8A },
- { "Asia/Qatar" , 0x019DEB },
- { "Asia/Qyzylorda" , 0x019E45 },
- { "Asia/Rangoon" , 0x019FEF },
- { "Asia/Riyadh" , 0x01A05B },
- { "Asia/Saigon" , 0x01A0A4 },
- { "Asia/Sakhalin" , 0x01A110 },
- { "Asia/Samarkand" , 0x01A3E9 },
- { "Asia/Seoul" , 0x01A504 },
- { "Asia/Shanghai" , 0x01A59C },
- { "Asia/Singapore" , 0x01A641 },
- { "Asia/Taipei" , 0x01A6EC },
- { "Asia/Tashkent" , 0x01A7F8 },
- { "Asia/Tbilisi" , 0x01A90E },
- { "Asia/Tehran" , 0x01AABC },
- { "Asia/Tel_Aviv" , 0x01ABF2 },
- { "Asia/Thimbu" , 0x01AF15 },
- { "Asia/Thimphu" , 0x01AF6F },
- { "Asia/Tokyo" , 0x01AFC9 },
- { "Asia/Ujung_Pandang" , 0x01B046 },
- { "Asia/Ulaanbaatar" , 0x01B0B6 },
- { "Asia/Ulan_Bator" , 0x01B1F7 },
- { "Asia/Urumqi" , 0x01B338 },
- { "Asia/Vientiane" , 0x01B3DB },
- { "Asia/Vladivostok" , 0x01B447 },
- { "Asia/Yakutsk" , 0x01B712 },
- { "Asia/Yekaterinburg" , 0x01B9D6 },
- { "Asia/Yerevan" , 0x01BCC5 },
- { "Atlantic/Azores" , 0x01BFBD },
- { "Atlantic/Bermuda" , 0x01C4AE },
- { "Atlantic/Canary" , 0x01C783 },
- { "Atlantic/Cape_Verde" , 0x01CA3F },
- { "Atlantic/Faeroe" , 0x01CAAC },
- { "Atlantic/Faroe" , 0x01CD44 },
- { "Atlantic/Jan_Mayen" , 0x01CFDC },
- { "Atlantic/Madeira" , 0x01D302 },
- { "Atlantic/Reykjavik" , 0x01D7F0 },
- { "Atlantic/South_Georgia" , 0x01D99D },
- { "Atlantic/St_Helena" , 0x01DC9D },
- { "Atlantic/Stanley" , 0x01D9D5 },
- { "Australia/ACT" , 0x01DCE6 },
- { "Australia/Adelaide" , 0x01DFF7 },
- { "Australia/Brisbane" , 0x01E308 },
- { "Australia/Broken_Hill" , 0x01E3A8 },
- { "Australia/Canberra" , 0x01E6BE },
- { "Australia/Currie" , 0x01E9CF },
- { "Australia/Darwin" , 0x01ECE0 },
- { "Australia/Eucla" , 0x01ED48 },
- { "Australia/Hobart" , 0x01EDF3 },
- { "Australia/LHI" , 0x01F12C },
- { "Australia/Lindeman" , 0x01F3BB },
- { "Australia/Lord_Howe" , 0x01F474 },
- { "Australia/Melbourne" , 0x01F703 },
- { "Australia/North" , 0x01FA14 },
- { "Australia/NSW" , 0x01FA7C },
- { "Australia/Perth" , 0x01FD8D },
- { "Australia/Queensland" , 0x01FE37 },
- { "Australia/South" , 0x01FED7 },
- { "Australia/Sydney" , 0x0201E8 },
- { "Australia/Tasmania" , 0x0204F9 },
- { "Australia/Victoria" , 0x020832 },
- { "Australia/West" , 0x020B43 },
- { "Australia/Yancowinna" , 0x020BED },
- { "Brazil/Acre" , 0x020F03 },
- { "Brazil/DeNoronha" , 0x020FE5 },
- { "Brazil/East" , 0x0210F9 },
- { "Brazil/West" , 0x0213CA },
- { "Canada/Atlantic" , 0x0214B6 },
- { "Canada/Central" , 0x021992 },
- { "Canada/East-Saskatchewan" , 0x022284 },
- { "Canada/Eastern" , 0x021DA0 },
- { "Canada/Mountain" , 0x022401 },
- { "Canada/Newfoundland" , 0x02276B },
- { "Canada/Pacific" , 0x022C8A },
- { "Canada/Saskatchewan" , 0x023097 },
- { "Canada/Yukon" , 0x023214 },
- { "CET" , 0x02350B },
- { "Chile/Continental" , 0x0237FE },
- { "Chile/EasterIsland" , 0x023B8D },
- { "CST6CDT" , 0x023EC3 },
- { "Cuba" , 0x024208 },
- { "EET" , 0x02456F },
- { "Egypt" , 0x024816 },
- { "Eire" , 0x024BD1 },
- { "EST" , 0x0250D6 },
- { "EST5EDT" , 0x02510E },
- { "Etc/GMT" , 0x025453 },
- { "Etc/GMT+0" , 0x0254FB },
- { "Etc/GMT+1" , 0x02556D },
- { "Etc/GMT+10" , 0x0255E2 },
- { "Etc/GMT+11" , 0x025658 },
- { "Etc/GMT+12" , 0x0256CE },
- { "Etc/GMT+2" , 0x0257B9 },
- { "Etc/GMT+3" , 0x02582D },
- { "Etc/GMT+4" , 0x0258A1 },
- { "Etc/GMT+5" , 0x025915 },
- { "Etc/GMT+6" , 0x025989 },
- { "Etc/GMT+7" , 0x0259FD },
- { "Etc/GMT+8" , 0x025A71 },
- { "Etc/GMT+9" , 0x025AE5 },
- { "Etc/GMT-0" , 0x0254C3 },
- { "Etc/GMT-1" , 0x025533 },
- { "Etc/GMT-10" , 0x0255A7 },
- { "Etc/GMT-11" , 0x02561D },
- { "Etc/GMT-12" , 0x025693 },
- { "Etc/GMT-13" , 0x025709 },
- { "Etc/GMT-14" , 0x025744 },
- { "Etc/GMT-2" , 0x02577F },
- { "Etc/GMT-3" , 0x0257F3 },
- { "Etc/GMT-4" , 0x025867 },
- { "Etc/GMT-5" , 0x0258DB },
- { "Etc/GMT-6" , 0x02594F },
- { "Etc/GMT-7" , 0x0259C3 },
- { "Etc/GMT-8" , 0x025A37 },
- { "Etc/GMT-9" , 0x025AAB },
- { "Etc/GMT0" , 0x02548B },
- { "Etc/Greenwich" , 0x025B1F },
- { "Etc/UCT" , 0x025B57 },
- { "Etc/Universal" , 0x025B8F },
- { "Etc/UTC" , 0x025BC7 },
- { "Etc/Zulu" , 0x025BFF },
- { "Europe/Amsterdam" , 0x025C37 },
- { "Europe/Andorra" , 0x026069 },
- { "Europe/Athens" , 0x0262D9 },
- { "Europe/Belfast" , 0x026610 },
- { "Europe/Belgrade" , 0x026B3B },
- { "Europe/Berlin" , 0x026DF3 },
- { "Europe/Bratislava" , 0x027138 },
- { "Europe/Brussels" , 0x02745E },
- { "Europe/Bucharest" , 0x027889 },
- { "Europe/Budapest" , 0x027BA7 },
- { "Europe/Chisinau" , 0x027F09 },
- { "Europe/Copenhagen" , 0x02828B },
- { "Europe/Dublin" , 0x028589 },
- { "Europe/Gibraltar" , 0x028A8E },
- { "Europe/Guernsey" , 0x028ED9 },
- { "Europe/Helsinki" , 0x029404 },
- { "Europe/Isle_of_Man" , 0x0296AE },
- { "Europe/Istanbul" , 0x029BD9 },
- { "Europe/Jersey" , 0x029FBA },
- { "Europe/Kaliningrad" , 0x02A4E5 },
- { "Europe/Kiev" , 0x02A825 },
- { "Europe/Lisbon" , 0x02AB22 },
- { "Europe/Ljubljana" , 0x02B012 },
- { "Europe/London" , 0x02B2CA },
- { "Europe/Luxembourg" , 0x02B7F5 },
- { "Europe/Madrid" , 0x02BC3F },
- { "Europe/Malta" , 0x02BFF1 },
- { "Europe/Mariehamn" , 0x02C39E },
- { "Europe/Minsk" , 0x02C648 },
- { "Europe/Monaco" , 0x02C947 },
- { "Europe/Moscow" , 0x02CD76 },
- { "Europe/Nicosia" , 0x02D0A5 },
- { "Europe/Oslo" , 0x02D381 },
- { "Europe/Paris" , 0x02D6A7 },
- { "Europe/Podgorica" , 0x02DAE1 },
- { "Europe/Prague" , 0x02DD99 },
- { "Europe/Riga" , 0x02E0BF },
- { "Europe/Rome" , 0x02E3F8 },
- { "Europe/Samara" , 0x02E7AF },
- { "Europe/San_Marino" , 0x02EAB3 },
- { "Europe/Sarajevo" , 0x02EE6A },
- { "Europe/Simferopol" , 0x02F122 },
- { "Europe/Skopje" , 0x02F433 },
- { "Europe/Sofia" , 0x02F6EB },
- { "Europe/Stockholm" , 0x02F9DA },
- { "Europe/Tallinn" , 0x02FC7D },
- { "Europe/Tirane" , 0x02FFAB },
- { "Europe/Tiraspol" , 0x0302A5 },
- { "Europe/Uzhgorod" , 0x030627 },
- { "Europe/Vaduz" , 0x03092A },
- { "Europe/Vatican" , 0x030BB1 },
- { "Europe/Vienna" , 0x030F68 },
- { "Europe/Vilnius" , 0x031289 },
- { "Europe/Volgograd" , 0x0315BC },
- { "Europe/Warsaw" , 0x0318A2 },
- { "Europe/Zagreb" , 0x031C77 },
- { "Europe/Zaporozhye" , 0x031F2F },
- { "Europe/Zurich" , 0x032236 },
- { "Factory" , 0x0324E3 },
- { "GB" , 0x032548 },
- { "GB-Eire" , 0x032A73 },
- { "GMT" , 0x032F9E },
- { "GMT+0" , 0x033046 },
- { "GMT-0" , 0x03300E },
- { "GMT0" , 0x032FD6 },
- { "Greenwich" , 0x03307E },
- { "Hongkong" , 0x0330B6 },
- { "HST" , 0x033260 },
- { "Iceland" , 0x033298 },
- { "Indian/Antananarivo" , 0x033445 },
- { "Indian/Chagos" , 0x0334AD },
- { "Indian/Christmas" , 0x033503 },
- { "Indian/Cocos" , 0x03353B },
- { "Indian/Comoro" , 0x033573 },
- { "Indian/Kerguelen" , 0x0335BC },
- { "Indian/Mahe" , 0x033605 },
- { "Indian/Maldives" , 0x03364E },
- { "Indian/Mauritius" , 0x033697 },
- { "Indian/Mayotte" , 0x0336E0 },
- { "Indian/Reunion" , 0x033729 },
- { "Iran" , 0x033772 },
- { "Israel" , 0x0338A8 },
- { "Jamaica" , 0x033BCB },
- { "Japan" , 0x033C84 },
- { "Kwajalein" , 0x033D01 },
- { "Libya" , 0x033D58 },
- { "MET" , 0x033E46 },
- { "Mexico/BajaNorte" , 0x034139 },
- { "Mexico/BajaSur" , 0x034496 },
- { "Mexico/General" , 0x0346CF },
- { "MST" , 0x034921 },
- { "MST7MDT" , 0x034959 },
- { "Navajo" , 0x034C9E },
- { "NZ" , 0x03500B },
- { "NZ-CHAT" , 0x03537D },
- { "Pacific/Apia" , 0x035659 },
- { "Pacific/Auckland" , 0x0356B4 },
- { "Pacific/Chatham" , 0x035A26 },
- { "Pacific/Easter" , 0x035D02 },
- { "Pacific/Efate" , 0x036038 },
- { "Pacific/Enderbury" , 0x0360F2 },
- { "Pacific/Fakaofo" , 0x036145 },
- { "Pacific/Fiji" , 0x03617D },
- { "Pacific/Funafuti" , 0x0361E7 },
- { "Pacific/Galapagos" , 0x03621F },
- { "Pacific/Gambier" , 0x03627A },
- { "Pacific/Guadalcanal" , 0x0362C4 },
- { "Pacific/Guam" , 0x03630D },
- { "Pacific/Honolulu" , 0x036357 },
- { "Pacific/Johnston" , 0x0363D9 },
- { "Pacific/Kiritimati" , 0x036411 },
- { "Pacific/Kosrae" , 0x036464 },
- { "Pacific/Kwajalein" , 0x0364AF },
- { "Pacific/Majuro" , 0x036506 },
- { "Pacific/Marquesas" , 0x03654B },
- { "Pacific/Midway" , 0x036595 },
- { "Pacific/Nauru" , 0x036605 },
- { "Pacific/Niue" , 0x036671 },
- { "Pacific/Norfolk" , 0x0366C3 },
- { "Pacific/Noumea" , 0x03670C },
- { "Pacific/Pago_Pago" , 0x036790 },
- { "Pacific/Palau" , 0x03680D },
- { "Pacific/Pitcairn" , 0x036845 },
- { "Pacific/Ponape" , 0x03688E },
- { "Pacific/Port_Moresby" , 0x0368C7 },
- { "Pacific/Rarotonga" , 0x0368FF },
- { "Pacific/Saipan" , 0x0369CF },
- { "Pacific/Samoa" , 0x036A26 },
- { "Pacific/Tahiti" , 0x036AA3 },
- { "Pacific/Tarawa" , 0x036AED },
- { "Pacific/Tongatapu" , 0x036B26 },
- { "Pacific/Truk" , 0x036BA6 },
- { "Pacific/Wake" , 0x036BDF },
- { "Pacific/Wallis" , 0x036C18 },
- { "Pacific/Yap" , 0x036C50 },
- { "Poland" , 0x036C89 },
- { "Portugal" , 0x03705E },
- { "PRC" , 0x03754E },
- { "PST8PDT" , 0x0375F3 },
- { "ROC" , 0x037938 },
- { "ROK" , 0x037A44 },
- { "Singapore" , 0x037ADC },
- { "Turkey" , 0x037B87 },
- { "UCT" , 0x037F68 },
- { "Universal" , 0x037FA0 },
- { "US/Alaska" , 0x037FD8 },
- { "US/Aleutian" , 0x038335 },
- { "US/Arizona" , 0x03868F },
- { "US/Central" , 0x038711 },
- { "US/East-Indiana" , 0x039103 },
- { "US/Eastern" , 0x038C10 },
- { "US/Hawaii" , 0x039361 },
- { "US/Indiana-Starke" , 0x0393E3 },
- { "US/Michigan" , 0x039748 },
- { "US/Mountain" , 0x039A73 },
- { "US/Pacific" , 0x039DE0 },
- { "US/Pacific-New" , 0x03A1D9 },
- { "US/Samoa" , 0x03A5D2 },
- { "UTC" , 0x03A64F },
- { "W-SU" , 0x03A92E },
- { "WET" , 0x03A687 },
- { "Zulu" , 0x03AC5D },
+ { "America/Catamarca" , 0x005258 },
+ { "America/Cayenne" , 0x0053E8 },
+ { "America/Cayman" , 0x00543E },
+ { "America/Chicago" , 0x005487 },
+ { "America/Chihuahua" , 0x005986 },
+ { "America/Coral_Harbour" , 0x005BB0 },
+ { "America/Cordoba" , 0x005C36 },
+ { "America/Costa_Rica" , 0x005DBC },
+ { "America/Cuiaba" , 0x005E3A },
+ { "America/Curacao" , 0x006101 },
+ { "America/Danmarkshavn" , 0x00615B },
+ { "America/Dawson" , 0x006272 },
+ { "America/Dawson_Creek" , 0x006569 },
+ { "America/Denver" , 0x0066EE },
+ { "America/Detroit" , 0x006A5B },
+ { "America/Dominica" , 0x006D86 },
+ { "America/Edmonton" , 0x006DCF },
+ { "America/Eirunepe" , 0x007139 },
+ { "America/El_Salvador" , 0x007225 },
+ { "America/Ensenada" , 0x00728E },
+ { "America/Fort_Wayne" , 0x0076FF },
+ { "America/Fortaleza" , 0x0075EB },
+ { "America/Glace_Bay" , 0x00795D },
+ { "America/Godthab" , 0x007C81 },
+ { "America/Goose_Bay" , 0x007F2B },
+ { "America/Grand_Turk" , 0x0083B3 },
+ { "America/Grenada" , 0x008656 },
+ { "America/Guadeloupe" , 0x00869F },
+ { "America/Guatemala" , 0x0086E8 },
+ { "America/Guayaquil" , 0x008765 },
+ { "America/Guyana" , 0x0087AE },
+ { "America/Halifax" , 0x008823 },
+ { "America/Havana" , 0x008CFF },
+ { "America/Hermosillo" , 0x009066 },
+ { "America/Indiana/Indianapolis" , 0x009119 },
+ { "America/Indiana/Knox" , 0x009377 },
+ { "America/Indiana/Marengo" , 0x0096DC },
+ { "America/Indiana/Petersburg" , 0x00994E },
+ { "America/Indiana/Tell_City" , 0x009E5F },
+ { "America/Indiana/Vevay" , 0x00A0C7 },
+ { "America/Indiana/Vincennes" , 0x00A2CB },
+ { "America/Indiana/Winamac" , 0x00A533 },
+ { "America/Indianapolis" , 0x009C01 },
+ { "America/Inuvik" , 0x00A7B9 },
+ { "America/Iqaluit" , 0x00AA7A },
+ { "America/Jamaica" , 0x00AD64 },
+ { "America/Jujuy" , 0x00AE1D },
+ { "America/Juneau" , 0x00AFB1 },
+ { "America/Kentucky/Louisville" , 0x00B305 },
+ { "America/Kentucky/Monticello" , 0x00B6EE },
+ { "America/Knox_IN" , 0x00BA41 },
+ { "America/La_Paz" , 0x00BDA6 },
+ { "America/Lima" , 0x00BE01 },
+ { "America/Los_Angeles" , 0x00BE9D },
+ { "America/Louisville" , 0x00C296 },
+ { "America/Maceio" , 0x00C67F },
+ { "America/Managua" , 0x00C79D },
+ { "America/Manaus" , 0x00C844 },
+ { "America/Martinique" , 0x00C930 },
+ { "America/Mazatlan" , 0x00C990 },
+ { "America/Mendoza" , 0x00CBC9 },
+ { "America/Menominee" , 0x00CD67 },
+ { "America/Merida" , 0x00D095 },
+ { "America/Mexico_City" , 0x00D2A4 },
+ { "America/Miquelon" , 0x00D4F6 },
+ { "America/Moncton" , 0x00D75C },
+ { "America/Monterrey" , 0x00DBCA },
+ { "America/Montevideo" , 0x00DDCD },
+ { "America/Montreal" , 0x00E0D3 },
+ { "America/Montserrat" , 0x00E5B7 },
+ { "America/Nassau" , 0x00E600 },
+ { "America/New_York" , 0x00E939 },
+ { "America/Nipigon" , 0x00EE2C },
+ { "America/Nome" , 0x00F126 },
+ { "America/Noronha" , 0x00F47F },
+ { "America/North_Dakota/Center" , 0x00F593 },
+ { "America/North_Dakota/New_Salem" , 0x00F8F0 },
+ { "America/Panama" , 0x00FC4D },
+ { "America/Pangnirtung" , 0x00FC96 },
+ { "America/Paramaribo" , 0x00FF9D },
+ { "America/Phoenix" , 0x010023 },
+ { "America/Port-au-Prince" , 0x0100A5 },
+ { "America/Port_of_Spain" , 0x010297 },
+ { "America/Porto_Acre" , 0x0101B5 },
+ { "America/Porto_Velho" , 0x0102E0 },
+ { "America/Puerto_Rico" , 0x0103C2 },
+ { "America/Rainy_River" , 0x010421 },
+ { "America/Rankin_Inlet" , 0x01071B },
+ { "America/Recife" , 0x0109D7 },
+ { "America/Regina" , 0x010AEB },
+ { "America/Resolute" , 0x010C68 },
+ { "America/Rio_Branco" , 0x010DEE },
+ { "America/Rosario" , 0x010ED0 },
+ { "America/Santiago" , 0x011056 },
+ { "America/Santo_Domingo" , 0x0113E5 },
+ { "America/Sao_Paulo" , 0x01149F },
+ { "America/Scoresbysund" , 0x011770 },
+ { "America/Shiprock" , 0x011A33 },
+ { "America/St_Johns" , 0x011DA0 },
+ { "America/St_Kitts" , 0x0122BF },
+ { "America/St_Lucia" , 0x012308 },
+ { "America/St_Thomas" , 0x012351 },
+ { "America/St_Vincent" , 0x01239A },
+ { "America/Swift_Current" , 0x0123E3 },
+ { "America/Tegucigalpa" , 0x0124CA },
+ { "America/Thule" , 0x01253D },
+ { "America/Thunder_Bay" , 0x012768 },
+ { "America/Tijuana" , 0x012A82 },
+ { "America/Toronto" , 0x012DDF },
+ { "America/Tortola" , 0x0132C3 },
+ { "America/Vancouver" , 0x01330C },
+ { "America/Virgin" , 0x013719 },
+ { "America/Whitehorse" , 0x013762 },
+ { "America/Winnipeg" , 0x013A59 },
+ { "America/Yakutat" , 0x013E67 },
+ { "America/Yellowknife" , 0x0141A3 },
+ { "Antarctica/Casey" , 0x01447A },
+ { "Antarctica/Davis" , 0x0144C3 },
+ { "Antarctica/DumontDUrville" , 0x014517 },
+ { "Antarctica/Mawson" , 0x014577 },
+ { "Antarctica/McMurdo" , 0x0145C1 },
+ { "Antarctica/Palmer" , 0x01489B },
+ { "Antarctica/Rothera" , 0x014B8E },
+ { "Antarctica/South_Pole" , 0x014BD8 },
+ { "Antarctica/Syowa" , 0x014EB2 },
+ { "Antarctica/Vostok" , 0x014EFC },
+ { "Arctic/Longyearbyen" , 0x014F46 },
+ { "Asia/Aden" , 0x01526C },
+ { "Asia/Almaty" , 0x0152B5 },
+ { "Asia/Amman" , 0x01541A },
+ { "Asia/Anadyr" , 0x0156CE },
+ { "Asia/Aqtau" , 0x01599A },
+ { "Asia/Aqtobe" , 0x015B5C },
+ { "Asia/Ashgabat" , 0x015CF9 },
+ { "Asia/Ashkhabad" , 0x015E0A },
+ { "Asia/Baghdad" , 0x015F1B },
+ { "Asia/Bahrain" , 0x0161B0 },
+ { "Asia/Baku" , 0x01620A },
+ { "Asia/Bangkok" , 0x0164E6 },
+ { "Asia/Beirut" , 0x01652F },
+ { "Asia/Bishkek" , 0x016830 },
+ { "Asia/Brunei" , 0x0169D0 },
+ { "Asia/Calcutta" , 0x016A26 },
+ { "Asia/Choibalsan" , 0x016A93 },
+ { "Asia/Chongqing" , 0x016BE1 },
+ { "Asia/Chungking" , 0x016C84 },
+ { "Asia/Colombo" , 0x016D27 },
+ { "Asia/Dacca" , 0x016DB7 },
+ { "Asia/Damascus" , 0x016E3A },
+ { "Asia/Dhaka" , 0x01717E },
+ { "Asia/Dili" , 0x017201 },
+ { "Asia/Dubai" , 0x01727E },
+ { "Asia/Dushanbe" , 0x0172C7 },
+ { "Asia/Gaza" , 0x0173BE },
+ { "Asia/Harbin" , 0x0176FB },
+ { "Asia/Hong_Kong" , 0x0177B5 },
+ { "Asia/Hovd" , 0x01795F },
+ { "Asia/Irkutsk" , 0x017AA0 },
+ { "Asia/Istanbul" , 0x017D64 },
+ { "Asia/Jakarta" , 0x018145 },
+ { "Asia/Jayapura" , 0x0181D5 },
+ { "Asia/Jerusalem" , 0x018234 },
+ { "Asia/Kabul" , 0x018557 },
+ { "Asia/Kamchatka" , 0x01859C },
+ { "Asia/Karachi" , 0x018860 },
+ { "Asia/Kashgar" , 0x0188F5 },
+ { "Asia/Katmandu" , 0x0189A5 },
+ { "Asia/Krasnoyarsk" , 0x0189FF },
+ { "Asia/Kuala_Lumpur" , 0x018CC3 },
+ { "Asia/Kuching" , 0x018D61 },
+ { "Asia/Kuwait" , 0x018E34 },
+ { "Asia/Macao" , 0x018E7D },
+ { "Asia/Macau" , 0x018FAC },
+ { "Asia/Magadan" , 0x0190DB },
+ { "Asia/Makassar" , 0x01939F },
+ { "Asia/Manila" , 0x01940F },
+ { "Asia/Muscat" , 0x019488 },
+ { "Asia/Nicosia" , 0x0194D1 },
+ { "Asia/Novosibirsk" , 0x0197AD },
+ { "Asia/Omsk" , 0x019A7E },
+ { "Asia/Oral" , 0x019D42 },
+ { "Asia/Phnom_Penh" , 0x019EF7 },
+ { "Asia/Pontianak" , 0x019F63 },
+ { "Asia/Pyongyang" , 0x01A003 },
+ { "Asia/Qatar" , 0x01A064 },
+ { "Asia/Qyzylorda" , 0x01A0BE },
+ { "Asia/Rangoon" , 0x01A268 },
+ { "Asia/Riyadh" , 0x01A2D4 },
+ { "Asia/Saigon" , 0x01A31D },
+ { "Asia/Sakhalin" , 0x01A389 },
+ { "Asia/Samarkand" , 0x01A662 },
+ { "Asia/Seoul" , 0x01A77D },
+ { "Asia/Shanghai" , 0x01A815 },
+ { "Asia/Singapore" , 0x01A8BA },
+ { "Asia/Taipei" , 0x01A965 },
+ { "Asia/Tashkent" , 0x01AA71 },
+ { "Asia/Tbilisi" , 0x01AB87 },
+ { "Asia/Tehran" , 0x01AD35 },
+ { "Asia/Tel_Aviv" , 0x01AF97 },
+ { "Asia/Thimbu" , 0x01B2BA },
+ { "Asia/Thimphu" , 0x01B314 },
+ { "Asia/Tokyo" , 0x01B36E },
+ { "Asia/Ujung_Pandang" , 0x01B3EB },
+ { "Asia/Ulaanbaatar" , 0x01B45B },
+ { "Asia/Ulan_Bator" , 0x01B59C },
+ { "Asia/Urumqi" , 0x01B6DD },
+ { "Asia/Vientiane" , 0x01B780 },
+ { "Asia/Vladivostok" , 0x01B7EC },
+ { "Asia/Yakutsk" , 0x01BAB7 },
+ { "Asia/Yekaterinburg" , 0x01BD7B },
+ { "Asia/Yerevan" , 0x01C06A },
+ { "Atlantic/Azores" , 0x01C362 },
+ { "Atlantic/Bermuda" , 0x01C853 },
+ { "Atlantic/Canary" , 0x01CB28 },
+ { "Atlantic/Cape_Verde" , 0x01CDE4 },
+ { "Atlantic/Faeroe" , 0x01CE51 },
+ { "Atlantic/Faroe" , 0x01D0E9 },
+ { "Atlantic/Jan_Mayen" , 0x01D381 },
+ { "Atlantic/Madeira" , 0x01D6A7 },
+ { "Atlantic/Reykjavik" , 0x01DB95 },
+ { "Atlantic/South_Georgia" , 0x01DD42 },
+ { "Atlantic/St_Helena" , 0x01E042 },
+ { "Atlantic/Stanley" , 0x01DD7A },
+ { "Australia/ACT" , 0x01E08B },
+ { "Australia/Adelaide" , 0x01E39C },
+ { "Australia/Brisbane" , 0x01E6AD },
+ { "Australia/Broken_Hill" , 0x01E74D },
+ { "Australia/Canberra" , 0x01EA63 },
+ { "Australia/Currie" , 0x01ED74 },
+ { "Australia/Darwin" , 0x01F085 },
+ { "Australia/Eucla" , 0x01F0ED },
+ { "Australia/Hobart" , 0x01F198 },
+ { "Australia/LHI" , 0x01F4D1 },
+ { "Australia/Lindeman" , 0x01F760 },
+ { "Australia/Lord_Howe" , 0x01F819 },
+ { "Australia/Melbourne" , 0x01FAA8 },
+ { "Australia/North" , 0x01FDB9 },
+ { "Australia/NSW" , 0x01FE21 },
+ { "Australia/Perth" , 0x020132 },
+ { "Australia/Queensland" , 0x0201DC },
+ { "Australia/South" , 0x02027C },
+ { "Australia/Sydney" , 0x02058D },
+ { "Australia/Tasmania" , 0x02089E },
+ { "Australia/Victoria" , 0x020BD7 },
+ { "Australia/West" , 0x020EE8 },
+ { "Australia/Yancowinna" , 0x020F92 },
+ { "Brazil/Acre" , 0x0212A8 },
+ { "Brazil/DeNoronha" , 0x02138A },
+ { "Brazil/East" , 0x02149E },
+ { "Brazil/West" , 0x02176F },
+ { "Canada/Atlantic" , 0x02185B },
+ { "Canada/Central" , 0x021D37 },
+ { "Canada/East-Saskatchewan" , 0x022629 },
+ { "Canada/Eastern" , 0x022145 },
+ { "Canada/Mountain" , 0x0227A6 },
+ { "Canada/Newfoundland" , 0x022B10 },
+ { "Canada/Pacific" , 0x02302F },
+ { "Canada/Saskatchewan" , 0x02343C },
+ { "Canada/Yukon" , 0x0235B9 },
+ { "CET" , 0x0238B0 },
+ { "Chile/Continental" , 0x023BA3 },
+ { "Chile/EasterIsland" , 0x023F32 },
+ { "CST6CDT" , 0x024268 },
+ { "Cuba" , 0x0245AD },
+ { "EET" , 0x024914 },
+ { "Egypt" , 0x024BBB },
+ { "Eire" , 0x024F76 },
+ { "EST" , 0x02547B },
+ { "EST5EDT" , 0x0254B3 },
+ { "Etc/GMT" , 0x0257F8 },
+ { "Etc/GMT+0" , 0x0258A0 },
+ { "Etc/GMT+1" , 0x025912 },
+ { "Etc/GMT+10" , 0x025987 },
+ { "Etc/GMT+11" , 0x0259FD },
+ { "Etc/GMT+12" , 0x025A73 },
+ { "Etc/GMT+2" , 0x025B5E },
+ { "Etc/GMT+3" , 0x025BD2 },
+ { "Etc/GMT+4" , 0x025C46 },
+ { "Etc/GMT+5" , 0x025CBA },
+ { "Etc/GMT+6" , 0x025D2E },
+ { "Etc/GMT+7" , 0x025DA2 },
+ { "Etc/GMT+8" , 0x025E16 },
+ { "Etc/GMT+9" , 0x025E8A },
+ { "Etc/GMT-0" , 0x025868 },
+ { "Etc/GMT-1" , 0x0258D8 },
+ { "Etc/GMT-10" , 0x02594C },
+ { "Etc/GMT-11" , 0x0259C2 },
+ { "Etc/GMT-12" , 0x025A38 },
+ { "Etc/GMT-13" , 0x025AAE },
+ { "Etc/GMT-14" , 0x025AE9 },
+ { "Etc/GMT-2" , 0x025B24 },
+ { "Etc/GMT-3" , 0x025B98 },
+ { "Etc/GMT-4" , 0x025C0C },
+ { "Etc/GMT-5" , 0x025C80 },
+ { "Etc/GMT-6" , 0x025CF4 },
+ { "Etc/GMT-7" , 0x025D68 },
+ { "Etc/GMT-8" , 0x025DDC },
+ { "Etc/GMT-9" , 0x025E50 },
+ { "Etc/GMT0" , 0x025830 },
+ { "Etc/Greenwich" , 0x025EC4 },
+ { "Etc/UCT" , 0x025EFC },
+ { "Etc/Universal" , 0x025F34 },
+ { "Etc/UTC" , 0x025F6C },
+ { "Etc/Zulu" , 0x025FA4 },
+ { "Europe/Amsterdam" , 0x025FDC },
+ { "Europe/Andorra" , 0x02640E },
+ { "Europe/Athens" , 0x02667E },
+ { "Europe/Belfast" , 0x0269B5 },
+ { "Europe/Belgrade" , 0x026EE0 },
+ { "Europe/Berlin" , 0x027198 },
+ { "Europe/Bratislava" , 0x0274DD },
+ { "Europe/Brussels" , 0x027803 },
+ { "Europe/Bucharest" , 0x027C2E },
+ { "Europe/Budapest" , 0x027F4C },
+ { "Europe/Chisinau" , 0x0282AE },
+ { "Europe/Copenhagen" , 0x028630 },
+ { "Europe/Dublin" , 0x02892E },
+ { "Europe/Gibraltar" , 0x028E33 },
+ { "Europe/Guernsey" , 0x02927E },
+ { "Europe/Helsinki" , 0x0297A9 },
+ { "Europe/Isle_of_Man" , 0x029A53 },
+ { "Europe/Istanbul" , 0x029F7E },
+ { "Europe/Jersey" , 0x02A35F },
+ { "Europe/Kaliningrad" , 0x02A88A },
+ { "Europe/Kiev" , 0x02ABCA },
+ { "Europe/Lisbon" , 0x02AEC7 },
+ { "Europe/Ljubljana" , 0x02B3B7 },
+ { "Europe/London" , 0x02B66F },
+ { "Europe/Luxembourg" , 0x02BB9A },
+ { "Europe/Madrid" , 0x02BFE4 },
+ { "Europe/Malta" , 0x02C396 },
+ { "Europe/Mariehamn" , 0x02C743 },
+ { "Europe/Minsk" , 0x02C9ED },
+ { "Europe/Monaco" , 0x02CCEC },
+ { "Europe/Moscow" , 0x02D11B },
+ { "Europe/Nicosia" , 0x02D44A },
+ { "Europe/Oslo" , 0x02D726 },
+ { "Europe/Paris" , 0x02DA4C },
+ { "Europe/Podgorica" , 0x02DE86 },
+ { "Europe/Prague" , 0x02E13E },
+ { "Europe/Riga" , 0x02E464 },
+ { "Europe/Rome" , 0x02E79D },
+ { "Europe/Samara" , 0x02EB54 },
+ { "Europe/San_Marino" , 0x02EE58 },
+ { "Europe/Sarajevo" , 0x02F20F },
+ { "Europe/Simferopol" , 0x02F4C7 },
+ { "Europe/Skopje" , 0x02F7D8 },
+ { "Europe/Sofia" , 0x02FA90 },
+ { "Europe/Stockholm" , 0x02FD7F },
+ { "Europe/Tallinn" , 0x030022 },
+ { "Europe/Tirane" , 0x030350 },
+ { "Europe/Tiraspol" , 0x03064A },
+ { "Europe/Uzhgorod" , 0x0309CC },
+ { "Europe/Vaduz" , 0x030CCF },
+ { "Europe/Vatican" , 0x030F56 },
+ { "Europe/Vienna" , 0x03130D },
+ { "Europe/Vilnius" , 0x03162E },
+ { "Europe/Volgograd" , 0x031961 },
+ { "Europe/Warsaw" , 0x031C47 },
+ { "Europe/Zagreb" , 0x03201C },
+ { "Europe/Zaporozhye" , 0x0322D4 },
+ { "Europe/Zurich" , 0x0325DB },
+ { "Factory" , 0x032888 },
+ { "GB" , 0x0328ED },
+ { "GB-Eire" , 0x032E18 },
+ { "GMT" , 0x033343 },
+ { "GMT+0" , 0x0333EB },
+ { "GMT-0" , 0x0333B3 },
+ { "GMT0" , 0x03337B },
+ { "Greenwich" , 0x033423 },
+ { "Hongkong" , 0x03345B },
+ { "HST" , 0x033605 },
+ { "Iceland" , 0x03363D },
+ { "Indian/Antananarivo" , 0x0337EA },
+ { "Indian/Chagos" , 0x033852 },
+ { "Indian/Christmas" , 0x0338A8 },
+ { "Indian/Cocos" , 0x0338E0 },
+ { "Indian/Comoro" , 0x033918 },
+ { "Indian/Kerguelen" , 0x033961 },
+ { "Indian/Mahe" , 0x0339AA },
+ { "Indian/Maldives" , 0x0339F3 },
+ { "Indian/Mauritius" , 0x033A3C },
+ { "Indian/Mayotte" , 0x033A85 },
+ { "Indian/Reunion" , 0x033ACE },
+ { "Iran" , 0x033B17 },
+ { "Israel" , 0x033D79 },
+ { "Jamaica" , 0x03409C },
+ { "Japan" , 0x034155 },
+ { "Kwajalein" , 0x0341D2 },
+ { "Libya" , 0x034229 },
+ { "MET" , 0x034317 },
+ { "Mexico/BajaNorte" , 0x03460A },
+ { "Mexico/BajaSur" , 0x034967 },
+ { "Mexico/General" , 0x034BA0 },
+ { "MST" , 0x034DF2 },
+ { "MST7MDT" , 0x034E2A },
+ { "Navajo" , 0x03516F },
+ { "NZ" , 0x0354DC },
+ { "NZ-CHAT" , 0x03584E },
+ { "Pacific/Apia" , 0x035B2A },
+ { "Pacific/Auckland" , 0x035B85 },
+ { "Pacific/Chatham" , 0x035EF7 },
+ { "Pacific/Easter" , 0x0361D3 },
+ { "Pacific/Efate" , 0x036509 },
+ { "Pacific/Enderbury" , 0x0365C3 },
+ { "Pacific/Fakaofo" , 0x036616 },
+ { "Pacific/Fiji" , 0x03664E },
+ { "Pacific/Funafuti" , 0x0366B8 },
+ { "Pacific/Galapagos" , 0x0366F0 },
+ { "Pacific/Gambier" , 0x03674B },
+ { "Pacific/Guadalcanal" , 0x036795 },
+ { "Pacific/Guam" , 0x0367DE },
+ { "Pacific/Honolulu" , 0x036828 },
+ { "Pacific/Johnston" , 0x0368AA },
+ { "Pacific/Kiritimati" , 0x0368E2 },
+ { "Pacific/Kosrae" , 0x036935 },
+ { "Pacific/Kwajalein" , 0x036980 },
+ { "Pacific/Majuro" , 0x0369D7 },
+ { "Pacific/Marquesas" , 0x036A1C },
+ { "Pacific/Midway" , 0x036A66 },
+ { "Pacific/Nauru" , 0x036AD6 },
+ { "Pacific/Niue" , 0x036B42 },
+ { "Pacific/Norfolk" , 0x036B94 },
+ { "Pacific/Noumea" , 0x036BDD },
+ { "Pacific/Pago_Pago" , 0x036C61 },
+ { "Pacific/Palau" , 0x036CDE },
+ { "Pacific/Pitcairn" , 0x036D16 },
+ { "Pacific/Ponape" , 0x036D5F },
+ { "Pacific/Port_Moresby" , 0x036D98 },
+ { "Pacific/Rarotonga" , 0x036DD0 },
+ { "Pacific/Saipan" , 0x036EA0 },
+ { "Pacific/Samoa" , 0x036EF7 },
+ { "Pacific/Tahiti" , 0x036F74 },
+ { "Pacific/Tarawa" , 0x036FBE },
+ { "Pacific/Tongatapu" , 0x036FF7 },
+ { "Pacific/Truk" , 0x037077 },
+ { "Pacific/Wake" , 0x0370B0 },
+ { "Pacific/Wallis" , 0x0370E9 },
+ { "Pacific/Yap" , 0x037121 },
+ { "Poland" , 0x03715A },
+ { "Portugal" , 0x03752F },
+ { "PRC" , 0x037A1F },
+ { "PST8PDT" , 0x037AC4 },
+ { "ROC" , 0x037E09 },
+ { "ROK" , 0x037F15 },
+ { "Singapore" , 0x037FAD },
+ { "Turkey" , 0x038058 },
+ { "UCT" , 0x038439 },
+ { "Universal" , 0x038471 },
+ { "US/Alaska" , 0x0384A9 },
+ { "US/Aleutian" , 0x038806 },
+ { "US/Arizona" , 0x038B60 },
+ { "US/Central" , 0x038BE2 },
+ { "US/East-Indiana" , 0x0395D4 },
+ { "US/Eastern" , 0x0390E1 },
+ { "US/Hawaii" , 0x039832 },
+ { "US/Indiana-Starke" , 0x0398B4 },
+ { "US/Michigan" , 0x039C19 },
+ { "US/Mountain" , 0x039F44 },
+ { "US/Pacific" , 0x03A2B1 },
+ { "US/Pacific-New" , 0x03A6AA },
+ { "US/Samoa" , 0x03AAA3 },
+ { "UTC" , 0x03AB20 },
+ { "W-SU" , 0x03ADFF },
+ { "WET" , 0x03AB58 },
+ { "Zulu" , 0x03B12E },
};
/* This is a generated file, do not modify */
-const unsigned char timelib_timezone_db_data_builtin[240789] = {
+const unsigned char timelib_timezone_db_data_builtin[242022] = {
/* Africa/Abidjan */
@@ -699,22 +700,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3B, 0xB3, 0x93, 0x50, 0x3C, 0xC8, 0x7C, 0x60, 0x3D, 0x93, 0x75, 0x50, 0x3E, 0xA8, 0x5E, 0x60,
0x3F, 0x73, 0x57, 0x50, 0x40, 0x91, 0x7A, 0xE0, 0x41, 0x5C, 0x73, 0xD0, 0x42, 0x71, 0x5C, 0xE0,
0x43, 0x3C, 0x55, 0xD0, 0x44, 0x51, 0x3E, 0xE0, 0x45, 0x12, 0xFD, 0x50, 0x46, 0x31, 0x20, 0xE0,
-0x46, 0xFC, 0x19, 0xD0, 0x48, 0x11, 0x02, 0xE0, 0x48, 0xDB, 0xFB, 0xD0, 0x49, 0xF0, 0xE4, 0xE0,
-0x4A, 0xBB, 0xDD, 0xD0, 0x4B, 0xDA, 0x01, 0x60, 0x4C, 0xA4, 0xFA, 0x50, 0x4D, 0xB9, 0xE3, 0x60,
-0x4E, 0x84, 0xDC, 0x50, 0x4F, 0x99, 0xC5, 0x60, 0x50, 0x64, 0xBE, 0x50, 0x51, 0x79, 0xA7, 0x60,
-0x52, 0x44, 0xA0, 0x50, 0x53, 0x59, 0x89, 0x60, 0x54, 0x24, 0x82, 0x50, 0x55, 0x39, 0x6B, 0x60,
-0x56, 0x04, 0x64, 0x50, 0x57, 0x22, 0x87, 0xE0, 0x57, 0xED, 0x80, 0xD0, 0x59, 0x02, 0x69, 0xE0,
-0x59, 0xCD, 0x62, 0xD0, 0x5A, 0xE2, 0x4B, 0xE0, 0x5B, 0xAD, 0x44, 0xD0, 0x5C, 0xC2, 0x2D, 0xE0,
-0x5D, 0x8D, 0x26, 0xD0, 0x5E, 0xA2, 0x0F, 0xE0, 0x5F, 0x6D, 0x08, 0xD0, 0x60, 0x8B, 0x2C, 0x60,
-0x61, 0x56, 0x25, 0x50, 0x62, 0x6B, 0x0E, 0x60, 0x63, 0x36, 0x07, 0x50, 0x64, 0x4A, 0xF0, 0x60,
-0x65, 0x15, 0xE9, 0x50, 0x66, 0x2A, 0xD2, 0x60, 0x66, 0xF5, 0xCB, 0x50, 0x68, 0x0A, 0xB4, 0x60,
-0x68, 0xD5, 0xAD, 0x50, 0x69, 0xEA, 0x96, 0x60, 0x6A, 0xB5, 0x8F, 0x50, 0x6B, 0xD3, 0xB2, 0xE0,
-0x6C, 0x9E, 0xAB, 0xD0, 0x6D, 0xB3, 0x94, 0xE0, 0x6E, 0x7E, 0x8D, 0xD0, 0x6F, 0x93, 0x76, 0xE0,
-0x70, 0x5E, 0x6F, 0xD0, 0x71, 0x73, 0x58, 0xE0, 0x72, 0x3E, 0x51, 0xD0, 0x73, 0x53, 0x3A, 0xE0,
-0x74, 0x1E, 0x33, 0xD0, 0x75, 0x3C, 0x57, 0x60, 0x76, 0x07, 0x50, 0x50, 0x77, 0x1C, 0x39, 0x60,
-0x77, 0xE7, 0x32, 0x50, 0x78, 0xFC, 0x1B, 0x60, 0x79, 0xC7, 0x14, 0x50, 0x7A, 0xDB, 0xFD, 0x60,
-0x7B, 0xA6, 0xF6, 0x50, 0x7C, 0xBB, 0xDF, 0x60, 0x7D, 0x86, 0xD8, 0x50, 0x7E, 0x9B, 0xC1, 0x60,
-0x7F, 0x66, 0xBA, 0x50, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0x46, 0xE0, 0x6A, 0x50, 0x48, 0x11, 0x02, 0xE0, 0x48, 0xB7, 0x11, 0xD0, 0x49, 0xF0, 0xE4, 0xE0,
+0x4A, 0x96, 0xF3, 0xD0, 0x4B, 0xDA, 0x01, 0x60, 0x4C, 0x76, 0xD5, 0xD0, 0x4D, 0xB9, 0xE3, 0x60,
+0x4E, 0x56, 0xB7, 0xD0, 0x4F, 0x99, 0xC5, 0x60, 0x50, 0x3F, 0xD4, 0x50, 0x51, 0x79, 0xA7, 0x60,
+0x52, 0x1F, 0xB6, 0x50, 0x53, 0x59, 0x89, 0x60, 0x53, 0xFF, 0x98, 0x50, 0x55, 0x39, 0x6B, 0x60,
+0x55, 0xDF, 0x7A, 0x50, 0x57, 0x22, 0x87, 0xE0, 0x57, 0xBF, 0x5C, 0x50, 0x59, 0x02, 0x69, 0xE0,
+0x59, 0xA8, 0x78, 0xD0, 0x5A, 0xE2, 0x4B, 0xE0, 0x5B, 0x88, 0x5A, 0xD0, 0x5C, 0xC2, 0x2D, 0xE0,
+0x5D, 0x68, 0x3C, 0xD0, 0x5E, 0xA2, 0x0F, 0xE0, 0x5F, 0x48, 0x1E, 0xD0, 0x60, 0x8B, 0x2C, 0x60,
+0x61, 0x28, 0x00, 0xD0, 0x62, 0x6B, 0x0E, 0x60, 0x63, 0x07, 0xE2, 0xD0, 0x64, 0x4A, 0xF0, 0x60,
+0x64, 0xF0, 0xFF, 0x50, 0x66, 0x2A, 0xD2, 0x60, 0x66, 0xD0, 0xE1, 0x50, 0x68, 0x0A, 0xB4, 0x60,
+0x68, 0xB0, 0xC3, 0x50, 0x69, 0xEA, 0x96, 0x60, 0x6A, 0x90, 0xA5, 0x50, 0x6B, 0xD3, 0xB2, 0xE0,
+0x6C, 0x70, 0x87, 0x50, 0x6D, 0xB3, 0x94, 0xE0, 0x6E, 0x59, 0xA3, 0xD0, 0x6F, 0x93, 0x76, 0xE0,
+0x70, 0x39, 0x85, 0xD0, 0x71, 0x73, 0x58, 0xE0, 0x72, 0x19, 0x67, 0xD0, 0x73, 0x53, 0x3A, 0xE0,
+0x73, 0xF9, 0x49, 0xD0, 0x75, 0x3C, 0x57, 0x60, 0x75, 0xD9, 0x2B, 0xD0, 0x77, 0x1C, 0x39, 0x60,
+0x77, 0xB9, 0x0D, 0xD0, 0x78, 0xFC, 0x1B, 0x60, 0x79, 0xA2, 0x2A, 0x50, 0x7A, 0xDB, 0xFD, 0x60,
+0x7B, 0x82, 0x0C, 0x50, 0x7C, 0xBB, 0xDF, 0x60, 0x7D, 0x61, 0xEE, 0x50, 0x7E, 0x9B, 0xC1, 0x60,
+0x7F, 0x41, 0xD0, 0x50, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
@@ -2015,22 +2016,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xDF, 0xF1, 0x40, 0x3A, 0x8F, 0x3A, 0xB0, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x6F, 0x1C, 0xB0,
0x3D, 0xC4, 0x9F, 0x40, 0x3E, 0x4E, 0xFE, 0xB0, 0x3F, 0x92, 0x0C, 0x40, 0x40, 0x2E, 0xE0, 0xB0,
0x41, 0x87, 0x06, 0x40, 0x42, 0x17, 0xFD, 0x30, 0x43, 0x51, 0xD0, 0x40, 0x43, 0xF7, 0xDF, 0x30,
-0x45, 0x4D, 0x61, 0xC0, 0x45, 0xE0, 0xFB, 0xB0, 0x47, 0x2D, 0x43, 0xC0, 0x47, 0xC0, 0xDD, 0xB0,
-0x49, 0x0D, 0x25, 0xC0, 0x49, 0xA0, 0xBF, 0xB0, 0x4A, 0xED, 0x07, 0xC0, 0x4B, 0x89, 0xDC, 0x30,
-0x4C, 0xD6, 0x24, 0x40, 0x4D, 0x69, 0xBE, 0x30, 0x4E, 0xB6, 0x06, 0x40, 0x4F, 0x49, 0xA0, 0x30,
-0x50, 0x95, 0xE8, 0x40, 0x51, 0x29, 0x82, 0x30, 0x52, 0x75, 0xCA, 0x40, 0x53, 0x09, 0x64, 0x30,
-0x54, 0x55, 0xAC, 0x40, 0x54, 0xE9, 0x46, 0x30, 0x56, 0x35, 0x8E, 0x40, 0x56, 0xD2, 0x62, 0xB0,
-0x58, 0x1E, 0xAA, 0xC0, 0x58, 0xB2, 0x44, 0xB0, 0x59, 0xFE, 0x8C, 0xC0, 0x5A, 0x92, 0x26, 0xB0,
-0x5B, 0xDE, 0x6E, 0xC0, 0x5C, 0x72, 0x08, 0xB0, 0x5D, 0xBE, 0x50, 0xC0, 0x5E, 0x51, 0xEA, 0xB0,
-0x5F, 0x9E, 0x32, 0xC0, 0x60, 0x3B, 0x07, 0x30, 0x61, 0x87, 0x4F, 0x40, 0x62, 0x1A, 0xE9, 0x30,
-0x63, 0x67, 0x31, 0x40, 0x63, 0xFA, 0xCB, 0x30, 0x65, 0x47, 0x13, 0x40, 0x65, 0xDA, 0xAD, 0x30,
-0x67, 0x26, 0xF5, 0x40, 0x67, 0xBA, 0x8F, 0x30, 0x69, 0x06, 0xD7, 0x40, 0x69, 0x9A, 0x71, 0x30,
-0x6A, 0xE6, 0xB9, 0x40, 0x6B, 0x83, 0x8D, 0xB0, 0x6C, 0xCF, 0xD5, 0xC0, 0x6D, 0x63, 0x6F, 0xB0,
-0x6E, 0xAF, 0xB7, 0xC0, 0x6F, 0x43, 0x51, 0xB0, 0x70, 0x8F, 0x99, 0xC0, 0x71, 0x23, 0x33, 0xB0,
-0x72, 0x6F, 0x7B, 0xC0, 0x73, 0x03, 0x15, 0xB0, 0x74, 0x4F, 0x5D, 0xC0, 0x74, 0xEC, 0x32, 0x30,
-0x76, 0x38, 0x7A, 0x40, 0x76, 0xCC, 0x14, 0x30, 0x78, 0x18, 0x5C, 0x40, 0x78, 0xAB, 0xF6, 0x30,
-0x79, 0xF8, 0x3E, 0x40, 0x7A, 0x8B, 0xD8, 0x30, 0x7B, 0xD8, 0x20, 0x40, 0x7C, 0x6B, 0xBA, 0x30,
-0x7D, 0xB8, 0x02, 0x40, 0x7E, 0x4B, 0x9C, 0x30, 0x7F, 0x97, 0xE4, 0x40, 0x02, 0x01, 0x02, 0x01,
+0x45, 0x4D, 0x61, 0xC0, 0x45, 0xE0, 0xFB, 0xB0, 0x47, 0x11, 0x94, 0x40, 0x47, 0xB7, 0xA3, 0x30,
+0x48, 0xF1, 0x76, 0x40, 0x49, 0x97, 0x85, 0x30, 0x4A, 0xD1, 0x58, 0x40, 0x4B, 0x80, 0xA1, 0xB0,
+0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0x60, 0x83, 0xB0, 0x4E, 0x91, 0x1C, 0x40, 0x4F, 0x40, 0x65, 0xB0,
+0x50, 0x7A, 0x38, 0xC0, 0x51, 0x20, 0x47, 0xB0, 0x52, 0x5A, 0x1A, 0xC0, 0x53, 0x00, 0x29, 0xB0,
+0x54, 0x39, 0xFC, 0xC0, 0x54, 0xE0, 0x0B, 0xB0, 0x56, 0x19, 0xDE, 0xC0, 0x56, 0xC9, 0x28, 0x30,
+0x57, 0xF9, 0xC0, 0xC0, 0x58, 0xA9, 0x0A, 0x30, 0x59, 0xD9, 0xA2, 0xC0, 0x5A, 0x88, 0xEC, 0x30,
+0x5B, 0xC2, 0xBF, 0x40, 0x5C, 0x68, 0xCE, 0x30, 0x5D, 0xA2, 0xA1, 0x40, 0x5E, 0x48, 0xB0, 0x30,
+0x5F, 0x82, 0x83, 0x40, 0x60, 0x31, 0xCC, 0xB0, 0x61, 0x62, 0x65, 0x40, 0x62, 0x11, 0xAE, 0xB0,
+0x63, 0x42, 0x47, 0x40, 0x63, 0xF1, 0x90, 0xB0, 0x65, 0x22, 0x29, 0x40, 0x65, 0xD1, 0x72, 0xB0,
+0x67, 0x0B, 0x45, 0xC0, 0x67, 0xB1, 0x54, 0xB0, 0x68, 0xEB, 0x27, 0xC0, 0x69, 0x91, 0x36, 0xB0,
+0x6A, 0xCB, 0x09, 0xC0, 0x6B, 0x7A, 0x53, 0x30, 0x6C, 0xAA, 0xEB, 0xC0, 0x6D, 0x5A, 0x35, 0x30,
+0x6E, 0x8A, 0xCD, 0xC0, 0x6F, 0x3A, 0x17, 0x30, 0x70, 0x73, 0xEA, 0x40, 0x71, 0x19, 0xF9, 0x30,
+0x72, 0x53, 0xCC, 0x40, 0x72, 0xF9, 0xDB, 0x30, 0x74, 0x33, 0xAE, 0x40, 0x74, 0xD9, 0xBD, 0x30,
+0x76, 0x13, 0x90, 0x40, 0x76, 0xC2, 0xD9, 0xB0, 0x77, 0xF3, 0x72, 0x40, 0x78, 0xA2, 0xBB, 0xB0,
+0x79, 0xD3, 0x54, 0x40, 0x7A, 0x82, 0x9D, 0xB0, 0x7B, 0xBC, 0x70, 0xC0, 0x7C, 0x62, 0x7F, 0xB0,
+0x7D, 0x9C, 0x52, 0xC0, 0x7E, 0x42, 0x61, 0xB0, 0x7F, 0x7C, 0x34, 0xC0, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -2082,10 +2083,10 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
/* America/Caracas */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x93, 0x1E, 0x2C, 0x3C,
-0xF6, 0x98, 0xEC, 0x48, 0x01, 0x02, 0xFF, 0xFF, 0xC1, 0x44, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xB8,
-0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x43, 0x4D, 0x54, 0x00, 0x56, 0x45, 0x54, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x93, 0x1E, 0x2C, 0x3C,
+0xF6, 0x98, 0xEC, 0x48, 0x47, 0x79, 0xBA, 0xC0, 0x01, 0x02, 0x01, 0xFF, 0xFF, 0xC1, 0x44, 0x00,
+0x00, 0xFF, 0xFF, 0xC0, 0xB8, 0x00, 0x04, 0xFF, 0xFF, 0xC7, 0xC0, 0x00, 0x04, 0x43, 0x4D, 0x54,
+0x00, 0x56, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* America/Catamarca */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -2317,22 +2318,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xDF, 0xF1, 0x40, 0x3A, 0x8F, 0x3A, 0xB0, 0x3B, 0xC9, 0x0D, 0xC0, 0x3C, 0x6F, 0x1C, 0xB0,
0x3D, 0xC4, 0x9F, 0x40, 0x3E, 0x4E, 0xFE, 0xB0, 0x41, 0x87, 0x06, 0x40, 0x42, 0x17, 0xFD, 0x30,
0x43, 0x51, 0xD0, 0x40, 0x43, 0xF7, 0xDF, 0x30, 0x45, 0x4D, 0x61, 0xC0, 0x45, 0xE0, 0xFB, 0xB0,
-0x47, 0x2D, 0x43, 0xC0, 0x47, 0xC0, 0xDD, 0xB0, 0x49, 0x0D, 0x25, 0xC0, 0x49, 0xA0, 0xBF, 0xB0,
-0x4A, 0xED, 0x07, 0xC0, 0x4B, 0x89, 0xDC, 0x30, 0x4C, 0xD6, 0x24, 0x40, 0x4D, 0x69, 0xBE, 0x30,
-0x4E, 0xB6, 0x06, 0x40, 0x4F, 0x49, 0xA0, 0x30, 0x50, 0x95, 0xE8, 0x40, 0x51, 0x29, 0x82, 0x30,
-0x52, 0x75, 0xCA, 0x40, 0x53, 0x09, 0x64, 0x30, 0x54, 0x55, 0xAC, 0x40, 0x54, 0xE9, 0x46, 0x30,
-0x56, 0x35, 0x8E, 0x40, 0x56, 0xD2, 0x62, 0xB0, 0x58, 0x1E, 0xAA, 0xC0, 0x58, 0xB2, 0x44, 0xB0,
-0x59, 0xFE, 0x8C, 0xC0, 0x5A, 0x92, 0x26, 0xB0, 0x5B, 0xDE, 0x6E, 0xC0, 0x5C, 0x72, 0x08, 0xB0,
-0x5D, 0xBE, 0x50, 0xC0, 0x5E, 0x51, 0xEA, 0xB0, 0x5F, 0x9E, 0x32, 0xC0, 0x60, 0x3B, 0x07, 0x30,
-0x61, 0x87, 0x4F, 0x40, 0x62, 0x1A, 0xE9, 0x30, 0x63, 0x67, 0x31, 0x40, 0x63, 0xFA, 0xCB, 0x30,
-0x65, 0x47, 0x13, 0x40, 0x65, 0xDA, 0xAD, 0x30, 0x67, 0x26, 0xF5, 0x40, 0x67, 0xBA, 0x8F, 0x30,
-0x69, 0x06, 0xD7, 0x40, 0x69, 0x9A, 0x71, 0x30, 0x6A, 0xE6, 0xB9, 0x40, 0x6B, 0x83, 0x8D, 0xB0,
-0x6C, 0xCF, 0xD5, 0xC0, 0x6D, 0x63, 0x6F, 0xB0, 0x6E, 0xAF, 0xB7, 0xC0, 0x6F, 0x43, 0x51, 0xB0,
-0x70, 0x8F, 0x99, 0xC0, 0x71, 0x23, 0x33, 0xB0, 0x72, 0x6F, 0x7B, 0xC0, 0x73, 0x03, 0x15, 0xB0,
-0x74, 0x4F, 0x5D, 0xC0, 0x74, 0xEC, 0x32, 0x30, 0x76, 0x38, 0x7A, 0x40, 0x76, 0xCC, 0x14, 0x30,
-0x78, 0x18, 0x5C, 0x40, 0x78, 0xAB, 0xF6, 0x30, 0x79, 0xF8, 0x3E, 0x40, 0x7A, 0x8B, 0xD8, 0x30,
-0x7B, 0xD8, 0x20, 0x40, 0x7C, 0x6B, 0xBA, 0x30, 0x7D, 0xB8, 0x02, 0x40, 0x7E, 0x4B, 0x9C, 0x30,
-0x7F, 0x97, 0xE4, 0x40, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+0x47, 0x11, 0x94, 0x40, 0x47, 0xB7, 0xA3, 0x30, 0x48, 0xF1, 0x76, 0x40, 0x49, 0x97, 0x85, 0x30,
+0x4A, 0xD1, 0x58, 0x40, 0x4B, 0x80, 0xA1, 0xB0, 0x4C, 0xB1, 0x3A, 0x40, 0x4D, 0x60, 0x83, 0xB0,
+0x4E, 0x91, 0x1C, 0x40, 0x4F, 0x40, 0x65, 0xB0, 0x50, 0x7A, 0x38, 0xC0, 0x51, 0x20, 0x47, 0xB0,
+0x52, 0x5A, 0x1A, 0xC0, 0x53, 0x00, 0x29, 0xB0, 0x54, 0x39, 0xFC, 0xC0, 0x54, 0xE0, 0x0B, 0xB0,
+0x56, 0x19, 0xDE, 0xC0, 0x56, 0xC9, 0x28, 0x30, 0x57, 0xF9, 0xC0, 0xC0, 0x58, 0xA9, 0x0A, 0x30,
+0x59, 0xD9, 0xA2, 0xC0, 0x5A, 0x88, 0xEC, 0x30, 0x5B, 0xC2, 0xBF, 0x40, 0x5C, 0x68, 0xCE, 0x30,
+0x5D, 0xA2, 0xA1, 0x40, 0x5E, 0x48, 0xB0, 0x30, 0x5F, 0x82, 0x83, 0x40, 0x60, 0x31, 0xCC, 0xB0,
+0x61, 0x62, 0x65, 0x40, 0x62, 0x11, 0xAE, 0xB0, 0x63, 0x42, 0x47, 0x40, 0x63, 0xF1, 0x90, 0xB0,
+0x65, 0x22, 0x29, 0x40, 0x65, 0xD1, 0x72, 0xB0, 0x67, 0x0B, 0x45, 0xC0, 0x67, 0xB1, 0x54, 0xB0,
+0x68, 0xEB, 0x27, 0xC0, 0x69, 0x91, 0x36, 0xB0, 0x6A, 0xCB, 0x09, 0xC0, 0x6B, 0x7A, 0x53, 0x30,
+0x6C, 0xAA, 0xEB, 0xC0, 0x6D, 0x5A, 0x35, 0x30, 0x6E, 0x8A, 0xCD, 0xC0, 0x6F, 0x3A, 0x17, 0x30,
+0x70, 0x73, 0xEA, 0x40, 0x71, 0x19, 0xF9, 0x30, 0x72, 0x53, 0xCC, 0x40, 0x72, 0xF9, 0xDB, 0x30,
+0x74, 0x33, 0xAE, 0x40, 0x74, 0xD9, 0xBD, 0x30, 0x76, 0x13, 0x90, 0x40, 0x76, 0xC2, 0xD9, 0xB0,
+0x77, 0xF3, 0x72, 0x40, 0x78, 0xA2, 0xBB, 0xB0, 0x79, 0xD3, 0x54, 0x40, 0x7A, 0x82, 0x9D, 0xB0,
+0x7B, 0xBC, 0x70, 0xC0, 0x7C, 0x62, 0x7F, 0xB0, 0x7D, 0x9C, 0x52, 0xC0, 0x7E, 0x42, 0x61, 0xB0,
+0x7F, 0x7C, 0x34, 0xC0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -3131,22 +3132,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x36, 0xFD, 0xB7, 0x50, 0x38, 0x1B, 0xCC, 0xD0, 0x38, 0xE6, 0xD3, 0xD0, 0x39, 0xFB, 0xAE, 0xD0,
0x3A, 0xC6, 0xB5, 0xD0, 0x3B, 0xDB, 0x90, 0xD0, 0x3C, 0xAF, 0xD2, 0x50, 0x3D, 0xBB, 0x72, 0xD0,
0x3E, 0x8F, 0xB4, 0x50, 0x3F, 0x9B, 0x54, 0xD0, 0x40, 0x6F, 0x96, 0x50, 0x45, 0x44, 0x35, 0x50,
-0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x2D, 0x51, 0xD0, 0x47, 0xD3, 0x6E, 0xD0, 0x49, 0x0D, 0x33, 0xD0,
-0x49, 0xB3, 0x50, 0xD0, 0x4A, 0xED, 0x15, 0xD0, 0x4B, 0x9C, 0x6D, 0x50, 0x4C, 0xD6, 0x32, 0x50,
-0x4D, 0x7C, 0x4F, 0x50, 0x4E, 0xB6, 0x14, 0x50, 0x4F, 0x5C, 0x31, 0x50, 0x50, 0x95, 0xF6, 0x50,
-0x51, 0x3C, 0x13, 0x50, 0x52, 0x75, 0xD8, 0x50, 0x53, 0x1B, 0xF5, 0x50, 0x54, 0x55, 0xBA, 0x50,
-0x54, 0xFB, 0xD7, 0x50, 0x56, 0x35, 0x9C, 0x50, 0x56, 0xE4, 0xF3, 0xD0, 0x58, 0x1E, 0xB8, 0xD0,
-0x58, 0xC4, 0xD5, 0xD0, 0x59, 0xFE, 0x9A, 0xD0, 0x5A, 0xA4, 0xB7, 0xD0, 0x5B, 0xDE, 0x7C, 0xD0,
-0x5C, 0x84, 0x99, 0xD0, 0x5D, 0xBE, 0x5E, 0xD0, 0x5E, 0x64, 0x7B, 0xD0, 0x5F, 0x9E, 0x40, 0xD0,
-0x60, 0x4D, 0x98, 0x50, 0x61, 0x87, 0x5D, 0x50, 0x62, 0x2D, 0x7A, 0x50, 0x63, 0x67, 0x3F, 0x50,
-0x64, 0x0D, 0x5C, 0x50, 0x65, 0x47, 0x21, 0x50, 0x65, 0xED, 0x3E, 0x50, 0x67, 0x27, 0x03, 0x50,
-0x67, 0xCD, 0x20, 0x50, 0x69, 0x06, 0xE5, 0x50, 0x69, 0xAD, 0x02, 0x50, 0x6A, 0xE6, 0xC7, 0x50,
-0x6B, 0x96, 0x1E, 0xD0, 0x6C, 0xCF, 0xE3, 0xD0, 0x6D, 0x76, 0x00, 0xD0, 0x6E, 0xAF, 0xC5, 0xD0,
-0x6F, 0x55, 0xE2, 0xD0, 0x70, 0x8F, 0xA7, 0xD0, 0x71, 0x35, 0xC4, 0xD0, 0x72, 0x6F, 0x89, 0xD0,
-0x73, 0x15, 0xA6, 0xD0, 0x74, 0x4F, 0x6B, 0xD0, 0x74, 0xFE, 0xC3, 0x50, 0x76, 0x38, 0x88, 0x50,
-0x76, 0xDE, 0xA5, 0x50, 0x78, 0x18, 0x6A, 0x50, 0x78, 0xBE, 0x87, 0x50, 0x79, 0xF8, 0x4C, 0x50,
-0x7A, 0x9E, 0x69, 0x50, 0x7B, 0xD8, 0x2E, 0x50, 0x7C, 0x7E, 0x4B, 0x50, 0x7D, 0xB8, 0x10, 0x50,
-0x7E, 0x5E, 0x2D, 0x50, 0x7F, 0x97, 0xF2, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x24, 0x17, 0x50, 0x47, 0xD3, 0x6E, 0xD0, 0x49, 0x03, 0xF9, 0x50,
+0x49, 0xB3, 0x50, 0xD0, 0x4A, 0xE3, 0xDB, 0x50, 0x4B, 0x9C, 0x6D, 0x50, 0x4C, 0xCC, 0xF7, 0xD0,
+0x4D, 0x7C, 0x4F, 0x50, 0x4E, 0xAC, 0xD9, 0xD0, 0x4F, 0x5C, 0x31, 0x50, 0x50, 0x8C, 0xBB, 0xD0,
+0x51, 0x3C, 0x13, 0x50, 0x52, 0x6C, 0x9D, 0xD0, 0x53, 0x1B, 0xF5, 0x50, 0x54, 0x4C, 0x7F, 0xD0,
+0x54, 0xFB, 0xD7, 0x50, 0x56, 0x2C, 0x61, 0xD0, 0x56, 0xE4, 0xF3, 0xD0, 0x58, 0x15, 0x7E, 0x50,
+0x58, 0xC4, 0xD5, 0xD0, 0x59, 0xF5, 0x60, 0x50, 0x5A, 0xA4, 0xB7, 0xD0, 0x5B, 0xD5, 0x42, 0x50,
+0x5C, 0x84, 0x99, 0xD0, 0x5D, 0xB5, 0x24, 0x50, 0x5E, 0x64, 0x7B, 0xD0, 0x5F, 0x95, 0x06, 0x50,
+0x60, 0x4D, 0x98, 0x50, 0x61, 0x7E, 0x22, 0xD0, 0x62, 0x2D, 0x7A, 0x50, 0x63, 0x5E, 0x04, 0xD0,
+0x64, 0x0D, 0x5C, 0x50, 0x65, 0x3D, 0xE6, 0xD0, 0x65, 0xED, 0x3E, 0x50, 0x67, 0x1D, 0xC8, 0xD0,
+0x67, 0xCD, 0x20, 0x50, 0x68, 0xFD, 0xAA, 0xD0, 0x69, 0xAD, 0x02, 0x50, 0x6A, 0xDD, 0x8C, 0xD0,
+0x6B, 0x96, 0x1E, 0xD0, 0x6C, 0xC6, 0xA9, 0x50, 0x6D, 0x76, 0x00, 0xD0, 0x6E, 0xA6, 0x8B, 0x50,
+0x6F, 0x55, 0xE2, 0xD0, 0x70, 0x86, 0x6D, 0x50, 0x71, 0x35, 0xC4, 0xD0, 0x72, 0x66, 0x4F, 0x50,
+0x73, 0x15, 0xA6, 0xD0, 0x74, 0x46, 0x31, 0x50, 0x74, 0xFE, 0xC3, 0x50, 0x76, 0x2F, 0x4D, 0xD0,
+0x76, 0xDE, 0xA5, 0x50, 0x78, 0x0F, 0x2F, 0xD0, 0x78, 0xBE, 0x87, 0x50, 0x79, 0xEF, 0x11, 0xD0,
+0x7A, 0x9E, 0x69, 0x50, 0x7B, 0xCE, 0xF3, 0xD0, 0x7C, 0x7E, 0x4B, 0x50, 0x7D, 0xAE, 0xD5, 0xD0,
+0x7E, 0x5E, 0x2D, 0x50, 0x7F, 0x8E, 0xB7, 0xD0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -3316,8 +3317,8 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
/* America/Indiana/Petersburg */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x9E, 0xA6, 0x2C, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0x9E, 0xA6, 0x2C, 0x80,
0x9F, 0xBA, 0xF9, 0x70, 0xA0, 0x86, 0x0E, 0x80, 0xA1, 0x9A, 0xDB, 0x70, 0xCB, 0x88, 0xFE, 0x80,
0xD2, 0x23, 0xF4, 0x70, 0xD2, 0x61, 0x09, 0xF0, 0xE4, 0x67, 0x3D, 0xE0, 0xE5, 0x29, 0x18, 0x70,
0xE6, 0x47, 0x3C, 0x00, 0xE7, 0x12, 0x34, 0xF0, 0xE8, 0x27, 0x1E, 0x00, 0xE8, 0xF2, 0x16, 0xF0,
@@ -3331,33 +3332,34 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x06, 0x40, 0xED, 0x80, 0x07, 0x30, 0xD0, 0x70, 0x07, 0x8D, 0x27, 0x80, 0x09, 0x10, 0xB2, 0x70,
0x09, 0xAD, 0xA3, 0x00, 0x0A, 0xF0, 0x94, 0x70, 0x0B, 0xE0, 0x93, 0x80, 0x0C, 0xD9, 0xB0, 0xF0,
0x0D, 0xC0, 0x75, 0x80, 0x0E, 0xB9, 0x92, 0xF0, 0x44, 0x2F, 0x76, 0x70, 0x45, 0x44, 0x51, 0x70,
-0x45, 0xF3, 0xB7, 0x00, 0x47, 0x2D, 0x6D, 0xF0, 0x47, 0xD3, 0x99, 0x00, 0x49, 0x0D, 0x4F, 0xF0,
-0x49, 0xB3, 0x7B, 0x00, 0x4A, 0xED, 0x31, 0xF0, 0x4B, 0x9C, 0x97, 0x80, 0x4C, 0xD6, 0x4E, 0x70,
-0x4D, 0x7C, 0x79, 0x80, 0x4E, 0xB6, 0x30, 0x70, 0x4F, 0x5C, 0x5B, 0x80, 0x50, 0x96, 0x12, 0x70,
-0x51, 0x3C, 0x3D, 0x80, 0x52, 0x75, 0xF4, 0x70, 0x53, 0x1C, 0x1F, 0x80, 0x54, 0x55, 0xD6, 0x70,
-0x54, 0xFC, 0x01, 0x80, 0x56, 0x35, 0xB8, 0x70, 0x56, 0xE5, 0x1E, 0x00, 0x58, 0x1E, 0xD4, 0xF0,
-0x58, 0xC5, 0x00, 0x00, 0x59, 0xFE, 0xB6, 0xF0, 0x5A, 0xA4, 0xE2, 0x00, 0x5B, 0xDE, 0x98, 0xF0,
-0x5C, 0x84, 0xC4, 0x00, 0x5D, 0xBE, 0x7A, 0xF0, 0x5E, 0x64, 0xA6, 0x00, 0x5F, 0x9E, 0x5C, 0xF0,
-0x60, 0x4D, 0xC2, 0x80, 0x61, 0x87, 0x79, 0x70, 0x62, 0x2D, 0xA4, 0x80, 0x63, 0x67, 0x5B, 0x70,
-0x64, 0x0D, 0x86, 0x80, 0x65, 0x47, 0x3D, 0x70, 0x65, 0xED, 0x68, 0x80, 0x67, 0x27, 0x1F, 0x70,
-0x67, 0xCD, 0x4A, 0x80, 0x69, 0x07, 0x01, 0x70, 0x69, 0xAD, 0x2C, 0x80, 0x6A, 0xE6, 0xE3, 0x70,
-0x6B, 0x96, 0x49, 0x00, 0x6C, 0xCF, 0xFF, 0xF0, 0x6D, 0x76, 0x2B, 0x00, 0x6E, 0xAF, 0xE1, 0xF0,
-0x6F, 0x56, 0x0D, 0x00, 0x70, 0x8F, 0xC3, 0xF0, 0x71, 0x35, 0xEF, 0x00, 0x72, 0x6F, 0xA5, 0xF0,
-0x73, 0x15, 0xD1, 0x00, 0x74, 0x4F, 0x87, 0xF0, 0x74, 0xFE, 0xED, 0x80, 0x76, 0x38, 0xA4, 0x70,
-0x76, 0xDE, 0xCF, 0x80, 0x78, 0x18, 0x86, 0x70, 0x78, 0xBE, 0xB1, 0x80, 0x79, 0xF8, 0x68, 0x70,
-0x7A, 0x9E, 0x93, 0x80, 0x7B, 0xD8, 0x4A, 0x70, 0x7C, 0x7E, 0x75, 0x80, 0x7D, 0xB8, 0x2C, 0x70,
-0x7E, 0x5E, 0x57, 0x80, 0x7F, 0x98, 0x0E, 0x70, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x01, 0x00,
+0x45, 0xF3, 0xB7, 0x00, 0x47, 0x2D, 0x6D, 0xF0, 0x47, 0xD3, 0x8A, 0xF0, 0x49, 0x0D, 0x41, 0xE0,
+0x49, 0xB3, 0x6C, 0xF0, 0x4A, 0xED, 0x23, 0xE0, 0x4B, 0x9C, 0x89, 0x70, 0x4C, 0xD6, 0x40, 0x60,
+0x4D, 0x7C, 0x6B, 0x70, 0x4E, 0xB6, 0x22, 0x60, 0x4F, 0x5C, 0x4D, 0x70, 0x50, 0x96, 0x04, 0x60,
+0x51, 0x3C, 0x2F, 0x70, 0x52, 0x75, 0xE6, 0x60, 0x53, 0x1C, 0x11, 0x70, 0x54, 0x55, 0xC8, 0x60,
+0x54, 0xFB, 0xF3, 0x70, 0x56, 0x35, 0xAA, 0x60, 0x56, 0xE5, 0x0F, 0xF0, 0x58, 0x1E, 0xC6, 0xE0,
+0x58, 0xC4, 0xF1, 0xF0, 0x59, 0xFE, 0xA8, 0xE0, 0x5A, 0xA4, 0xD3, 0xF0, 0x5B, 0xDE, 0x8A, 0xE0,
+0x5C, 0x84, 0xB5, 0xF0, 0x5D, 0xBE, 0x6C, 0xE0, 0x5E, 0x64, 0x97, 0xF0, 0x5F, 0x9E, 0x4E, 0xE0,
+0x60, 0x4D, 0xB4, 0x70, 0x61, 0x87, 0x6B, 0x60, 0x62, 0x2D, 0x96, 0x70, 0x63, 0x67, 0x4D, 0x60,
+0x64, 0x0D, 0x78, 0x70, 0x65, 0x47, 0x2F, 0x60, 0x65, 0xED, 0x5A, 0x70, 0x67, 0x27, 0x11, 0x60,
+0x67, 0xCD, 0x3C, 0x70, 0x69, 0x06, 0xF3, 0x60, 0x69, 0xAD, 0x1E, 0x70, 0x6A, 0xE6, 0xD5, 0x60,
+0x6B, 0x96, 0x3A, 0xF0, 0x6C, 0xCF, 0xF1, 0xE0, 0x6D, 0x76, 0x1C, 0xF0, 0x6E, 0xAF, 0xD3, 0xE0,
+0x6F, 0x55, 0xFE, 0xF0, 0x70, 0x8F, 0xB5, 0xE0, 0x71, 0x35, 0xE0, 0xF0, 0x72, 0x6F, 0x97, 0xE0,
+0x73, 0x15, 0xC2, 0xF0, 0x74, 0x4F, 0x79, 0xE0, 0x74, 0xFE, 0xDF, 0x70, 0x76, 0x38, 0x96, 0x60,
+0x76, 0xDE, 0xC1, 0x70, 0x78, 0x18, 0x78, 0x60, 0x78, 0xBE, 0xA3, 0x70, 0x79, 0xF8, 0x5A, 0x60,
+0x7A, 0x9E, 0x85, 0x70, 0x7B, 0xD8, 0x3C, 0x60, 0x7C, 0x7E, 0x67, 0x70, 0x7D, 0xB8, 0x1E, 0x60,
+0x7E, 0x5E, 0x49, 0x70, 0x7F, 0x98, 0x00, 0x60, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x01, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00,
-0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
-0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xFF, 0xFF, 0xB9, 0xB0, 0x01,
+0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x05,
+0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
+0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
+0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
+0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x01,
0x00, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x08, 0xFF, 0xFF, 0xB9,
-0xB0, 0x01, 0x0C, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x10, 0x43, 0x44, 0x54, 0x00, 0x43, 0x53, 0x54,
-0x00, 0x43, 0x57, 0x54, 0x00, 0x43, 0x50, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x00, 0x00, 0x00,
-0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+0xB0, 0x01, 0x0C, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x10, 0xFF, 0xFF, 0xC7, 0xC0, 0x01, 0x14, 0x43,
+0x44, 0x54, 0x00, 0x43, 0x53, 0x54, 0x00, 0x43, 0x57, 0x54, 0x00, 0x43, 0x50, 0x54, 0x00, 0x45,
+0x53, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x00, 0x00,
/* America/Indianapolis */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -3399,6 +3401,47 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x54, 0x00, 0x43, 0x57, 0x54, 0x00, 0x43, 0x50, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x44,
0x54, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+/* America/Indiana/Tell_City */
+0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0x9E, 0xA6, 0x2C, 0x80,
+0x9F, 0xBA, 0xF9, 0x70, 0xA0, 0x86, 0x0E, 0x80, 0xA1, 0x9A, 0xDB, 0x70, 0xCB, 0x88, 0xFE, 0x80,
+0xD2, 0x23, 0xF4, 0x70, 0xD2, 0x61, 0x09, 0xF0, 0xD3, 0x75, 0xF3, 0x00, 0xD4, 0x40, 0xEB, 0xF0,
+0xE0, 0x9E, 0x5B, 0x80, 0xE1, 0x69, 0x54, 0x70, 0xE2, 0x7E, 0x3D, 0x80, 0xE3, 0x49, 0x36, 0x70,
+0xE4, 0x67, 0x3D, 0xE0, 0xE5, 0x29, 0x18, 0x70, 0xE6, 0x47, 0x3C, 0x00, 0xE7, 0x12, 0x34, 0xF0,
+0xE8, 0x27, 0x1E, 0x00, 0xE8, 0xF2, 0x16, 0xF0, 0xEA, 0x07, 0x00, 0x00, 0xEA, 0xD1, 0xF8, 0xF0,
+0xEB, 0xE6, 0xE2, 0x00, 0xEC, 0xB1, 0xDA, 0xF0, 0xED, 0xC6, 0xC4, 0x00, 0xEE, 0xBF, 0xE1, 0x70,
+0xEF, 0xAF, 0xE0, 0x80, 0xF0, 0x71, 0x9E, 0xF0, 0xF1, 0x8F, 0xC2, 0x80, 0xF2, 0x7F, 0xA5, 0x70,
+0xF3, 0x6F, 0xA4, 0x80, 0xF4, 0x5F, 0x87, 0x70, 0xF5, 0x4F, 0x86, 0x80, 0xFE, 0xB8, 0x1C, 0xF0,
+0xFF, 0xA7, 0xFF, 0xE0, 0x00, 0x97, 0xFE, 0xF0, 0x01, 0x87, 0xE1, 0xE0, 0x44, 0x2F, 0x76, 0x70,
+0x45, 0x44, 0x51, 0x70, 0x45, 0xF3, 0xB7, 0x00, 0x47, 0x2D, 0x6D, 0xF0, 0x47, 0xD3, 0x99, 0x00,
+0x49, 0x0D, 0x4F, 0xF0, 0x49, 0xB3, 0x7B, 0x00, 0x4A, 0xED, 0x31, 0xF0, 0x4B, 0x9C, 0x97, 0x80,
+0x4C, 0xD6, 0x4E, 0x70, 0x4D, 0x7C, 0x79, 0x80, 0x4E, 0xB6, 0x30, 0x70, 0x4F, 0x5C, 0x5B, 0x80,
+0x50, 0x96, 0x12, 0x70, 0x51, 0x3C, 0x3D, 0x80, 0x52, 0x75, 0xF4, 0x70, 0x53, 0x1C, 0x1F, 0x80,
+0x54, 0x55, 0xD6, 0x70, 0x54, 0xFC, 0x01, 0x80, 0x56, 0x35, 0xB8, 0x70, 0x56, 0xE5, 0x1E, 0x00,
+0x58, 0x1E, 0xD4, 0xF0, 0x58, 0xC5, 0x00, 0x00, 0x59, 0xFE, 0xB6, 0xF0, 0x5A, 0xA4, 0xE2, 0x00,
+0x5B, 0xDE, 0x98, 0xF0, 0x5C, 0x84, 0xC4, 0x00, 0x5D, 0xBE, 0x7A, 0xF0, 0x5E, 0x64, 0xA6, 0x00,
+0x5F, 0x9E, 0x5C, 0xF0, 0x60, 0x4D, 0xC2, 0x80, 0x61, 0x87, 0x79, 0x70, 0x62, 0x2D, 0xA4, 0x80,
+0x63, 0x67, 0x5B, 0x70, 0x64, 0x0D, 0x86, 0x80, 0x65, 0x47, 0x3D, 0x70, 0x65, 0xED, 0x68, 0x80,
+0x67, 0x27, 0x1F, 0x70, 0x67, 0xCD, 0x4A, 0x80, 0x69, 0x07, 0x01, 0x70, 0x69, 0xAD, 0x2C, 0x80,
+0x6A, 0xE6, 0xE3, 0x70, 0x6B, 0x96, 0x49, 0x00, 0x6C, 0xCF, 0xFF, 0xF0, 0x6D, 0x76, 0x2B, 0x00,
+0x6E, 0xAF, 0xE1, 0xF0, 0x6F, 0x56, 0x0D, 0x00, 0x70, 0x8F, 0xC3, 0xF0, 0x71, 0x35, 0xEF, 0x00,
+0x72, 0x6F, 0xA5, 0xF0, 0x73, 0x15, 0xD1, 0x00, 0x74, 0x4F, 0x87, 0xF0, 0x74, 0xFE, 0xED, 0x80,
+0x76, 0x38, 0xA4, 0x70, 0x76, 0xDE, 0xCF, 0x80, 0x78, 0x18, 0x86, 0x70, 0x78, 0xBE, 0xB1, 0x80,
+0x79, 0xF8, 0x68, 0x70, 0x7A, 0x9E, 0x93, 0x80, 0x7B, 0xD8, 0x4A, 0x70, 0x7C, 0x7E, 0x75, 0x80,
+0x7D, 0xB8, 0x2C, 0x70, 0x7E, 0x5E, 0x57, 0x80, 0x7F, 0x98, 0x0E, 0x70, 0x00, 0x01, 0x00, 0x01,
+0x02, 0x03, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
+0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x05, 0x04, 0x05, 0x04,
+0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x00, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0,
+0x01, 0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x0C, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x10, 0xFF, 0xFF,
+0xC7, 0xC0, 0x01, 0x14, 0x43, 0x44, 0x54, 0x00, 0x43, 0x53, 0x54, 0x00, 0x43, 0x57, 0x54, 0x00,
+0x43, 0x50, 0x54, 0x00, 0x45, 0x53, 0x54, 0x00, 0x45, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x01,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+
/* America/Indiana/Vevay */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
@@ -3447,28 +3490,28 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0xEF, 0xAF, 0xE0, 0x80, 0xF0, 0x71, 0x9E, 0xF0, 0xF1, 0x8F, 0xC2, 0x80, 0xF2, 0x7F, 0xA5, 0x70,
0xF3, 0x6F, 0xA4, 0x80, 0xF4, 0x5F, 0x87, 0x70, 0xF5, 0x4F, 0x86, 0x80, 0xFE, 0xB8, 0x1C, 0xF0,
0xFF, 0xA7, 0xFF, 0xE0, 0x00, 0x97, 0xFE, 0xF0, 0x01, 0x87, 0xE1, 0xE0, 0x44, 0x2F, 0x76, 0x70,
-0x45, 0x44, 0x51, 0x70, 0x45, 0xF3, 0xB7, 0x00, 0x47, 0x2D, 0x6D, 0xF0, 0x47, 0xD3, 0x99, 0x00,
-0x49, 0x0D, 0x4F, 0xF0, 0x49, 0xB3, 0x7B, 0x00, 0x4A, 0xED, 0x31, 0xF0, 0x4B, 0x9C, 0x97, 0x80,
-0x4C, 0xD6, 0x4E, 0x70, 0x4D, 0x7C, 0x79, 0x80, 0x4E, 0xB6, 0x30, 0x70, 0x4F, 0x5C, 0x5B, 0x80,
-0x50, 0x96, 0x12, 0x70, 0x51, 0x3C, 0x3D, 0x80, 0x52, 0x75, 0xF4, 0x70, 0x53, 0x1C, 0x1F, 0x80,
-0x54, 0x55, 0xD6, 0x70, 0x54, 0xFC, 0x01, 0x80, 0x56, 0x35, 0xB8, 0x70, 0x56, 0xE5, 0x1E, 0x00,
-0x58, 0x1E, 0xD4, 0xF0, 0x58, 0xC5, 0x00, 0x00, 0x59, 0xFE, 0xB6, 0xF0, 0x5A, 0xA4, 0xE2, 0x00,
-0x5B, 0xDE, 0x98, 0xF0, 0x5C, 0x84, 0xC4, 0x00, 0x5D, 0xBE, 0x7A, 0xF0, 0x5E, 0x64, 0xA6, 0x00,
-0x5F, 0x9E, 0x5C, 0xF0, 0x60, 0x4D, 0xC2, 0x80, 0x61, 0x87, 0x79, 0x70, 0x62, 0x2D, 0xA4, 0x80,
-0x63, 0x67, 0x5B, 0x70, 0x64, 0x0D, 0x86, 0x80, 0x65, 0x47, 0x3D, 0x70, 0x65, 0xED, 0x68, 0x80,
-0x67, 0x27, 0x1F, 0x70, 0x67, 0xCD, 0x4A, 0x80, 0x69, 0x07, 0x01, 0x70, 0x69, 0xAD, 0x2C, 0x80,
-0x6A, 0xE6, 0xE3, 0x70, 0x6B, 0x96, 0x49, 0x00, 0x6C, 0xCF, 0xFF, 0xF0, 0x6D, 0x76, 0x2B, 0x00,
-0x6E, 0xAF, 0xE1, 0xF0, 0x6F, 0x56, 0x0D, 0x00, 0x70, 0x8F, 0xC3, 0xF0, 0x71, 0x35, 0xEF, 0x00,
-0x72, 0x6F, 0xA5, 0xF0, 0x73, 0x15, 0xD1, 0x00, 0x74, 0x4F, 0x87, 0xF0, 0x74, 0xFE, 0xED, 0x80,
-0x76, 0x38, 0xA4, 0x70, 0x76, 0xDE, 0xCF, 0x80, 0x78, 0x18, 0x86, 0x70, 0x78, 0xBE, 0xB1, 0x80,
-0x79, 0xF8, 0x68, 0x70, 0x7A, 0x9E, 0x93, 0x80, 0x7B, 0xD8, 0x4A, 0x70, 0x7C, 0x7E, 0x75, 0x80,
-0x7D, 0xB8, 0x2C, 0x70, 0x7E, 0x5E, 0x57, 0x80, 0x7F, 0x98, 0x0E, 0x70, 0x00, 0x01, 0x00, 0x01,
+0x45, 0x44, 0x51, 0x70, 0x45, 0xF3, 0xB7, 0x00, 0x47, 0x2D, 0x6D, 0xF0, 0x47, 0xD3, 0x8A, 0xF0,
+0x49, 0x0D, 0x41, 0xE0, 0x49, 0xB3, 0x6C, 0xF0, 0x4A, 0xED, 0x23, 0xE0, 0x4B, 0x9C, 0x89, 0x70,
+0x4C, 0xD6, 0x40, 0x60, 0x4D, 0x7C, 0x6B, 0x70, 0x4E, 0xB6, 0x22, 0x60, 0x4F, 0x5C, 0x4D, 0x70,
+0x50, 0x96, 0x04, 0x60, 0x51, 0x3C, 0x2F, 0x70, 0x52, 0x75, 0xE6, 0x60, 0x53, 0x1C, 0x11, 0x70,
+0x54, 0x55, 0xC8, 0x60, 0x54, 0xFB, 0xF3, 0x70, 0x56, 0x35, 0xAA, 0x60, 0x56, 0xE5, 0x0F, 0xF0,
+0x58, 0x1E, 0xC6, 0xE0, 0x58, 0xC4, 0xF1, 0xF0, 0x59, 0xFE, 0xA8, 0xE0, 0x5A, 0xA4, 0xD3, 0xF0,
+0x5B, 0xDE, 0x8A, 0xE0, 0x5C, 0x84, 0xB5, 0xF0, 0x5D, 0xBE, 0x6C, 0xE0, 0x5E, 0x64, 0x97, 0xF0,
+0x5F, 0x9E, 0x4E, 0xE0, 0x60, 0x4D, 0xB4, 0x70, 0x61, 0x87, 0x6B, 0x60, 0x62, 0x2D, 0x96, 0x70,
+0x63, 0x67, 0x4D, 0x60, 0x64, 0x0D, 0x78, 0x70, 0x65, 0x47, 0x2F, 0x60, 0x65, 0xED, 0x5A, 0x70,
+0x67, 0x27, 0x11, 0x60, 0x67, 0xCD, 0x3C, 0x70, 0x69, 0x06, 0xF3, 0x60, 0x69, 0xAD, 0x1E, 0x70,
+0x6A, 0xE6, 0xD5, 0x60, 0x6B, 0x96, 0x3A, 0xF0, 0x6C, 0xCF, 0xF1, 0xE0, 0x6D, 0x76, 0x1C, 0xF0,
+0x6E, 0xAF, 0xD3, 0xE0, 0x6F, 0x55, 0xFE, 0xF0, 0x70, 0x8F, 0xB5, 0xE0, 0x71, 0x35, 0xE0, 0xF0,
+0x72, 0x6F, 0x97, 0xE0, 0x73, 0x15, 0xC2, 0xF0, 0x74, 0x4F, 0x79, 0xE0, 0x74, 0xFE, 0xDF, 0x70,
+0x76, 0x38, 0x96, 0x60, 0x76, 0xDE, 0xC1, 0x70, 0x78, 0x18, 0x78, 0x60, 0x78, 0xBE, 0xA3, 0x70,
+0x79, 0xF8, 0x5A, 0x60, 0x7A, 0x9E, 0x85, 0x70, 0x7B, 0xD8, 0x3C, 0x60, 0x7C, 0x7E, 0x67, 0x70,
+0x7D, 0xB8, 0x1E, 0x60, 0x7E, 0x5E, 0x49, 0x70, 0x7F, 0x98, 0x00, 0x60, 0x00, 0x01, 0x00, 0x01,
0x02, 0x03, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x05, 0x04, 0x05, 0x04,
-0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
-0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
-0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
-0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0x00, 0x01, 0x00, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04,
+0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04,
+0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04,
+0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04,
0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x00, 0xFF, 0xFF, 0xAB, 0xA0, 0x00, 0x04, 0xFF, 0xFF, 0xB9, 0xB0,
0x01, 0x08, 0xFF, 0xFF, 0xB9, 0xB0, 0x01, 0x0C, 0xFF, 0xFF, 0xB9, 0xB0, 0x00, 0x10, 0xFF, 0xFF,
0xC7, 0xC0, 0x01, 0x14, 0x43, 0x44, 0x54, 0x00, 0x43, 0x53, 0x54, 0x00, 0x43, 0x57, 0x54, 0x00,
@@ -5411,22 +5454,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xDF, 0xE3, 0x30, 0x3A, 0x8F, 0x2C, 0xA0, 0x3B, 0xC8, 0xFF, 0xB0, 0x3C, 0x6F, 0x0E, 0xA0,
0x3D, 0xC4, 0x91, 0x30, 0x3E, 0x4E, 0xF0, 0xA0, 0x3F, 0x91, 0xFE, 0x30, 0x40, 0x2E, 0xD2, 0xA0,
0x41, 0x86, 0xF8, 0x30, 0x42, 0x17, 0xEF, 0x20, 0x43, 0x51, 0xC2, 0x30, 0x43, 0xF7, 0xD1, 0x20,
-0x45, 0x4D, 0x53, 0xB0, 0x45, 0xE0, 0xED, 0xA0, 0x47, 0x2D, 0x35, 0xB0, 0x47, 0xC0, 0xCF, 0xA0,
-0x49, 0x0D, 0x17, 0xB0, 0x49, 0xA0, 0xB1, 0xA0, 0x4A, 0xEC, 0xF9, 0xB0, 0x4B, 0x89, 0xCE, 0x20,
-0x4C, 0xD6, 0x16, 0x30, 0x4D, 0x69, 0xB0, 0x20, 0x4E, 0xB5, 0xF8, 0x30, 0x4F, 0x49, 0x92, 0x20,
-0x50, 0x95, 0xDA, 0x30, 0x51, 0x29, 0x74, 0x20, 0x52, 0x75, 0xBC, 0x30, 0x53, 0x09, 0x56, 0x20,
-0x54, 0x55, 0x9E, 0x30, 0x54, 0xE9, 0x38, 0x20, 0x56, 0x35, 0x80, 0x30, 0x56, 0xD2, 0x54, 0xA0,
-0x58, 0x1E, 0x9C, 0xB0, 0x58, 0xB2, 0x36, 0xA0, 0x59, 0xFE, 0x7E, 0xB0, 0x5A, 0x92, 0x18, 0xA0,
-0x5B, 0xDE, 0x60, 0xB0, 0x5C, 0x71, 0xFA, 0xA0, 0x5D, 0xBE, 0x42, 0xB0, 0x5E, 0x51, 0xDC, 0xA0,
-0x5F, 0x9E, 0x24, 0xB0, 0x60, 0x3A, 0xF9, 0x20, 0x61, 0x87, 0x41, 0x30, 0x62, 0x1A, 0xDB, 0x20,
-0x63, 0x67, 0x23, 0x30, 0x63, 0xFA, 0xBD, 0x20, 0x65, 0x47, 0x05, 0x30, 0x65, 0xDA, 0x9F, 0x20,
-0x67, 0x26, 0xE7, 0x30, 0x67, 0xBA, 0x81, 0x20, 0x69, 0x06, 0xC9, 0x30, 0x69, 0x9A, 0x63, 0x20,
-0x6A, 0xE6, 0xAB, 0x30, 0x6B, 0x83, 0x7F, 0xA0, 0x6C, 0xCF, 0xC7, 0xB0, 0x6D, 0x63, 0x61, 0xA0,
-0x6E, 0xAF, 0xA9, 0xB0, 0x6F, 0x43, 0x43, 0xA0, 0x70, 0x8F, 0x8B, 0xB0, 0x71, 0x23, 0x25, 0xA0,
-0x72, 0x6F, 0x6D, 0xB0, 0x73, 0x03, 0x07, 0xA0, 0x74, 0x4F, 0x4F, 0xB0, 0x74, 0xEC, 0x24, 0x20,
-0x76, 0x38, 0x6C, 0x30, 0x76, 0xCC, 0x06, 0x20, 0x78, 0x18, 0x4E, 0x30, 0x78, 0xAB, 0xE8, 0x20,
-0x79, 0xF8, 0x30, 0x30, 0x7A, 0x8B, 0xCA, 0x20, 0x7B, 0xD8, 0x12, 0x30, 0x7C, 0x6B, 0xAC, 0x20,
-0x7D, 0xB7, 0xF4, 0x30, 0x7E, 0x4B, 0x8E, 0x20, 0x7F, 0x97, 0xD6, 0x30, 0x02, 0x01, 0x02, 0x01,
+0x45, 0x4D, 0x53, 0xB0, 0x45, 0xE0, 0xED, 0xA0, 0x47, 0x11, 0x86, 0x30, 0x47, 0xB7, 0x95, 0x20,
+0x48, 0xF1, 0x68, 0x30, 0x49, 0x97, 0x77, 0x20, 0x4A, 0xD1, 0x4A, 0x30, 0x4B, 0x80, 0x93, 0xA0,
+0x4C, 0xB1, 0x2C, 0x30, 0x4D, 0x60, 0x75, 0xA0, 0x4E, 0x91, 0x0E, 0x30, 0x4F, 0x40, 0x57, 0xA0,
+0x50, 0x7A, 0x2A, 0xB0, 0x51, 0x20, 0x39, 0xA0, 0x52, 0x5A, 0x0C, 0xB0, 0x53, 0x00, 0x1B, 0xA0,
+0x54, 0x39, 0xEE, 0xB0, 0x54, 0xDF, 0xFD, 0xA0, 0x56, 0x19, 0xD0, 0xB0, 0x56, 0xC9, 0x1A, 0x20,
+0x57, 0xF9, 0xB2, 0xB0, 0x58, 0xA8, 0xFC, 0x20, 0x59, 0xD9, 0x94, 0xB0, 0x5A, 0x88, 0xDE, 0x20,
+0x5B, 0xC2, 0xB1, 0x30, 0x5C, 0x68, 0xC0, 0x20, 0x5D, 0xA2, 0x93, 0x30, 0x5E, 0x48, 0xA2, 0x20,
+0x5F, 0x82, 0x75, 0x30, 0x60, 0x31, 0xBE, 0xA0, 0x61, 0x62, 0x57, 0x30, 0x62, 0x11, 0xA0, 0xA0,
+0x63, 0x42, 0x39, 0x30, 0x63, 0xF1, 0x82, 0xA0, 0x65, 0x22, 0x1B, 0x30, 0x65, 0xD1, 0x64, 0xA0,
+0x67, 0x0B, 0x37, 0xB0, 0x67, 0xB1, 0x46, 0xA0, 0x68, 0xEB, 0x19, 0xB0, 0x69, 0x91, 0x28, 0xA0,
+0x6A, 0xCA, 0xFB, 0xB0, 0x6B, 0x7A, 0x45, 0x20, 0x6C, 0xAA, 0xDD, 0xB0, 0x6D, 0x5A, 0x27, 0x20,
+0x6E, 0x8A, 0xBF, 0xB0, 0x6F, 0x3A, 0x09, 0x20, 0x70, 0x73, 0xDC, 0x30, 0x71, 0x19, 0xEB, 0x20,
+0x72, 0x53, 0xBE, 0x30, 0x72, 0xF9, 0xCD, 0x20, 0x74, 0x33, 0xA0, 0x30, 0x74, 0xD9, 0xAF, 0x20,
+0x76, 0x13, 0x82, 0x30, 0x76, 0xC2, 0xCB, 0xA0, 0x77, 0xF3, 0x64, 0x30, 0x78, 0xA2, 0xAD, 0xA0,
+0x79, 0xD3, 0x46, 0x30, 0x7A, 0x82, 0x8F, 0xA0, 0x7B, 0xBC, 0x62, 0xB0, 0x7C, 0x62, 0x71, 0xA0,
+0x7D, 0x9C, 0x44, 0xB0, 0x7E, 0x42, 0x53, 0xA0, 0x7F, 0x7C, 0x26, 0xB0, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -6259,22 +6302,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xD5, 0xF1, 0xE0, 0x3A, 0xB3, 0x6D, 0xE0, 0x3B, 0xBF, 0x0E, 0x60, 0x3C, 0x93, 0x4F, 0xE0,
0x3D, 0x9E, 0xF0, 0x60, 0x3E, 0x73, 0x31, 0xE0, 0x3F, 0x7E, 0xD2, 0x60, 0x40, 0x5C, 0x4E, 0x60,
0x41, 0x5E, 0xB4, 0x60, 0x42, 0x3C, 0x30, 0x60, 0x43, 0x3E, 0x96, 0x60, 0x44, 0x1C, 0x12, 0x60,
-0x45, 0x1E, 0x78, 0x60, 0x45, 0xFB, 0xF4, 0x60, 0x47, 0x07, 0x94, 0xE0, 0x47, 0xDB, 0xD6, 0x60,
-0x48, 0xE7, 0x76, 0xE0, 0x49, 0xBB, 0xB8, 0x60, 0x4A, 0xC7, 0x58, 0xE0, 0x4B, 0xA4, 0xD4, 0xE0,
-0x4C, 0xA7, 0x3A, 0xE0, 0x4D, 0x84, 0xB6, 0xE0, 0x4E, 0x87, 0x1C, 0xE0, 0x4F, 0x64, 0x98, 0xE0,
-0x50, 0x70, 0x39, 0x60, 0x51, 0x44, 0x7A, 0xE0, 0x52, 0x50, 0x1B, 0x60, 0x53, 0x24, 0x5C, 0xE0,
-0x54, 0x2F, 0xFD, 0x60, 0x55, 0x04, 0x3E, 0xE0, 0x56, 0x0F, 0xDF, 0x60, 0x56, 0xED, 0x5B, 0x60,
-0x57, 0xEF, 0xC1, 0x60, 0x58, 0xCD, 0x3D, 0x60, 0x59, 0xCF, 0xA3, 0x60, 0x5A, 0xAD, 0x1F, 0x60,
-0x5B, 0xB8, 0xBF, 0xE0, 0x5C, 0x8D, 0x01, 0x60, 0x5D, 0x98, 0xA1, 0xE0, 0x5E, 0x6C, 0xE3, 0x60,
-0x5F, 0x78, 0x83, 0xE0, 0x60, 0x55, 0xFF, 0xE0, 0x61, 0x58, 0x65, 0xE0, 0x62, 0x35, 0xE1, 0xE0,
-0x63, 0x38, 0x47, 0xE0, 0x64, 0x15, 0xC3, 0xE0, 0x65, 0x18, 0x29, 0xE0, 0x65, 0xF5, 0xA5, 0xE0,
-0x67, 0x01, 0x46, 0x60, 0x67, 0xD5, 0x87, 0xE0, 0x68, 0xE1, 0x28, 0x60, 0x69, 0xB5, 0x69, 0xE0,
-0x6A, 0xC1, 0x0A, 0x60, 0x6B, 0x9E, 0x86, 0x60, 0x6C, 0xA0, 0xEC, 0x60, 0x6D, 0x7E, 0x68, 0x60,
-0x6E, 0x80, 0xCE, 0x60, 0x6F, 0x5E, 0x4A, 0x60, 0x70, 0x69, 0xEA, 0xE0, 0x71, 0x3E, 0x2C, 0x60,
-0x72, 0x49, 0xCC, 0xE0, 0x73, 0x1E, 0x0E, 0x60, 0x74, 0x29, 0xAE, 0xE0, 0x75, 0x07, 0x2A, 0xE0,
-0x76, 0x09, 0x90, 0xE0, 0x76, 0xE7, 0x0C, 0xE0, 0x77, 0xE9, 0x72, 0xE0, 0x78, 0xC6, 0xEE, 0xE0,
-0x79, 0xC9, 0x54, 0xE0, 0x7A, 0xA6, 0xD0, 0xE0, 0x7B, 0xB2, 0x71, 0x60, 0x7C, 0x86, 0xB2, 0xE0,
-0x7D, 0x92, 0x53, 0x60, 0x7E, 0x66, 0x94, 0xE0, 0x7F, 0x72, 0x35, 0x60, 0x03, 0x01, 0x02, 0x01,
+0x45, 0x1E, 0x78, 0x60, 0x45, 0xFB, 0xF4, 0x60, 0x46, 0xFE, 0x5A, 0x60, 0x47, 0xF7, 0x85, 0xE0,
+0x48, 0xDE, 0x3C, 0x60, 0x49, 0xD7, 0x67, 0xE0, 0x4A, 0xBE, 0x1E, 0x60, 0x4B, 0xB7, 0x49, 0xE0,
+0x4C, 0x9E, 0x00, 0x60, 0x4D, 0x97, 0x2B, 0xE0, 0x4E, 0x7D, 0xE2, 0x60, 0x4F, 0x77, 0x0D, 0xE0,
+0x50, 0x66, 0xFE, 0xE0, 0x51, 0x60, 0x2A, 0x60, 0x52, 0x46, 0xE0, 0xE0, 0x53, 0x40, 0x0C, 0x60,
+0x54, 0x26, 0xC2, 0xE0, 0x55, 0x1F, 0xEE, 0x60, 0x56, 0x06, 0xA4, 0xE0, 0x56, 0xFF, 0xD0, 0x60,
+0x57, 0xE6, 0x86, 0xE0, 0x58, 0xDF, 0xB2, 0x60, 0x59, 0xC6, 0x68, 0xE0, 0x5A, 0xBF, 0x94, 0x60,
+0x5B, 0xAF, 0x85, 0x60, 0x5C, 0xA8, 0xB0, 0xE0, 0x5D, 0x8F, 0x67, 0x60, 0x5E, 0x88, 0x92, 0xE0,
+0x5F, 0x6F, 0x49, 0x60, 0x60, 0x68, 0x74, 0xE0, 0x61, 0x4F, 0x2B, 0x60, 0x62, 0x48, 0x56, 0xE0,
+0x63, 0x2F, 0x0D, 0x60, 0x64, 0x28, 0x38, 0xE0, 0x65, 0x0E, 0xEF, 0x60, 0x66, 0x11, 0x55, 0x60,
+0x66, 0xF8, 0x0B, 0xE0, 0x67, 0xF1, 0x37, 0x60, 0x68, 0xD7, 0xED, 0xE0, 0x69, 0xD1, 0x19, 0x60,
+0x6A, 0xB7, 0xCF, 0xE0, 0x6B, 0xB0, 0xFB, 0x60, 0x6C, 0x97, 0xB1, 0xE0, 0x6D, 0x90, 0xDD, 0x60,
+0x6E, 0x77, 0x93, 0xE0, 0x6F, 0x70, 0xBF, 0x60, 0x70, 0x60, 0xB0, 0x60, 0x71, 0x59, 0xDB, 0xE0,
+0x72, 0x40, 0x92, 0x60, 0x73, 0x39, 0xBD, 0xE0, 0x74, 0x20, 0x74, 0x60, 0x75, 0x19, 0x9F, 0xE0,
+0x76, 0x00, 0x56, 0x60, 0x76, 0xF9, 0x81, 0xE0, 0x77, 0xE0, 0x38, 0x60, 0x78, 0xD9, 0x63, 0xE0,
+0x79, 0xC0, 0x1A, 0x60, 0x7A, 0xB9, 0x45, 0xE0, 0x7B, 0xA9, 0x36, 0xE0, 0x7C, 0xA2, 0x62, 0x60,
+0x7D, 0x89, 0x18, 0xE0, 0x7E, 0x82, 0x44, 0x60, 0x7F, 0x68, 0xFA, 0xE0, 0x03, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -6364,22 +6407,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xD5, 0xF1, 0xE0, 0x3A, 0xB3, 0x6D, 0xE0, 0x3B, 0xBF, 0x0E, 0x60, 0x3C, 0x93, 0x4F, 0xE0,
0x3D, 0x9E, 0xF0, 0x60, 0x3E, 0x73, 0x31, 0xE0, 0x3F, 0x7E, 0xD2, 0x60, 0x40, 0x5C, 0x4E, 0x60,
0x41, 0x5E, 0xB4, 0x60, 0x42, 0x3C, 0x30, 0x60, 0x43, 0x3E, 0x96, 0x60, 0x44, 0x1C, 0x12, 0x60,
-0x45, 0x1E, 0x78, 0x60, 0x45, 0xFB, 0xF4, 0x60, 0x47, 0x07, 0x94, 0xE0, 0x47, 0xDB, 0xD6, 0x60,
-0x48, 0xE7, 0x76, 0xE0, 0x49, 0xBB, 0xB8, 0x60, 0x4A, 0xC7, 0x58, 0xE0, 0x4B, 0xA4, 0xD4, 0xE0,
-0x4C, 0xA7, 0x3A, 0xE0, 0x4D, 0x84, 0xB6, 0xE0, 0x4E, 0x87, 0x1C, 0xE0, 0x4F, 0x64, 0x98, 0xE0,
-0x50, 0x70, 0x39, 0x60, 0x51, 0x44, 0x7A, 0xE0, 0x52, 0x50, 0x1B, 0x60, 0x53, 0x24, 0x5C, 0xE0,
-0x54, 0x2F, 0xFD, 0x60, 0x55, 0x04, 0x3E, 0xE0, 0x56, 0x0F, 0xDF, 0x60, 0x56, 0xED, 0x5B, 0x60,
-0x57, 0xEF, 0xC1, 0x60, 0x58, 0xCD, 0x3D, 0x60, 0x59, 0xCF, 0xA3, 0x60, 0x5A, 0xAD, 0x1F, 0x60,
-0x5B, 0xB8, 0xBF, 0xE0, 0x5C, 0x8D, 0x01, 0x60, 0x5D, 0x98, 0xA1, 0xE0, 0x5E, 0x6C, 0xE3, 0x60,
-0x5F, 0x78, 0x83, 0xE0, 0x60, 0x55, 0xFF, 0xE0, 0x61, 0x58, 0x65, 0xE0, 0x62, 0x35, 0xE1, 0xE0,
-0x63, 0x38, 0x47, 0xE0, 0x64, 0x15, 0xC3, 0xE0, 0x65, 0x18, 0x29, 0xE0, 0x65, 0xF5, 0xA5, 0xE0,
-0x67, 0x01, 0x46, 0x60, 0x67, 0xD5, 0x87, 0xE0, 0x68, 0xE1, 0x28, 0x60, 0x69, 0xB5, 0x69, 0xE0,
-0x6A, 0xC1, 0x0A, 0x60, 0x6B, 0x9E, 0x86, 0x60, 0x6C, 0xA0, 0xEC, 0x60, 0x6D, 0x7E, 0x68, 0x60,
-0x6E, 0x80, 0xCE, 0x60, 0x6F, 0x5E, 0x4A, 0x60, 0x70, 0x69, 0xEA, 0xE0, 0x71, 0x3E, 0x2C, 0x60,
-0x72, 0x49, 0xCC, 0xE0, 0x73, 0x1E, 0x0E, 0x60, 0x74, 0x29, 0xAE, 0xE0, 0x75, 0x07, 0x2A, 0xE0,
-0x76, 0x09, 0x90, 0xE0, 0x76, 0xE7, 0x0C, 0xE0, 0x77, 0xE9, 0x72, 0xE0, 0x78, 0xC6, 0xEE, 0xE0,
-0x79, 0xC9, 0x54, 0xE0, 0x7A, 0xA6, 0xD0, 0xE0, 0x7B, 0xB2, 0x71, 0x60, 0x7C, 0x86, 0xB2, 0xE0,
-0x7D, 0x92, 0x53, 0x60, 0x7E, 0x66, 0x94, 0xE0, 0x7F, 0x72, 0x35, 0x60, 0x03, 0x01, 0x02, 0x01,
+0x45, 0x1E, 0x78, 0x60, 0x45, 0xFB, 0xF4, 0x60, 0x46, 0xFE, 0x5A, 0x60, 0x47, 0xF7, 0x85, 0xE0,
+0x48, 0xDE, 0x3C, 0x60, 0x49, 0xD7, 0x67, 0xE0, 0x4A, 0xBE, 0x1E, 0x60, 0x4B, 0xB7, 0x49, 0xE0,
+0x4C, 0x9E, 0x00, 0x60, 0x4D, 0x97, 0x2B, 0xE0, 0x4E, 0x7D, 0xE2, 0x60, 0x4F, 0x77, 0x0D, 0xE0,
+0x50, 0x66, 0xFE, 0xE0, 0x51, 0x60, 0x2A, 0x60, 0x52, 0x46, 0xE0, 0xE0, 0x53, 0x40, 0x0C, 0x60,
+0x54, 0x26, 0xC2, 0xE0, 0x55, 0x1F, 0xEE, 0x60, 0x56, 0x06, 0xA4, 0xE0, 0x56, 0xFF, 0xD0, 0x60,
+0x57, 0xE6, 0x86, 0xE0, 0x58, 0xDF, 0xB2, 0x60, 0x59, 0xC6, 0x68, 0xE0, 0x5A, 0xBF, 0x94, 0x60,
+0x5B, 0xAF, 0x85, 0x60, 0x5C, 0xA8, 0xB0, 0xE0, 0x5D, 0x8F, 0x67, 0x60, 0x5E, 0x88, 0x92, 0xE0,
+0x5F, 0x6F, 0x49, 0x60, 0x60, 0x68, 0x74, 0xE0, 0x61, 0x4F, 0x2B, 0x60, 0x62, 0x48, 0x56, 0xE0,
+0x63, 0x2F, 0x0D, 0x60, 0x64, 0x28, 0x38, 0xE0, 0x65, 0x0E, 0xEF, 0x60, 0x66, 0x11, 0x55, 0x60,
+0x66, 0xF8, 0x0B, 0xE0, 0x67, 0xF1, 0x37, 0x60, 0x68, 0xD7, 0xED, 0xE0, 0x69, 0xD1, 0x19, 0x60,
+0x6A, 0xB7, 0xCF, 0xE0, 0x6B, 0xB0, 0xFB, 0x60, 0x6C, 0x97, 0xB1, 0xE0, 0x6D, 0x90, 0xDD, 0x60,
+0x6E, 0x77, 0x93, 0xE0, 0x6F, 0x70, 0xBF, 0x60, 0x70, 0x60, 0xB0, 0x60, 0x71, 0x59, 0xDB, 0xE0,
+0x72, 0x40, 0x92, 0x60, 0x73, 0x39, 0xBD, 0xE0, 0x74, 0x20, 0x74, 0x60, 0x75, 0x19, 0x9F, 0xE0,
+0x76, 0x00, 0x56, 0x60, 0x76, 0xF9, 0x81, 0xE0, 0x77, 0xE0, 0x38, 0x60, 0x78, 0xD9, 0x63, 0xE0,
+0x79, 0xC0, 0x1A, 0x60, 0x7A, 0xB9, 0x45, 0xE0, 0x7B, 0xA9, 0x36, 0xE0, 0x7C, 0xA2, 0x62, 0x60,
+0x7D, 0x89, 0x18, 0xE0, 0x7E, 0x82, 0x44, 0x60, 0x7F, 0x68, 0xFA, 0xE0, 0x03, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -6985,22 +7028,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3A, 0xC6, 0x53, 0x60, 0x3B, 0xB7, 0x87, 0xD0, 0x3C, 0xA7, 0x86, 0xE0, 0x3D, 0x98, 0xBB, 0x50,
0x3E, 0x88, 0xBA, 0x60, 0x3F, 0x79, 0xEE, 0xD0, 0x40, 0x6B, 0x3F, 0x60, 0x41, 0x5C, 0x73, 0xD0,
0x42, 0x4C, 0x72, 0xE0, 0x43, 0x3D, 0xA7, 0x50, 0x44, 0x2D, 0xA6, 0x60, 0x45, 0x12, 0xFD, 0x50,
-0x46, 0x0C, 0x36, 0xE0, 0x47, 0x00, 0x0E, 0x50, 0x47, 0xEC, 0x18, 0xE0, 0x48, 0xE2, 0x93, 0x50,
-0x49, 0xCB, 0xFA, 0xE0, 0x4A, 0xC3, 0xC6, 0xD0, 0x4B, 0xAB, 0xDC, 0xE0, 0x4C, 0xA4, 0xFA, 0x50,
-0x4D, 0x8B, 0xBE, 0xE0, 0x4E, 0x86, 0x2D, 0xD0, 0x4F, 0x74, 0xDB, 0x60, 0x50, 0x68, 0xB2, 0xD0,
-0x51, 0x54, 0xBD, 0x60, 0x52, 0x49, 0xE6, 0x50, 0x53, 0x34, 0x9F, 0x60, 0x54, 0x2B, 0x19, 0xD0,
-0x55, 0x14, 0x81, 0x60, 0x56, 0x0C, 0x4D, 0x50, 0x56, 0xF4, 0x63, 0x60, 0x57, 0xEE, 0xD2, 0x50,
-0x58, 0xDD, 0x7F, 0xE0, 0x59, 0xD0, 0x05, 0xD0, 0x5A, 0xBD, 0x61, 0xE0, 0x5B, 0xB1, 0x39, 0x50,
-0x5C, 0x9D, 0x43, 0xE0, 0x5D, 0x92, 0x6C, 0xD0, 0x5E, 0x7D, 0x25, 0xE0, 0x5F, 0x74, 0xF1, 0xD0,
-0x60, 0x5D, 0x07, 0xE0, 0x61, 0x56, 0x25, 0x50, 0x62, 0x3C, 0xE9, 0xE0, 0x63, 0x37, 0x58, 0xD0,
-0x64, 0x26, 0x06, 0x60, 0x65, 0x18, 0x8C, 0x50, 0x66, 0x05, 0xE8, 0x60, 0x66, 0xFB, 0x11, 0x50,
-0x67, 0xE5, 0xCA, 0x60, 0x68, 0xDC, 0x44, 0xD0, 0x69, 0xC5, 0xAC, 0x60, 0x6A, 0xBD, 0x78, 0x50,
-0x6B, 0xA5, 0x8E, 0x60, 0x6C, 0x9E, 0xAB, 0xD0, 0x6D, 0x8E, 0xAA, 0xE0, 0x6E, 0x81, 0x30, 0xD0,
-0x6F, 0x6E, 0x8C, 0xE0, 0x70, 0x62, 0x64, 0x50, 0x71, 0x4E, 0x6E, 0xE0, 0x72, 0x43, 0x97, 0xD0,
-0x73, 0x2E, 0x50, 0xE0, 0x74, 0x24, 0xCB, 0x50, 0x75, 0x0E, 0x32, 0xE0, 0x76, 0x07, 0x50, 0x50,
-0x76, 0xEE, 0x14, 0xE0, 0x77, 0xE8, 0x83, 0xD0, 0x78, 0xD7, 0x31, 0x60, 0x79, 0xC9, 0xB7, 0x50,
-0x7A, 0xB7, 0x13, 0x60, 0x7B, 0xAA, 0xEA, 0xD0, 0x7C, 0x96, 0xF5, 0x60, 0x7D, 0x8D, 0x6F, 0xD0,
-0x7E, 0x76, 0xD7, 0x60, 0x7F, 0x6E, 0xA3, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+0x46, 0x0C, 0x36, 0xE0, 0x47, 0x2A, 0x3E, 0x50, 0x47, 0xEC, 0x18, 0xE0, 0x49, 0x13, 0x5A, 0xD0,
+0x49, 0xCB, 0xFA, 0xE0, 0x4A, 0xF3, 0x3C, 0xD0, 0x4B, 0xAB, 0xDC, 0xE0, 0x4C, 0xD3, 0x1E, 0xD0,
+0x4D, 0x8B, 0xBE, 0xE0, 0x4E, 0xB3, 0x00, 0xD0, 0x4F, 0x74, 0xDB, 0x60, 0x50, 0x92, 0xE2, 0xD0,
+0x51, 0x54, 0xBD, 0x60, 0x52, 0x72, 0xC4, 0xD0, 0x53, 0x34, 0x9F, 0x60, 0x54, 0x5B, 0xE1, 0x50,
+0x55, 0x14, 0x81, 0x60, 0x56, 0x3B, 0xC3, 0x50, 0x56, 0xF4, 0x63, 0x60, 0x58, 0x1B, 0xA5, 0x50,
+0x58, 0xDD, 0x7F, 0xE0, 0x59, 0xFB, 0x87, 0x50, 0x5A, 0xBD, 0x61, 0xE0, 0x5B, 0xDB, 0x69, 0x50,
+0x5C, 0x9D, 0x43, 0xE0, 0x5D, 0xBB, 0x4B, 0x50, 0x5E, 0x7D, 0x25, 0xE0, 0x5F, 0xA4, 0x67, 0xD0,
+0x60, 0x5D, 0x07, 0xE0, 0x61, 0x84, 0x49, 0xD0, 0x62, 0x3C, 0xE9, 0xE0, 0x63, 0x64, 0x2B, 0xD0,
+0x64, 0x26, 0x06, 0x60, 0x65, 0x44, 0x0D, 0xD0, 0x66, 0x05, 0xE8, 0x60, 0x67, 0x23, 0xEF, 0xD0,
+0x67, 0xE5, 0xCA, 0x60, 0x69, 0x0D, 0x0C, 0x50, 0x69, 0xC5, 0xAC, 0x60, 0x6A, 0xEC, 0xEE, 0x50,
+0x6B, 0xA5, 0x8E, 0x60, 0x6C, 0xCC, 0xD0, 0x50, 0x6D, 0x8E, 0xAA, 0xE0, 0x6E, 0xAC, 0xB2, 0x50,
+0x6F, 0x6E, 0x8C, 0xE0, 0x70, 0x8C, 0x94, 0x50, 0x71, 0x4E, 0x6E, 0xE0, 0x72, 0x6C, 0x76, 0x50,
+0x73, 0x2E, 0x50, 0xE0, 0x74, 0x55, 0x92, 0xD0, 0x75, 0x0E, 0x32, 0xE0, 0x76, 0x35, 0x74, 0xD0,
+0x76, 0xEE, 0x14, 0xE0, 0x78, 0x15, 0x56, 0xD0, 0x78, 0xD7, 0x31, 0x60, 0x79, 0xF5, 0x38, 0xD0,
+0x7A, 0xB7, 0x13, 0x60, 0x7B, 0xD5, 0x1A, 0xD0, 0x7C, 0x96, 0xF5, 0x60, 0x7D, 0xBE, 0x37, 0x50,
+0x7E, 0x76, 0xD7, 0x60, 0x7F, 0x9E, 0x19, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -7084,22 +7127,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xEF, 0x60, 0xD0, 0x3A, 0xDF, 0x5F, 0xE0, 0x3B, 0xCF, 0x42, 0xD0, 0x3C, 0xBF, 0x41, 0xE0,
0x3D, 0xAF, 0x24, 0xD0, 0x3E, 0x9F, 0x23, 0xE0, 0x3F, 0x8F, 0x06, 0xD0, 0x40, 0x7F, 0x05, 0xE0,
0x41, 0x5C, 0x81, 0xE0, 0x42, 0x5E, 0xE7, 0xE0, 0x43, 0x41, 0xB7, 0xF0, 0x44, 0x2D, 0xA6, 0x60,
-0x45, 0x12, 0xFD, 0x50, 0x46, 0x0E, 0xD9, 0xE0, 0x47, 0x17, 0xC9, 0x50, 0x47, 0xF1, 0x5E, 0xE0,
-0x48, 0xF7, 0xAB, 0x50, 0x49, 0xD2, 0x92, 0x60, 0x4A, 0xD7, 0x8D, 0x50, 0x4B, 0xB3, 0xC5, 0xE0,
-0x4C, 0xB7, 0x6F, 0x50, 0x4D, 0x94, 0xF9, 0x60, 0x4E, 0xA0, 0x8B, 0xD0, 0x4F, 0x77, 0x7E, 0x60,
-0x50, 0x80, 0x6D, 0xD0, 0x51, 0x58, 0xB1, 0xE0, 0x52, 0x60, 0x4F, 0xD0, 0x53, 0x39, 0xE5, 0x60,
-0x54, 0x40, 0x31, 0xD0, 0x55, 0x1B, 0x18, 0xE0, 0x56, 0x20, 0x13, 0xD0, 0x56, 0xFD, 0x9D, 0xE0,
-0x58, 0x09, 0x30, 0x50, 0x58, 0xDE, 0xD1, 0x60, 0x59, 0xE9, 0x12, 0x50, 0x5A, 0xC0, 0x04, 0xE0,
-0x5B, 0xC8, 0xF4, 0x50, 0x5C, 0xA1, 0x38, 0x60, 0x5D, 0xA8, 0xD6, 0x50, 0x5E, 0x83, 0xBD, 0x60,
-0x5F, 0x88, 0xB8, 0x50, 0x60, 0x64, 0xF0, 0xE0, 0x61, 0x68, 0x9A, 0x50, 0x62, 0x46, 0x24, 0x60,
-0x63, 0x51, 0xB6, 0xD0, 0x64, 0x27, 0x57, 0xE0, 0x65, 0x31, 0x98, 0xD0, 0x66, 0x09, 0xDC, 0xE0,
-0x67, 0x11, 0x7A, 0xD0, 0x67, 0xEB, 0x10, 0x60, 0x68, 0xF1, 0x5C, 0xD0, 0x69, 0xCC, 0x43, 0xE0,
-0x6A, 0xD1, 0x3E, 0xD0, 0x6B, 0xAD, 0x77, 0x60, 0x6C, 0xB1, 0x20, 0xD0, 0x6D, 0x8F, 0xFC, 0x60,
-0x6E, 0x9A, 0x3D, 0x50, 0x6F, 0x71, 0x2F, 0xE0, 0x70, 0x7A, 0x1F, 0x50, 0x71, 0x52, 0x63, 0x60,
-0x72, 0x5A, 0x01, 0x50, 0x73, 0x33, 0x96, 0xE0, 0x74, 0x39, 0xE3, 0x50, 0x75, 0x16, 0x1B, 0xE0,
-0x76, 0x19, 0xC5, 0x50, 0x76, 0xF7, 0x4F, 0x60, 0x78, 0x02, 0xE1, 0xD0, 0x78, 0xD8, 0x82, 0xE0,
-0x79, 0xE2, 0xC3, 0xD0, 0x7A, 0xB9, 0xB6, 0x60, 0x7B, 0xC2, 0xA5, 0xD0, 0x7C, 0x9C, 0x3B, 0x60,
-0x7D, 0xA2, 0x87, 0xD0, 0x7E, 0x7D, 0x6E, 0xE0, 0x7F, 0x82, 0x69, 0xD0, 0x00, 0x01, 0x00, 0x01,
+0x45, 0x12, 0xFD, 0x50, 0x46, 0x0E, 0xD9, 0xE0, 0x46, 0xE8, 0x6F, 0x70, 0x47, 0xF1, 0x5E, 0xE0,
+0x48, 0xC8, 0x51, 0x70, 0x49, 0xD2, 0x92, 0x60, 0x4A, 0xA8, 0x33, 0x70, 0x4B, 0xB3, 0xC5, 0xE0,
+0x4C, 0x88, 0x15, 0x70, 0x4D, 0x94, 0xF9, 0x60, 0x4E, 0x67, 0xF7, 0x70, 0x4F, 0x77, 0x7E, 0x60,
+0x50, 0x51, 0x13, 0xF0, 0x51, 0x58, 0xB1, 0xE0, 0x52, 0x30, 0xF5, 0xF0, 0x53, 0x39, 0xE5, 0x60,
+0x54, 0x10, 0xD7, 0xF0, 0x55, 0x1B, 0x18, 0xE0, 0x55, 0xF0, 0xB9, 0xF0, 0x56, 0xFD, 0x9D, 0xE0,
+0x57, 0xD0, 0x9B, 0xF0, 0x58, 0xDE, 0xD1, 0x60, 0x59, 0xB9, 0xB8, 0x70, 0x5A, 0xC0, 0x04, 0xE0,
+0x5B, 0x99, 0x9A, 0x70, 0x5C, 0xA1, 0x38, 0x60, 0x5D, 0x79, 0x7C, 0x70, 0x5E, 0x83, 0xBD, 0x60,
+0x5F, 0x59, 0x5E, 0x70, 0x60, 0x64, 0xF0, 0xE0, 0x61, 0x39, 0x40, 0x70, 0x62, 0x46, 0x24, 0x60,
+0x63, 0x19, 0x22, 0x70, 0x64, 0x27, 0x57, 0xE0, 0x65, 0x02, 0x3E, 0xF0, 0x66, 0x09, 0xDC, 0xE0,
+0x66, 0xE2, 0x20, 0xF0, 0x67, 0xEB, 0x10, 0x60, 0x68, 0xC2, 0x02, 0xF0, 0x69, 0xCC, 0x43, 0xE0,
+0x6A, 0xA1, 0xE4, 0xF0, 0x6B, 0xAD, 0x77, 0x60, 0x6C, 0x81, 0xC6, 0xF0, 0x6D, 0x8F, 0xFC, 0x60,
+0x6E, 0x6A, 0xE3, 0x70, 0x6F, 0x71, 0x2F, 0xE0, 0x70, 0x4A, 0xC5, 0x70, 0x71, 0x52, 0x63, 0x60,
+0x72, 0x2A, 0xA7, 0x70, 0x73, 0x33, 0x96, 0xE0, 0x74, 0x0A, 0x89, 0x70, 0x75, 0x16, 0x1B, 0xE0,
+0x75, 0xEA, 0x6B, 0x70, 0x76, 0xF7, 0x4F, 0x60, 0x77, 0xCA, 0x4D, 0x70, 0x78, 0xD8, 0x82, 0xE0,
+0x79, 0xB3, 0x69, 0xF0, 0x7A, 0xB9, 0xB6, 0x60, 0x7B, 0x93, 0x4B, 0xF0, 0x7C, 0x9C, 0x3B, 0x60,
+0x7D, 0x73, 0x2D, 0xF0, 0x7E, 0x7D, 0x6E, 0xE0, 0x7F, 0x53, 0x0F, 0xF0, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x04, 0x03, 0x04, 0x03, 0x04,
0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x04,
@@ -8094,7 +8137,7 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
/* Asia/Tehran */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x9A, 0x6C, 0x7D, 0xC8,
+0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x9A, 0x6C, 0x7D, 0xC8,
0xD2, 0xDB, 0x12, 0xC8, 0x0E, 0xBB, 0xA2, 0x48, 0x0F, 0x74, 0x2D, 0x40, 0x10, 0x8E, 0x40, 0x30,
0x10, 0xED, 0x3A, 0x40, 0x11, 0x55, 0x67, 0xC8, 0x12, 0x45, 0x4A, 0xB8, 0x13, 0x37, 0xEC, 0xC8,
0x14, 0x2D, 0x15, 0xB8, 0x28, 0x20, 0x76, 0xC8, 0x28, 0xDB, 0x9D, 0xB8, 0x29, 0xCB, 0x9C, 0xC8,
@@ -8104,14 +8147,33 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x36, 0x06, 0xA9, 0x38, 0x36, 0xF5, 0x56, 0xC8, 0x37, 0xE7, 0xDC, 0xB8, 0x38, 0xD6, 0x8A, 0x48,
0x39, 0xC9, 0x10, 0x38, 0x3A, 0xB9, 0x0F, 0x48, 0x3B, 0xAB, 0x95, 0x38, 0x3C, 0x9A, 0x42, 0xC8,
0x3D, 0x8C, 0xC8, 0xB8, 0x3E, 0x7B, 0x76, 0x48, 0x3F, 0x6D, 0xFC, 0x38, 0x40, 0x5C, 0xA9, 0xC8,
-0x41, 0x4F, 0x2F, 0xB8, 0x42, 0x3F, 0x2E, 0xC8, 0x43, 0x31, 0xB4, 0xB8, 0x01, 0x02, 0x04, 0x03,
+0x41, 0x4F, 0x2F, 0xB8, 0x42, 0x3F, 0x2E, 0xC8, 0x43, 0x31, 0xB4, 0xB8, 0x47, 0xE2, 0xC9, 0x48,
+0x48, 0xD5, 0x4F, 0x38, 0x49, 0xC5, 0x4E, 0x48, 0x4A, 0xB7, 0xD4, 0x38, 0x4B, 0xA6, 0x81, 0xC8,
+0x4C, 0x99, 0x07, 0xB8, 0x4D, 0x87, 0xB5, 0x48, 0x4E, 0x7A, 0x3B, 0x38, 0x4F, 0x68, 0xE8, 0xC8,
+0x50, 0x5B, 0x6E, 0xB8, 0x51, 0x4B, 0x6D, 0xC8, 0x52, 0x3D, 0xF3, 0xB8, 0x53, 0x2C, 0xA1, 0x48,
+0x54, 0x1F, 0x27, 0x38, 0x55, 0x0D, 0xD4, 0xC8, 0x56, 0x00, 0x5A, 0xB8, 0x56, 0xEF, 0x08, 0x48,
+0x57, 0xE1, 0x8E, 0x38, 0x58, 0xD1, 0x8D, 0x48, 0x59, 0xC4, 0x13, 0x38, 0x5A, 0xB2, 0xC0, 0xC8,
+0x5B, 0xA5, 0x46, 0xB8, 0x5C, 0x93, 0xF4, 0x48, 0x5D, 0x86, 0x7A, 0x38, 0x5E, 0x75, 0x27, 0xC8,
+0x5F, 0x67, 0xAD, 0xB8, 0x60, 0x57, 0xAC, 0xC8, 0x61, 0x4A, 0x32, 0xB8, 0x62, 0x38, 0xE0, 0x48,
+0x63, 0x2B, 0x66, 0x38, 0x64, 0x1A, 0x13, 0xC8, 0x65, 0x0C, 0x99, 0xB8, 0x65, 0xFB, 0x47, 0x48,
+0x66, 0xED, 0xCD, 0x38, 0x67, 0xDD, 0xCC, 0x48, 0x68, 0xD0, 0x52, 0x38, 0x69, 0xBE, 0xFF, 0xC8,
+0x6A, 0xB1, 0x85, 0xB8, 0x6B, 0xA0, 0x33, 0x48, 0x6C, 0x92, 0xB9, 0x38, 0x6D, 0x81, 0x66, 0xC8,
+0x6E, 0x73, 0xEC, 0xB8, 0x6F, 0x62, 0x9A, 0x48, 0x70, 0x55, 0x20, 0x38, 0x71, 0x45, 0x1F, 0x48,
+0x72, 0x37, 0xA5, 0x38, 0x73, 0x26, 0x52, 0xC8, 0x74, 0x18, 0xD8, 0xB8, 0x75, 0x07, 0x86, 0x48,
+0x75, 0xFA, 0x0C, 0x38, 0x76, 0xE8, 0xB9, 0xC8, 0x77, 0xDB, 0x3F, 0xB8, 0x78, 0xCB, 0x3E, 0xC8,
+0x79, 0xBD, 0xC4, 0xB8, 0x7A, 0xAC, 0x72, 0x48, 0x7B, 0x9E, 0xF8, 0x38, 0x7C, 0x8D, 0xA5, 0xC8,
+0x7D, 0x80, 0x2B, 0xB8, 0x7E, 0x6E, 0xD9, 0x48, 0x7F, 0x61, 0x5F, 0x38, 0x01, 0x02, 0x04, 0x03,
0x04, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
-0x05, 0x02, 0x05, 0x02, 0x00, 0x00, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x38, 0x00, 0x04,
-0x00, 0x00, 0x31, 0x38, 0x00, 0x08, 0x00, 0x00, 0x46, 0x50, 0x01, 0x0D, 0x00, 0x00, 0x38, 0x40,
-0x00, 0x08, 0x00, 0x00, 0x3F, 0x48, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x54, 0x4D, 0x54, 0x00,
-0x49, 0x52, 0x53, 0x54, 0x00, 0x49, 0x52, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x00, 0x00, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x38, 0x00, 0x04, 0x00, 0x00, 0x31, 0x38,
+0x00, 0x08, 0x00, 0x00, 0x46, 0x50, 0x01, 0x0D, 0x00, 0x00, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00,
+0x3F, 0x48, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x54, 0x4D, 0x54, 0x00, 0x49, 0x52, 0x53, 0x54,
+0x00, 0x49, 0x52, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00,
/* Asia/Tel_Aviv */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -8983,21 +9045,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0xBA, 0xBC, 0x00, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x9A, 0x9E, 0x00,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x83, 0xBA, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9C, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x43, 0x7E, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x23, 0x60, 0x80,
-0x47, 0xEE, 0x67, 0x80, 0x49, 0x03, 0x42, 0x80, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xE3, 0x24, 0x80,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xCC, 0x41, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0xAC, 0x23, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x8C, 0x05, 0x00, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x6B, 0xE7, 0x00,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x4B, 0xC9, 0x00, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x2B, 0xAB, 0x00,
-0x56, 0xF6, 0xB2, 0x00, 0x58, 0x14, 0xC7, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xF4, 0xA9, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xD4, 0x8B, 0x80, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0xB4, 0x6D, 0x80,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x94, 0x4F, 0x80, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x7D, 0x6C, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x5D, 0x4E, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x3D, 0x30, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x1D, 0x12, 0x00, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xFC, 0xF4, 0x00,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xDC, 0xD6, 0x00, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xC5, 0xF2, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0xA5, 0xD4, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x85, 0xB6, 0x80,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x65, 0x98, 0x80, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x45, 0x7A, 0x80,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x2E, 0x97, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x78, 0x0E, 0x79, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xEE, 0x5B, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xCE, 0x3D, 0x00,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0xAE, 0x1F, 0x00, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x8E, 0x01, 0x00,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9035,21 +9097,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE8, 0x08, 0x3D, 0xBA, 0xC3, 0x08, 0x3E, 0x85, 0xCA, 0x08, 0x3F, 0x9A, 0xA5, 0x08,
0x40, 0x65, 0xAC, 0x08, 0x41, 0x83, 0xC1, 0x88, 0x42, 0x45, 0x8E, 0x08, 0x43, 0x63, 0xA3, 0x88,
0x44, 0x2E, 0xAA, 0x88, 0x45, 0x43, 0x85, 0x88, 0x46, 0x05, 0x52, 0x08, 0x47, 0x23, 0x67, 0x88,
-0x47, 0xEE, 0x6E, 0x88, 0x49, 0x03, 0x49, 0x88, 0x49, 0xCE, 0x50, 0x88, 0x4A, 0xE3, 0x2B, 0x88,
-0x4B, 0xAE, 0x32, 0x88, 0x4C, 0xCC, 0x48, 0x08, 0x4D, 0x8E, 0x14, 0x88, 0x4E, 0xAC, 0x2A, 0x08,
-0x4F, 0x6D, 0xF6, 0x88, 0x50, 0x8C, 0x0C, 0x08, 0x51, 0x57, 0x13, 0x08, 0x52, 0x6B, 0xEE, 0x08,
-0x53, 0x36, 0xF5, 0x08, 0x54, 0x4B, 0xD0, 0x08, 0x55, 0x16, 0xD7, 0x08, 0x56, 0x2B, 0xB2, 0x08,
-0x56, 0xF6, 0xB9, 0x08, 0x58, 0x14, 0xCE, 0x88, 0x58, 0xD6, 0x9B, 0x08, 0x59, 0xF4, 0xB0, 0x88,
-0x5A, 0xB6, 0x7D, 0x08, 0x5B, 0xD4, 0x92, 0x88, 0x5C, 0x9F, 0x99, 0x88, 0x5D, 0xB4, 0x74, 0x88,
-0x5E, 0x7F, 0x7B, 0x88, 0x5F, 0x94, 0x56, 0x88, 0x60, 0x5F, 0x5D, 0x88, 0x61, 0x7D, 0x73, 0x08,
-0x62, 0x3F, 0x3F, 0x88, 0x63, 0x5D, 0x55, 0x08, 0x64, 0x1F, 0x21, 0x88, 0x65, 0x3D, 0x37, 0x08,
-0x66, 0x08, 0x3E, 0x08, 0x67, 0x1D, 0x19, 0x08, 0x67, 0xE8, 0x20, 0x08, 0x68, 0xFC, 0xFB, 0x08,
-0x69, 0xC8, 0x02, 0x08, 0x6A, 0xDC, 0xDD, 0x08, 0x6B, 0xA7, 0xE4, 0x08, 0x6C, 0xC5, 0xF9, 0x88,
-0x6D, 0x87, 0xC6, 0x08, 0x6E, 0xA5, 0xDB, 0x88, 0x6F, 0x67, 0xA8, 0x08, 0x70, 0x85, 0xBD, 0x88,
-0x71, 0x50, 0xC4, 0x88, 0x72, 0x65, 0x9F, 0x88, 0x73, 0x30, 0xA6, 0x88, 0x74, 0x45, 0x81, 0x88,
-0x75, 0x10, 0x88, 0x88, 0x76, 0x2E, 0x9E, 0x08, 0x76, 0xF0, 0x6A, 0x88, 0x78, 0x0E, 0x80, 0x08,
-0x78, 0xD0, 0x4C, 0x88, 0x79, 0xEE, 0x62, 0x08, 0x7A, 0xB0, 0x2E, 0x88, 0x7B, 0xCE, 0x44, 0x08,
-0x7C, 0x99, 0x4B, 0x08, 0x7D, 0xAE, 0x26, 0x08, 0x7E, 0x79, 0x2D, 0x08, 0x7F, 0x8E, 0x08, 0x08,
+0x47, 0xF7, 0xA9, 0x08, 0x48, 0xE7, 0x9A, 0x08, 0x49, 0xD7, 0x8B, 0x08, 0x4A, 0xC7, 0x7C, 0x08,
+0x4B, 0xB7, 0x6D, 0x08, 0x4C, 0xA7, 0x5E, 0x08, 0x4D, 0x97, 0x4F, 0x08, 0x4E, 0x87, 0x40, 0x08,
+0x4F, 0x77, 0x31, 0x08, 0x50, 0x70, 0x5C, 0x88, 0x51, 0x60, 0x4D, 0x88, 0x52, 0x50, 0x3E, 0x88,
+0x53, 0x40, 0x2F, 0x88, 0x54, 0x30, 0x20, 0x88, 0x55, 0x20, 0x11, 0x88, 0x56, 0x10, 0x02, 0x88,
+0x56, 0xFF, 0xF3, 0x88, 0x57, 0xEF, 0xE4, 0x88, 0x58, 0xDF, 0xD5, 0x88, 0x59, 0xCF, 0xC6, 0x88,
+0x5A, 0xBF, 0xB7, 0x88, 0x5B, 0xB8, 0xE3, 0x08, 0x5C, 0xA8, 0xD4, 0x08, 0x5D, 0x98, 0xC5, 0x08,
+0x5E, 0x88, 0xB6, 0x08, 0x5F, 0x78, 0xA7, 0x08, 0x60, 0x68, 0x98, 0x08, 0x61, 0x58, 0x89, 0x08,
+0x62, 0x48, 0x7A, 0x08, 0x63, 0x38, 0x6B, 0x08, 0x64, 0x28, 0x5C, 0x08, 0x65, 0x18, 0x4D, 0x08,
+0x66, 0x11, 0x78, 0x88, 0x67, 0x01, 0x69, 0x88, 0x67, 0xF1, 0x5A, 0x88, 0x68, 0xE1, 0x4B, 0x88,
+0x69, 0xD1, 0x3C, 0x88, 0x6A, 0xC1, 0x2D, 0x88, 0x6B, 0xB1, 0x1E, 0x88, 0x6C, 0xA1, 0x0F, 0x88,
+0x6D, 0x91, 0x00, 0x88, 0x6E, 0x80, 0xF1, 0x88, 0x6F, 0x70, 0xE2, 0x88, 0x70, 0x6A, 0x0E, 0x08,
+0x71, 0x59, 0xFF, 0x08, 0x72, 0x49, 0xF0, 0x08, 0x73, 0x39, 0xE1, 0x08, 0x74, 0x29, 0xD2, 0x08,
+0x75, 0x19, 0xC3, 0x08, 0x76, 0x09, 0xB4, 0x08, 0x76, 0xF9, 0xA5, 0x08, 0x77, 0xE9, 0x96, 0x08,
+0x78, 0xD9, 0x87, 0x08, 0x79, 0xC9, 0x78, 0x08, 0x7A, 0xB9, 0x69, 0x08, 0x7B, 0xB2, 0x94, 0x88,
+0x7C, 0xA2, 0x85, 0x88, 0x7D, 0x92, 0x76, 0x88, 0x7E, 0x82, 0x67, 0x88, 0x7F, 0x72, 0x58, 0x88,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9100,22 +9162,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3B, 0xDA, 0xE1, 0x08, 0x3C, 0xA5, 0xE8, 0x08, 0x3D, 0xBA, 0xC3, 0x08, 0x3E, 0x85, 0xCA, 0x08,
0x3F, 0x9A, 0xA5, 0x08, 0x40, 0x65, 0xAC, 0x08, 0x41, 0x83, 0xC1, 0x88, 0x42, 0x45, 0x8E, 0x08,
0x43, 0x63, 0xA3, 0x88, 0x44, 0x2E, 0xAA, 0x88, 0x45, 0x43, 0x85, 0x88, 0x46, 0x05, 0x52, 0x08,
-0x47, 0x23, 0x67, 0x88, 0x47, 0xEE, 0x6E, 0x88, 0x49, 0x03, 0x49, 0x88, 0x49, 0xCE, 0x50, 0x88,
-0x4A, 0xE3, 0x2B, 0x88, 0x4B, 0xAE, 0x32, 0x88, 0x4C, 0xCC, 0x48, 0x08, 0x4D, 0x8E, 0x14, 0x88,
-0x4E, 0xAC, 0x2A, 0x08, 0x4F, 0x6D, 0xF6, 0x88, 0x50, 0x8C, 0x0C, 0x08, 0x51, 0x57, 0x13, 0x08,
-0x52, 0x6B, 0xEE, 0x08, 0x53, 0x36, 0xF5, 0x08, 0x54, 0x4B, 0xD0, 0x08, 0x55, 0x16, 0xD7, 0x08,
-0x56, 0x2B, 0xB2, 0x08, 0x56, 0xF6, 0xB9, 0x08, 0x58, 0x14, 0xCE, 0x88, 0x58, 0xD6, 0x9B, 0x08,
-0x59, 0xF4, 0xB0, 0x88, 0x5A, 0xB6, 0x7D, 0x08, 0x5B, 0xD4, 0x92, 0x88, 0x5C, 0x9F, 0x99, 0x88,
-0x5D, 0xB4, 0x74, 0x88, 0x5E, 0x7F, 0x7B, 0x88, 0x5F, 0x94, 0x56, 0x88, 0x60, 0x5F, 0x5D, 0x88,
-0x61, 0x7D, 0x73, 0x08, 0x62, 0x3F, 0x3F, 0x88, 0x63, 0x5D, 0x55, 0x08, 0x64, 0x1F, 0x21, 0x88,
-0x65, 0x3D, 0x37, 0x08, 0x66, 0x08, 0x3E, 0x08, 0x67, 0x1D, 0x19, 0x08, 0x67, 0xE8, 0x20, 0x08,
-0x68, 0xFC, 0xFB, 0x08, 0x69, 0xC8, 0x02, 0x08, 0x6A, 0xDC, 0xDD, 0x08, 0x6B, 0xA7, 0xE4, 0x08,
-0x6C, 0xC5, 0xF9, 0x88, 0x6D, 0x87, 0xC6, 0x08, 0x6E, 0xA5, 0xDB, 0x88, 0x6F, 0x67, 0xA8, 0x08,
-0x70, 0x85, 0xBD, 0x88, 0x71, 0x50, 0xC4, 0x88, 0x72, 0x65, 0x9F, 0x88, 0x73, 0x30, 0xA6, 0x88,
-0x74, 0x45, 0x81, 0x88, 0x75, 0x10, 0x88, 0x88, 0x76, 0x2E, 0x9E, 0x08, 0x76, 0xF0, 0x6A, 0x88,
-0x78, 0x0E, 0x80, 0x08, 0x78, 0xD0, 0x4C, 0x88, 0x79, 0xEE, 0x62, 0x08, 0x7A, 0xB0, 0x2E, 0x88,
-0x7B, 0xCE, 0x44, 0x08, 0x7C, 0x99, 0x4B, 0x08, 0x7D, 0xAE, 0x26, 0x08, 0x7E, 0x79, 0x2D, 0x08,
-0x7F, 0x8E, 0x08, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
+0x47, 0x23, 0x67, 0x88, 0x47, 0xF7, 0xA9, 0x08, 0x48, 0xE7, 0x9A, 0x08, 0x49, 0xD7, 0x8B, 0x08,
+0x4A, 0xC7, 0x7C, 0x08, 0x4B, 0xB7, 0x6D, 0x08, 0x4C, 0xA7, 0x5E, 0x08, 0x4D, 0x97, 0x4F, 0x08,
+0x4E, 0x87, 0x40, 0x08, 0x4F, 0x77, 0x31, 0x08, 0x50, 0x70, 0x5C, 0x88, 0x51, 0x60, 0x4D, 0x88,
+0x52, 0x50, 0x3E, 0x88, 0x53, 0x40, 0x2F, 0x88, 0x54, 0x30, 0x20, 0x88, 0x55, 0x20, 0x11, 0x88,
+0x56, 0x10, 0x02, 0x88, 0x56, 0xFF, 0xF3, 0x88, 0x57, 0xEF, 0xE4, 0x88, 0x58, 0xDF, 0xD5, 0x88,
+0x59, 0xCF, 0xC6, 0x88, 0x5A, 0xBF, 0xB7, 0x88, 0x5B, 0xB8, 0xE3, 0x08, 0x5C, 0xA8, 0xD4, 0x08,
+0x5D, 0x98, 0xC5, 0x08, 0x5E, 0x88, 0xB6, 0x08, 0x5F, 0x78, 0xA7, 0x08, 0x60, 0x68, 0x98, 0x08,
+0x61, 0x58, 0x89, 0x08, 0x62, 0x48, 0x7A, 0x08, 0x63, 0x38, 0x6B, 0x08, 0x64, 0x28, 0x5C, 0x08,
+0x65, 0x18, 0x4D, 0x08, 0x66, 0x11, 0x78, 0x88, 0x67, 0x01, 0x69, 0x88, 0x67, 0xF1, 0x5A, 0x88,
+0x68, 0xE1, 0x4B, 0x88, 0x69, 0xD1, 0x3C, 0x88, 0x6A, 0xC1, 0x2D, 0x88, 0x6B, 0xB1, 0x1E, 0x88,
+0x6C, 0xA1, 0x0F, 0x88, 0x6D, 0x91, 0x00, 0x88, 0x6E, 0x80, 0xF1, 0x88, 0x6F, 0x70, 0xE2, 0x88,
+0x70, 0x6A, 0x0E, 0x08, 0x71, 0x59, 0xFF, 0x08, 0x72, 0x49, 0xF0, 0x08, 0x73, 0x39, 0xE1, 0x08,
+0x74, 0x29, 0xD2, 0x08, 0x75, 0x19, 0xC3, 0x08, 0x76, 0x09, 0xB4, 0x08, 0x76, 0xF9, 0xA5, 0x08,
+0x77, 0xE9, 0x96, 0x08, 0x78, 0xD9, 0x87, 0x08, 0x79, 0xC9, 0x78, 0x08, 0x7A, 0xB9, 0x69, 0x08,
+0x7B, 0xB2, 0x94, 0x88, 0x7C, 0xA2, 0x85, 0x88, 0x7D, 0x92, 0x76, 0x88, 0x7E, 0x82, 0x67, 0x88,
+0x7F, 0x72, 0x58, 0x88, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9152,21 +9214,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0xBA, 0xBC, 0x00, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x9A, 0x9E, 0x00,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x83, 0xBA, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9C, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x43, 0x7E, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x23, 0x60, 0x80,
-0x47, 0xEE, 0x67, 0x80, 0x49, 0x03, 0x42, 0x80, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xE3, 0x24, 0x80,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xCC, 0x41, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0xAC, 0x23, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x8C, 0x05, 0x00, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x6B, 0xE7, 0x00,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x4B, 0xC9, 0x00, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x2B, 0xAB, 0x00,
-0x56, 0xF6, 0xB2, 0x00, 0x58, 0x14, 0xC7, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xF4, 0xA9, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xD4, 0x8B, 0x80, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0xB4, 0x6D, 0x80,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x94, 0x4F, 0x80, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x7D, 0x6C, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x5D, 0x4E, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x3D, 0x30, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x1D, 0x12, 0x00, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xFC, 0xF4, 0x00,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xDC, 0xD6, 0x00, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xC5, 0xF2, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0xA5, 0xD4, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x85, 0xB6, 0x80,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x65, 0x98, 0x80, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x45, 0x7A, 0x80,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x2E, 0x97, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x78, 0x0E, 0x79, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xEE, 0x5B, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xCE, 0x3D, 0x00,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0xAE, 0x1F, 0x00, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x8E, 0x01, 0x00,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9204,21 +9266,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0x9F, 0x0C, 0x80, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x7E, 0xEE, 0x80,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x5E, 0xD0, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x3E, 0xB2, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x1E, 0x94, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x07, 0xB1, 0x00,
-0x47, 0xEE, 0x67, 0x80, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xC7, 0x75, 0x00,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0x87, 0x39, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x70, 0x55, 0x80, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x50, 0x37, 0x80,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x30, 0x19, 0x80, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x0F, 0xFB, 0x80,
-0x56, 0xF6, 0xB2, 0x00, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xCF, 0xBF, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0x98, 0xBE, 0x00,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x58, 0x82, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x38, 0x64, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x18, 0x46, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x01, 0x62, 0x80, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xE1, 0x44, 0x80,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xA1, 0x08, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x6A, 0x07, 0x00,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x29, 0xCB, 0x00,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x77, 0xE9, 0x8F, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xB2, 0x8D, 0x80,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x72, 0x51, 0x80,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9280,21 +9342,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0x9F, 0x0C, 0x80, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x7E, 0xEE, 0x80,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x5E, 0xD0, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x3E, 0xB2, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x1E, 0x94, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x07, 0xB1, 0x00,
-0x47, 0xEE, 0x67, 0x80, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xC7, 0x75, 0x00,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0x87, 0x39, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x70, 0x55, 0x80, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x50, 0x37, 0x80,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x30, 0x19, 0x80, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x0F, 0xFB, 0x80,
-0x56, 0xF6, 0xB2, 0x00, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xCF, 0xBF, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0x98, 0xBE, 0x00,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x58, 0x82, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x38, 0x64, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x18, 0x46, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x01, 0x62, 0x80, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xE1, 0x44, 0x80,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xA1, 0x08, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x6A, 0x07, 0x00,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x29, 0xCB, 0x00,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x77, 0xE9, 0x8F, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xB2, 0x8D, 0x80,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x72, 0x51, 0x80,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9325,22 +9387,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3B, 0xDA, 0xD2, 0xF8, 0x3C, 0xA5, 0xD2, 0xF0, 0x3D, 0xBA, 0xB4, 0xF8, 0x3E, 0x85, 0xB4, 0xF0,
0x3F, 0x9A, 0x96, 0xF8, 0x40, 0x65, 0x96, 0xF0, 0x41, 0x83, 0xB3, 0x78, 0x42, 0x45, 0x78, 0xF0,
0x43, 0x63, 0x95, 0x78, 0x44, 0x2E, 0x95, 0x70, 0x45, 0x43, 0x77, 0x78, 0x46, 0x05, 0x3C, 0xF0,
-0x47, 0x23, 0x59, 0x78, 0x47, 0xEE, 0x59, 0x70, 0x49, 0x03, 0x3B, 0x78, 0x49, 0xCE, 0x3B, 0x70,
-0x4A, 0xE3, 0x1D, 0x78, 0x4B, 0xAE, 0x1D, 0x70, 0x4C, 0xCC, 0x39, 0xF8, 0x4D, 0x8D, 0xFF, 0x70,
-0x4E, 0xAC, 0x1B, 0xF8, 0x4F, 0x6D, 0xE1, 0x70, 0x50, 0x8B, 0xFD, 0xF8, 0x51, 0x56, 0xFD, 0xF0,
-0x52, 0x6B, 0xDF, 0xF8, 0x53, 0x36, 0xDF, 0xF0, 0x54, 0x4B, 0xC1, 0xF8, 0x55, 0x16, 0xC1, 0xF0,
-0x56, 0x2B, 0xA3, 0xF8, 0x56, 0xF6, 0xA3, 0xF0, 0x58, 0x14, 0xC0, 0x78, 0x58, 0xD6, 0x85, 0xF0,
-0x59, 0xF4, 0xA2, 0x78, 0x5A, 0xB6, 0x67, 0xF0, 0x5B, 0xD4, 0x84, 0x78, 0x5C, 0x9F, 0x84, 0x70,
-0x5D, 0xB4, 0x66, 0x78, 0x5E, 0x7F, 0x66, 0x70, 0x5F, 0x94, 0x48, 0x78, 0x60, 0x5F, 0x48, 0x70,
-0x61, 0x7D, 0x64, 0xF8, 0x62, 0x3F, 0x2A, 0x70, 0x63, 0x5D, 0x46, 0xF8, 0x64, 0x1F, 0x0C, 0x70,
-0x65, 0x3D, 0x28, 0xF8, 0x66, 0x08, 0x28, 0xF0, 0x67, 0x1D, 0x0A, 0xF8, 0x67, 0xE8, 0x0A, 0xF0,
-0x68, 0xFC, 0xEC, 0xF8, 0x69, 0xC7, 0xEC, 0xF0, 0x6A, 0xDC, 0xCE, 0xF8, 0x6B, 0xA7, 0xCE, 0xF0,
-0x6C, 0xC5, 0xEB, 0x78, 0x6D, 0x87, 0xB0, 0xF0, 0x6E, 0xA5, 0xCD, 0x78, 0x6F, 0x67, 0x92, 0xF0,
-0x70, 0x85, 0xAF, 0x78, 0x71, 0x50, 0xAF, 0x70, 0x72, 0x65, 0x91, 0x78, 0x73, 0x30, 0x91, 0x70,
-0x74, 0x45, 0x73, 0x78, 0x75, 0x10, 0x73, 0x70, 0x76, 0x2E, 0x8F, 0xF8, 0x76, 0xF0, 0x55, 0x70,
-0x78, 0x0E, 0x71, 0xF8, 0x78, 0xD0, 0x37, 0x70, 0x79, 0xEE, 0x53, 0xF8, 0x7A, 0xB0, 0x19, 0x70,
-0x7B, 0xCE, 0x35, 0xF8, 0x7C, 0x99, 0x35, 0xF0, 0x7D, 0xAE, 0x17, 0xF8, 0x7E, 0x79, 0x17, 0xF0,
-0x7F, 0x8D, 0xF9, 0xF8, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03,
+0x47, 0x23, 0x59, 0x78, 0x47, 0xF7, 0x93, 0xF0, 0x48, 0xE7, 0x8B, 0xF8, 0x49, 0xD7, 0x75, 0xF0,
+0x4A, 0xC7, 0x6D, 0xF8, 0x4B, 0xB7, 0x57, 0xF0, 0x4C, 0xA7, 0x4F, 0xF8, 0x4D, 0x97, 0x39, 0xF0,
+0x4E, 0x87, 0x31, 0xF8, 0x4F, 0x77, 0x1B, 0xF0, 0x50, 0x70, 0x4E, 0x78, 0x51, 0x60, 0x38, 0x70,
+0x52, 0x50, 0x30, 0x78, 0x53, 0x40, 0x1A, 0x70, 0x54, 0x30, 0x12, 0x78, 0x55, 0x1F, 0xFC, 0x70,
+0x56, 0x0F, 0xF4, 0x78, 0x56, 0xFF, 0xDE, 0x70, 0x57, 0xEF, 0xD6, 0x78, 0x58, 0xDF, 0xC0, 0x70,
+0x59, 0xCF, 0xB8, 0x78, 0x5A, 0xBF, 0xA2, 0x70, 0x5B, 0xB8, 0xD4, 0xF8, 0x5C, 0xA8, 0xBE, 0xF0,
+0x5D, 0x98, 0xB6, 0xF8, 0x5E, 0x88, 0xA0, 0xF0, 0x5F, 0x78, 0x98, 0xF8, 0x60, 0x68, 0x82, 0xF0,
+0x61, 0x58, 0x7A, 0xF8, 0x62, 0x48, 0x64, 0xF0, 0x63, 0x38, 0x5C, 0xF8, 0x64, 0x28, 0x46, 0xF0,
+0x65, 0x18, 0x3E, 0xF8, 0x66, 0x11, 0x63, 0x70, 0x67, 0x01, 0x5B, 0x78, 0x67, 0xF1, 0x45, 0x70,
+0x68, 0xE1, 0x3D, 0x78, 0x69, 0xD1, 0x27, 0x70, 0x6A, 0xC1, 0x1F, 0x78, 0x6B, 0xB1, 0x09, 0x70,
+0x6C, 0xA1, 0x01, 0x78, 0x6D, 0x90, 0xEB, 0x70, 0x6E, 0x80, 0xE3, 0x78, 0x6F, 0x70, 0xCD, 0x70,
+0x70, 0x69, 0xFF, 0xF8, 0x71, 0x59, 0xE9, 0xF0, 0x72, 0x49, 0xE1, 0xF8, 0x73, 0x39, 0xCB, 0xF0,
+0x74, 0x29, 0xC3, 0xF8, 0x75, 0x19, 0xAD, 0xF0, 0x76, 0x09, 0xA5, 0xF8, 0x76, 0xF9, 0x8F, 0xF0,
+0x77, 0xE9, 0x87, 0xF8, 0x78, 0xD9, 0x71, 0xF0, 0x79, 0xC9, 0x69, 0xF8, 0x7A, 0xB9, 0x53, 0xF0,
+0x7B, 0xB2, 0x86, 0x78, 0x7C, 0xA2, 0x70, 0x70, 0x7D, 0x92, 0x68, 0x78, 0x7E, 0x82, 0x52, 0x70,
+0x7F, 0x72, 0x4A, 0x78, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9382,22 +9444,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3B, 0xDA, 0xD2, 0xF8, 0x3C, 0xA5, 0xD2, 0xF0, 0x3D, 0xBA, 0xB4, 0xF8, 0x3E, 0x85, 0xB4, 0xF0,
0x3F, 0x9A, 0x96, 0xF8, 0x40, 0x65, 0x96, 0xF0, 0x41, 0x83, 0xB3, 0x78, 0x42, 0x45, 0x78, 0xF0,
0x43, 0x63, 0x95, 0x78, 0x44, 0x2E, 0x95, 0x70, 0x45, 0x43, 0x77, 0x78, 0x46, 0x05, 0x3C, 0xF0,
-0x47, 0x23, 0x59, 0x78, 0x47, 0xEE, 0x59, 0x70, 0x49, 0x03, 0x3B, 0x78, 0x49, 0xCE, 0x3B, 0x70,
-0x4A, 0xE3, 0x1D, 0x78, 0x4B, 0xAE, 0x1D, 0x70, 0x4C, 0xCC, 0x39, 0xF8, 0x4D, 0x8D, 0xFF, 0x70,
-0x4E, 0xAC, 0x1B, 0xF8, 0x4F, 0x6D, 0xE1, 0x70, 0x50, 0x8B, 0xFD, 0xF8, 0x51, 0x56, 0xFD, 0xF0,
-0x52, 0x6B, 0xDF, 0xF8, 0x53, 0x36, 0xDF, 0xF0, 0x54, 0x4B, 0xC1, 0xF8, 0x55, 0x16, 0xC1, 0xF0,
-0x56, 0x2B, 0xA3, 0xF8, 0x56, 0xF6, 0xA3, 0xF0, 0x58, 0x14, 0xC0, 0x78, 0x58, 0xD6, 0x85, 0xF0,
-0x59, 0xF4, 0xA2, 0x78, 0x5A, 0xB6, 0x67, 0xF0, 0x5B, 0xD4, 0x84, 0x78, 0x5C, 0x9F, 0x84, 0x70,
-0x5D, 0xB4, 0x66, 0x78, 0x5E, 0x7F, 0x66, 0x70, 0x5F, 0x94, 0x48, 0x78, 0x60, 0x5F, 0x48, 0x70,
-0x61, 0x7D, 0x64, 0xF8, 0x62, 0x3F, 0x2A, 0x70, 0x63, 0x5D, 0x46, 0xF8, 0x64, 0x1F, 0x0C, 0x70,
-0x65, 0x3D, 0x28, 0xF8, 0x66, 0x08, 0x28, 0xF0, 0x67, 0x1D, 0x0A, 0xF8, 0x67, 0xE8, 0x0A, 0xF0,
-0x68, 0xFC, 0xEC, 0xF8, 0x69, 0xC7, 0xEC, 0xF0, 0x6A, 0xDC, 0xCE, 0xF8, 0x6B, 0xA7, 0xCE, 0xF0,
-0x6C, 0xC5, 0xEB, 0x78, 0x6D, 0x87, 0xB0, 0xF0, 0x6E, 0xA5, 0xCD, 0x78, 0x6F, 0x67, 0x92, 0xF0,
-0x70, 0x85, 0xAF, 0x78, 0x71, 0x50, 0xAF, 0x70, 0x72, 0x65, 0x91, 0x78, 0x73, 0x30, 0x91, 0x70,
-0x74, 0x45, 0x73, 0x78, 0x75, 0x10, 0x73, 0x70, 0x76, 0x2E, 0x8F, 0xF8, 0x76, 0xF0, 0x55, 0x70,
-0x78, 0x0E, 0x71, 0xF8, 0x78, 0xD0, 0x37, 0x70, 0x79, 0xEE, 0x53, 0xF8, 0x7A, 0xB0, 0x19, 0x70,
-0x7B, 0xCE, 0x35, 0xF8, 0x7C, 0x99, 0x35, 0xF0, 0x7D, 0xAE, 0x17, 0xF8, 0x7E, 0x79, 0x17, 0xF0,
-0x7F, 0x8D, 0xF9, 0xF8, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03,
+0x47, 0x23, 0x59, 0x78, 0x47, 0xF7, 0x93, 0xF0, 0x48, 0xE7, 0x8B, 0xF8, 0x49, 0xD7, 0x75, 0xF0,
+0x4A, 0xC7, 0x6D, 0xF8, 0x4B, 0xB7, 0x57, 0xF0, 0x4C, 0xA7, 0x4F, 0xF8, 0x4D, 0x97, 0x39, 0xF0,
+0x4E, 0x87, 0x31, 0xF8, 0x4F, 0x77, 0x1B, 0xF0, 0x50, 0x70, 0x4E, 0x78, 0x51, 0x60, 0x38, 0x70,
+0x52, 0x50, 0x30, 0x78, 0x53, 0x40, 0x1A, 0x70, 0x54, 0x30, 0x12, 0x78, 0x55, 0x1F, 0xFC, 0x70,
+0x56, 0x0F, 0xF4, 0x78, 0x56, 0xFF, 0xDE, 0x70, 0x57, 0xEF, 0xD6, 0x78, 0x58, 0xDF, 0xC0, 0x70,
+0x59, 0xCF, 0xB8, 0x78, 0x5A, 0xBF, 0xA2, 0x70, 0x5B, 0xB8, 0xD4, 0xF8, 0x5C, 0xA8, 0xBE, 0xF0,
+0x5D, 0x98, 0xB6, 0xF8, 0x5E, 0x88, 0xA0, 0xF0, 0x5F, 0x78, 0x98, 0xF8, 0x60, 0x68, 0x82, 0xF0,
+0x61, 0x58, 0x7A, 0xF8, 0x62, 0x48, 0x64, 0xF0, 0x63, 0x38, 0x5C, 0xF8, 0x64, 0x28, 0x46, 0xF0,
+0x65, 0x18, 0x3E, 0xF8, 0x66, 0x11, 0x63, 0x70, 0x67, 0x01, 0x5B, 0x78, 0x67, 0xF1, 0x45, 0x70,
+0x68, 0xE1, 0x3D, 0x78, 0x69, 0xD1, 0x27, 0x70, 0x6A, 0xC1, 0x1F, 0x78, 0x6B, 0xB1, 0x09, 0x70,
+0x6C, 0xA1, 0x01, 0x78, 0x6D, 0x90, 0xEB, 0x70, 0x6E, 0x80, 0xE3, 0x78, 0x6F, 0x70, 0xCD, 0x70,
+0x70, 0x69, 0xFF, 0xF8, 0x71, 0x59, 0xE9, 0xF0, 0x72, 0x49, 0xE1, 0xF8, 0x73, 0x39, 0xCB, 0xF0,
+0x74, 0x29, 0xC3, 0xF8, 0x75, 0x19, 0xAD, 0xF0, 0x76, 0x09, 0xA5, 0xF8, 0x76, 0xF9, 0x8F, 0xF0,
+0x77, 0xE9, 0x87, 0xF8, 0x78, 0xD9, 0x71, 0xF0, 0x79, 0xC9, 0x69, 0xF8, 0x7A, 0xB9, 0x53, 0xF0,
+0x7B, 0xB2, 0x86, 0x78, 0x7C, 0xA2, 0x70, 0x70, 0x7D, 0x92, 0x68, 0x78, 0x7E, 0x82, 0x52, 0x70,
+0x7F, 0x72, 0x4A, 0x78, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9432,21 +9494,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0xBA, 0xBC, 0x00, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x9A, 0x9E, 0x00,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x83, 0xBA, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9C, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x43, 0x7E, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x23, 0x60, 0x80,
-0x47, 0xEE, 0x67, 0x80, 0x49, 0x03, 0x42, 0x80, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xE3, 0x24, 0x80,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xCC, 0x41, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0xAC, 0x23, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x8C, 0x05, 0x00, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x6B, 0xE7, 0x00,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x4B, 0xC9, 0x00, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x2B, 0xAB, 0x00,
-0x56, 0xF6, 0xB2, 0x00, 0x58, 0x14, 0xC7, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xF4, 0xA9, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xD4, 0x8B, 0x80, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0xB4, 0x6D, 0x80,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x94, 0x4F, 0x80, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x7D, 0x6C, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x5D, 0x4E, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x3D, 0x30, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x1D, 0x12, 0x00, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xFC, 0xF4, 0x00,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xDC, 0xD6, 0x00, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xC5, 0xF2, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0xA5, 0xD4, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x85, 0xB6, 0x80,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x65, 0x98, 0x80, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x45, 0x7A, 0x80,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x2E, 0x97, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x78, 0x0E, 0x79, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xEE, 0x5B, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xCE, 0x3D, 0x00,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0xAE, 0x1F, 0x00, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x8E, 0x01, 0x00,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9493,21 +9555,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0xBA, 0xBC, 0x00, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x9A, 0x9E, 0x00,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x83, 0xBA, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9C, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x43, 0x7E, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x23, 0x60, 0x80,
-0x47, 0xEE, 0x67, 0x80, 0x49, 0x03, 0x42, 0x80, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xE3, 0x24, 0x80,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xCC, 0x41, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0xAC, 0x23, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x8C, 0x05, 0x00, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x6B, 0xE7, 0x00,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x4B, 0xC9, 0x00, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x2B, 0xAB, 0x00,
-0x56, 0xF6, 0xB2, 0x00, 0x58, 0x14, 0xC7, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xF4, 0xA9, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xD4, 0x8B, 0x80, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0xB4, 0x6D, 0x80,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x94, 0x4F, 0x80, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x7D, 0x6C, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x5D, 0x4E, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x3D, 0x30, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x1D, 0x12, 0x00, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xFC, 0xF4, 0x00,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xDC, 0xD6, 0x00, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xC5, 0xF2, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0xA5, 0xD4, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x85, 0xB6, 0x80,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x65, 0x98, 0x80, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x45, 0x7A, 0x80,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x2E, 0x97, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x78, 0x0E, 0x79, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xEE, 0x5B, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xCE, 0x3D, 0x00,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0xAE, 0x1F, 0x00, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x8E, 0x01, 0x00,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9571,21 +9633,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE8, 0x08, 0x3D, 0xBA, 0xC3, 0x08, 0x3E, 0x85, 0xCA, 0x08, 0x3F, 0x9A, 0xA5, 0x08,
0x40, 0x65, 0xAC, 0x08, 0x41, 0x83, 0xC1, 0x88, 0x42, 0x45, 0x8E, 0x08, 0x43, 0x63, 0xA3, 0x88,
0x44, 0x2E, 0xAA, 0x88, 0x45, 0x43, 0x85, 0x88, 0x46, 0x05, 0x52, 0x08, 0x47, 0x23, 0x67, 0x88,
-0x47, 0xEE, 0x6E, 0x88, 0x49, 0x03, 0x49, 0x88, 0x49, 0xCE, 0x50, 0x88, 0x4A, 0xE3, 0x2B, 0x88,
-0x4B, 0xAE, 0x32, 0x88, 0x4C, 0xCC, 0x48, 0x08, 0x4D, 0x8E, 0x14, 0x88, 0x4E, 0xAC, 0x2A, 0x08,
-0x4F, 0x6D, 0xF6, 0x88, 0x50, 0x8C, 0x0C, 0x08, 0x51, 0x57, 0x13, 0x08, 0x52, 0x6B, 0xEE, 0x08,
-0x53, 0x36, 0xF5, 0x08, 0x54, 0x4B, 0xD0, 0x08, 0x55, 0x16, 0xD7, 0x08, 0x56, 0x2B, 0xB2, 0x08,
-0x56, 0xF6, 0xB9, 0x08, 0x58, 0x14, 0xCE, 0x88, 0x58, 0xD6, 0x9B, 0x08, 0x59, 0xF4, 0xB0, 0x88,
-0x5A, 0xB6, 0x7D, 0x08, 0x5B, 0xD4, 0x92, 0x88, 0x5C, 0x9F, 0x99, 0x88, 0x5D, 0xB4, 0x74, 0x88,
-0x5E, 0x7F, 0x7B, 0x88, 0x5F, 0x94, 0x56, 0x88, 0x60, 0x5F, 0x5D, 0x88, 0x61, 0x7D, 0x73, 0x08,
-0x62, 0x3F, 0x3F, 0x88, 0x63, 0x5D, 0x55, 0x08, 0x64, 0x1F, 0x21, 0x88, 0x65, 0x3D, 0x37, 0x08,
-0x66, 0x08, 0x3E, 0x08, 0x67, 0x1D, 0x19, 0x08, 0x67, 0xE8, 0x20, 0x08, 0x68, 0xFC, 0xFB, 0x08,
-0x69, 0xC8, 0x02, 0x08, 0x6A, 0xDC, 0xDD, 0x08, 0x6B, 0xA7, 0xE4, 0x08, 0x6C, 0xC5, 0xF9, 0x88,
-0x6D, 0x87, 0xC6, 0x08, 0x6E, 0xA5, 0xDB, 0x88, 0x6F, 0x67, 0xA8, 0x08, 0x70, 0x85, 0xBD, 0x88,
-0x71, 0x50, 0xC4, 0x88, 0x72, 0x65, 0x9F, 0x88, 0x73, 0x30, 0xA6, 0x88, 0x74, 0x45, 0x81, 0x88,
-0x75, 0x10, 0x88, 0x88, 0x76, 0x2E, 0x9E, 0x08, 0x76, 0xF0, 0x6A, 0x88, 0x78, 0x0E, 0x80, 0x08,
-0x78, 0xD0, 0x4C, 0x88, 0x79, 0xEE, 0x62, 0x08, 0x7A, 0xB0, 0x2E, 0x88, 0x7B, 0xCE, 0x44, 0x08,
-0x7C, 0x99, 0x4B, 0x08, 0x7D, 0xAE, 0x26, 0x08, 0x7E, 0x79, 0x2D, 0x08, 0x7F, 0x8E, 0x08, 0x08,
+0x47, 0xF7, 0xA9, 0x08, 0x48, 0xE7, 0x9A, 0x08, 0x49, 0xD7, 0x8B, 0x08, 0x4A, 0xC7, 0x7C, 0x08,
+0x4B, 0xB7, 0x6D, 0x08, 0x4C, 0xA7, 0x5E, 0x08, 0x4D, 0x97, 0x4F, 0x08, 0x4E, 0x87, 0x40, 0x08,
+0x4F, 0x77, 0x31, 0x08, 0x50, 0x70, 0x5C, 0x88, 0x51, 0x60, 0x4D, 0x88, 0x52, 0x50, 0x3E, 0x88,
+0x53, 0x40, 0x2F, 0x88, 0x54, 0x30, 0x20, 0x88, 0x55, 0x20, 0x11, 0x88, 0x56, 0x10, 0x02, 0x88,
+0x56, 0xFF, 0xF3, 0x88, 0x57, 0xEF, 0xE4, 0x88, 0x58, 0xDF, 0xD5, 0x88, 0x59, 0xCF, 0xC6, 0x88,
+0x5A, 0xBF, 0xB7, 0x88, 0x5B, 0xB8, 0xE3, 0x08, 0x5C, 0xA8, 0xD4, 0x08, 0x5D, 0x98, 0xC5, 0x08,
+0x5E, 0x88, 0xB6, 0x08, 0x5F, 0x78, 0xA7, 0x08, 0x60, 0x68, 0x98, 0x08, 0x61, 0x58, 0x89, 0x08,
+0x62, 0x48, 0x7A, 0x08, 0x63, 0x38, 0x6B, 0x08, 0x64, 0x28, 0x5C, 0x08, 0x65, 0x18, 0x4D, 0x08,
+0x66, 0x11, 0x78, 0x88, 0x67, 0x01, 0x69, 0x88, 0x67, 0xF1, 0x5A, 0x88, 0x68, 0xE1, 0x4B, 0x88,
+0x69, 0xD1, 0x3C, 0x88, 0x6A, 0xC1, 0x2D, 0x88, 0x6B, 0xB1, 0x1E, 0x88, 0x6C, 0xA1, 0x0F, 0x88,
+0x6D, 0x91, 0x00, 0x88, 0x6E, 0x80, 0xF1, 0x88, 0x6F, 0x70, 0xE2, 0x88, 0x70, 0x6A, 0x0E, 0x08,
+0x71, 0x59, 0xFF, 0x08, 0x72, 0x49, 0xF0, 0x08, 0x73, 0x39, 0xE1, 0x08, 0x74, 0x29, 0xD2, 0x08,
+0x75, 0x19, 0xC3, 0x08, 0x76, 0x09, 0xB4, 0x08, 0x76, 0xF9, 0xA5, 0x08, 0x77, 0xE9, 0x96, 0x08,
+0x78, 0xD9, 0x87, 0x08, 0x79, 0xC9, 0x78, 0x08, 0x7A, 0xB9, 0x69, 0x08, 0x7B, 0xB2, 0x94, 0x88,
+0x7C, 0xA2, 0x85, 0x88, 0x7D, 0x92, 0x76, 0x88, 0x7E, 0x82, 0x67, 0x88, 0x7F, 0x72, 0x58, 0x88,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9623,21 +9685,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0xBA, 0xBC, 0x00, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x9A, 0x9E, 0x00,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x83, 0xBA, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9C, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x43, 0x7E, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x23, 0x60, 0x80,
-0x47, 0xEE, 0x67, 0x80, 0x49, 0x03, 0x42, 0x80, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xE3, 0x24, 0x80,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xCC, 0x41, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0xAC, 0x23, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x8C, 0x05, 0x00, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x6B, 0xE7, 0x00,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x4B, 0xC9, 0x00, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x2B, 0xAB, 0x00,
-0x56, 0xF6, 0xB2, 0x00, 0x58, 0x14, 0xC7, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xF4, 0xA9, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xD4, 0x8B, 0x80, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0xB4, 0x6D, 0x80,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x94, 0x4F, 0x80, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x7D, 0x6C, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x5D, 0x4E, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x3D, 0x30, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x1D, 0x12, 0x00, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xFC, 0xF4, 0x00,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xDC, 0xD6, 0x00, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xC5, 0xF2, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0xA5, 0xD4, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x85, 0xB6, 0x80,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x65, 0x98, 0x80, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x45, 0x7A, 0x80,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x2E, 0x97, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x78, 0x0E, 0x79, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xEE, 0x5B, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xCE, 0x3D, 0x00,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0xAE, 0x1F, 0x00, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x8E, 0x01, 0x00,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9677,21 +9739,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0x9F, 0x0C, 0x80, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x7E, 0xEE, 0x80,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x5E, 0xD0, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x3E, 0xB2, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x1E, 0x94, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x07, 0xB1, 0x00,
-0x47, 0xEE, 0x67, 0x80, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xC7, 0x75, 0x00,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0x87, 0x39, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x70, 0x55, 0x80, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x50, 0x37, 0x80,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x30, 0x19, 0x80, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x0F, 0xFB, 0x80,
-0x56, 0xF6, 0xB2, 0x00, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xCF, 0xBF, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0x98, 0xBE, 0x00,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x58, 0x82, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x38, 0x64, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x18, 0x46, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x01, 0x62, 0x80, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xE1, 0x44, 0x80,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xA1, 0x08, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x6A, 0x07, 0x00,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x29, 0xCB, 0x00,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x77, 0xE9, 0x8F, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xB2, 0x8D, 0x80,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x72, 0x51, 0x80,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9729,21 +9791,21 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3C, 0xA5, 0xE1, 0x00, 0x3D, 0xBA, 0xBC, 0x00, 0x3E, 0x85, 0xC3, 0x00, 0x3F, 0x9A, 0x9E, 0x00,
0x40, 0x65, 0xA5, 0x00, 0x41, 0x83, 0xBA, 0x80, 0x42, 0x45, 0x87, 0x00, 0x43, 0x63, 0x9C, 0x80,
0x44, 0x2E, 0xA3, 0x80, 0x45, 0x43, 0x7E, 0x80, 0x46, 0x05, 0x4B, 0x00, 0x47, 0x23, 0x60, 0x80,
-0x47, 0xEE, 0x67, 0x80, 0x49, 0x03, 0x42, 0x80, 0x49, 0xCE, 0x49, 0x80, 0x4A, 0xE3, 0x24, 0x80,
-0x4B, 0xAE, 0x2B, 0x80, 0x4C, 0xCC, 0x41, 0x00, 0x4D, 0x8E, 0x0D, 0x80, 0x4E, 0xAC, 0x23, 0x00,
-0x4F, 0x6D, 0xEF, 0x80, 0x50, 0x8C, 0x05, 0x00, 0x51, 0x57, 0x0C, 0x00, 0x52, 0x6B, 0xE7, 0x00,
-0x53, 0x36, 0xEE, 0x00, 0x54, 0x4B, 0xC9, 0x00, 0x55, 0x16, 0xD0, 0x00, 0x56, 0x2B, 0xAB, 0x00,
-0x56, 0xF6, 0xB2, 0x00, 0x58, 0x14, 0xC7, 0x80, 0x58, 0xD6, 0x94, 0x00, 0x59, 0xF4, 0xA9, 0x80,
-0x5A, 0xB6, 0x76, 0x00, 0x5B, 0xD4, 0x8B, 0x80, 0x5C, 0x9F, 0x92, 0x80, 0x5D, 0xB4, 0x6D, 0x80,
-0x5E, 0x7F, 0x74, 0x80, 0x5F, 0x94, 0x4F, 0x80, 0x60, 0x5F, 0x56, 0x80, 0x61, 0x7D, 0x6C, 0x00,
-0x62, 0x3F, 0x38, 0x80, 0x63, 0x5D, 0x4E, 0x00, 0x64, 0x1F, 0x1A, 0x80, 0x65, 0x3D, 0x30, 0x00,
-0x66, 0x08, 0x37, 0x00, 0x67, 0x1D, 0x12, 0x00, 0x67, 0xE8, 0x19, 0x00, 0x68, 0xFC, 0xF4, 0x00,
-0x69, 0xC7, 0xFB, 0x00, 0x6A, 0xDC, 0xD6, 0x00, 0x6B, 0xA7, 0xDD, 0x00, 0x6C, 0xC5, 0xF2, 0x80,
-0x6D, 0x87, 0xBF, 0x00, 0x6E, 0xA5, 0xD4, 0x80, 0x6F, 0x67, 0xA1, 0x00, 0x70, 0x85, 0xB6, 0x80,
-0x71, 0x50, 0xBD, 0x80, 0x72, 0x65, 0x98, 0x80, 0x73, 0x30, 0x9F, 0x80, 0x74, 0x45, 0x7A, 0x80,
-0x75, 0x10, 0x81, 0x80, 0x76, 0x2E, 0x97, 0x00, 0x76, 0xF0, 0x63, 0x80, 0x78, 0x0E, 0x79, 0x00,
-0x78, 0xD0, 0x45, 0x80, 0x79, 0xEE, 0x5B, 0x00, 0x7A, 0xB0, 0x27, 0x80, 0x7B, 0xCE, 0x3D, 0x00,
-0x7C, 0x99, 0x44, 0x00, 0x7D, 0xAE, 0x1F, 0x00, 0x7E, 0x79, 0x26, 0x00, 0x7F, 0x8E, 0x01, 0x00,
+0x47, 0xF7, 0xA2, 0x00, 0x48, 0xE7, 0x93, 0x00, 0x49, 0xD7, 0x84, 0x00, 0x4A, 0xC7, 0x75, 0x00,
+0x4B, 0xB7, 0x66, 0x00, 0x4C, 0xA7, 0x57, 0x00, 0x4D, 0x97, 0x48, 0x00, 0x4E, 0x87, 0x39, 0x00,
+0x4F, 0x77, 0x2A, 0x00, 0x50, 0x70, 0x55, 0x80, 0x51, 0x60, 0x46, 0x80, 0x52, 0x50, 0x37, 0x80,
+0x53, 0x40, 0x28, 0x80, 0x54, 0x30, 0x19, 0x80, 0x55, 0x20, 0x0A, 0x80, 0x56, 0x0F, 0xFB, 0x80,
+0x56, 0xFF, 0xEC, 0x80, 0x57, 0xEF, 0xDD, 0x80, 0x58, 0xDF, 0xCE, 0x80, 0x59, 0xCF, 0xBF, 0x80,
+0x5A, 0xBF, 0xB0, 0x80, 0x5B, 0xB8, 0xDC, 0x00, 0x5C, 0xA8, 0xCD, 0x00, 0x5D, 0x98, 0xBE, 0x00,
+0x5E, 0x88, 0xAF, 0x00, 0x5F, 0x78, 0xA0, 0x00, 0x60, 0x68, 0x91, 0x00, 0x61, 0x58, 0x82, 0x00,
+0x62, 0x48, 0x73, 0x00, 0x63, 0x38, 0x64, 0x00, 0x64, 0x28, 0x55, 0x00, 0x65, 0x18, 0x46, 0x00,
+0x66, 0x11, 0x71, 0x80, 0x67, 0x01, 0x62, 0x80, 0x67, 0xF1, 0x53, 0x80, 0x68, 0xE1, 0x44, 0x80,
+0x69, 0xD1, 0x35, 0x80, 0x6A, 0xC1, 0x26, 0x80, 0x6B, 0xB1, 0x17, 0x80, 0x6C, 0xA1, 0x08, 0x80,
+0x6D, 0x90, 0xF9, 0x80, 0x6E, 0x80, 0xEA, 0x80, 0x6F, 0x70, 0xDB, 0x80, 0x70, 0x6A, 0x07, 0x00,
+0x71, 0x59, 0xF8, 0x00, 0x72, 0x49, 0xE9, 0x00, 0x73, 0x39, 0xDA, 0x00, 0x74, 0x29, 0xCB, 0x00,
+0x75, 0x19, 0xBC, 0x00, 0x76, 0x09, 0xAD, 0x00, 0x76, 0xF9, 0x9E, 0x00, 0x77, 0xE9, 0x8F, 0x00,
+0x78, 0xD9, 0x80, 0x00, 0x79, 0xC9, 0x71, 0x00, 0x7A, 0xB9, 0x62, 0x00, 0x7B, 0xB2, 0x8D, 0x80,
+0x7C, 0xA2, 0x7E, 0x80, 0x7D, 0x92, 0x6F, 0x80, 0x7E, 0x82, 0x60, 0x80, 0x7F, 0x72, 0x51, 0x80,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9794,22 +9856,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3B, 0xDA, 0xE1, 0x08, 0x3C, 0xA5, 0xE8, 0x08, 0x3D, 0xBA, 0xC3, 0x08, 0x3E, 0x85, 0xCA, 0x08,
0x3F, 0x9A, 0xA5, 0x08, 0x40, 0x65, 0xAC, 0x08, 0x41, 0x83, 0xC1, 0x88, 0x42, 0x45, 0x8E, 0x08,
0x43, 0x63, 0xA3, 0x88, 0x44, 0x2E, 0xAA, 0x88, 0x45, 0x43, 0x85, 0x88, 0x46, 0x05, 0x52, 0x08,
-0x47, 0x23, 0x67, 0x88, 0x47, 0xEE, 0x6E, 0x88, 0x49, 0x03, 0x49, 0x88, 0x49, 0xCE, 0x50, 0x88,
-0x4A, 0xE3, 0x2B, 0x88, 0x4B, 0xAE, 0x32, 0x88, 0x4C, 0xCC, 0x48, 0x08, 0x4D, 0x8E, 0x14, 0x88,
-0x4E, 0xAC, 0x2A, 0x08, 0x4F, 0x6D, 0xF6, 0x88, 0x50, 0x8C, 0x0C, 0x08, 0x51, 0x57, 0x13, 0x08,
-0x52, 0x6B, 0xEE, 0x08, 0x53, 0x36, 0xF5, 0x08, 0x54, 0x4B, 0xD0, 0x08, 0x55, 0x16, 0xD7, 0x08,
-0x56, 0x2B, 0xB2, 0x08, 0x56, 0xF6, 0xB9, 0x08, 0x58, 0x14, 0xCE, 0x88, 0x58, 0xD6, 0x9B, 0x08,
-0x59, 0xF4, 0xB0, 0x88, 0x5A, 0xB6, 0x7D, 0x08, 0x5B, 0xD4, 0x92, 0x88, 0x5C, 0x9F, 0x99, 0x88,
-0x5D, 0xB4, 0x74, 0x88, 0x5E, 0x7F, 0x7B, 0x88, 0x5F, 0x94, 0x56, 0x88, 0x60, 0x5F, 0x5D, 0x88,
-0x61, 0x7D, 0x73, 0x08, 0x62, 0x3F, 0x3F, 0x88, 0x63, 0x5D, 0x55, 0x08, 0x64, 0x1F, 0x21, 0x88,
-0x65, 0x3D, 0x37, 0x08, 0x66, 0x08, 0x3E, 0x08, 0x67, 0x1D, 0x19, 0x08, 0x67, 0xE8, 0x20, 0x08,
-0x68, 0xFC, 0xFB, 0x08, 0x69, 0xC8, 0x02, 0x08, 0x6A, 0xDC, 0xDD, 0x08, 0x6B, 0xA7, 0xE4, 0x08,
-0x6C, 0xC5, 0xF9, 0x88, 0x6D, 0x87, 0xC6, 0x08, 0x6E, 0xA5, 0xDB, 0x88, 0x6F, 0x67, 0xA8, 0x08,
-0x70, 0x85, 0xBD, 0x88, 0x71, 0x50, 0xC4, 0x88, 0x72, 0x65, 0x9F, 0x88, 0x73, 0x30, 0xA6, 0x88,
-0x74, 0x45, 0x81, 0x88, 0x75, 0x10, 0x88, 0x88, 0x76, 0x2E, 0x9E, 0x08, 0x76, 0xF0, 0x6A, 0x88,
-0x78, 0x0E, 0x80, 0x08, 0x78, 0xD0, 0x4C, 0x88, 0x79, 0xEE, 0x62, 0x08, 0x7A, 0xB0, 0x2E, 0x88,
-0x7B, 0xCE, 0x44, 0x08, 0x7C, 0x99, 0x4B, 0x08, 0x7D, 0xAE, 0x26, 0x08, 0x7E, 0x79, 0x2D, 0x08,
-0x7F, 0x8E, 0x08, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
+0x47, 0x23, 0x67, 0x88, 0x47, 0xF7, 0xA9, 0x08, 0x48, 0xE7, 0x9A, 0x08, 0x49, 0xD7, 0x8B, 0x08,
+0x4A, 0xC7, 0x7C, 0x08, 0x4B, 0xB7, 0x6D, 0x08, 0x4C, 0xA7, 0x5E, 0x08, 0x4D, 0x97, 0x4F, 0x08,
+0x4E, 0x87, 0x40, 0x08, 0x4F, 0x77, 0x31, 0x08, 0x50, 0x70, 0x5C, 0x88, 0x51, 0x60, 0x4D, 0x88,
+0x52, 0x50, 0x3E, 0x88, 0x53, 0x40, 0x2F, 0x88, 0x54, 0x30, 0x20, 0x88, 0x55, 0x20, 0x11, 0x88,
+0x56, 0x10, 0x02, 0x88, 0x56, 0xFF, 0xF3, 0x88, 0x57, 0xEF, 0xE4, 0x88, 0x58, 0xDF, 0xD5, 0x88,
+0x59, 0xCF, 0xC6, 0x88, 0x5A, 0xBF, 0xB7, 0x88, 0x5B, 0xB8, 0xE3, 0x08, 0x5C, 0xA8, 0xD4, 0x08,
+0x5D, 0x98, 0xC5, 0x08, 0x5E, 0x88, 0xB6, 0x08, 0x5F, 0x78, 0xA7, 0x08, 0x60, 0x68, 0x98, 0x08,
+0x61, 0x58, 0x89, 0x08, 0x62, 0x48, 0x7A, 0x08, 0x63, 0x38, 0x6B, 0x08, 0x64, 0x28, 0x5C, 0x08,
+0x65, 0x18, 0x4D, 0x08, 0x66, 0x11, 0x78, 0x88, 0x67, 0x01, 0x69, 0x88, 0x67, 0xF1, 0x5A, 0x88,
+0x68, 0xE1, 0x4B, 0x88, 0x69, 0xD1, 0x3C, 0x88, 0x6A, 0xC1, 0x2D, 0x88, 0x6B, 0xB1, 0x1E, 0x88,
+0x6C, 0xA1, 0x0F, 0x88, 0x6D, 0x91, 0x00, 0x88, 0x6E, 0x80, 0xF1, 0x88, 0x6F, 0x70, 0xE2, 0x88,
+0x70, 0x6A, 0x0E, 0x08, 0x71, 0x59, 0xFF, 0x08, 0x72, 0x49, 0xF0, 0x08, 0x73, 0x39, 0xE1, 0x08,
+0x74, 0x29, 0xD2, 0x08, 0x75, 0x19, 0xC3, 0x08, 0x76, 0x09, 0xB4, 0x08, 0x76, 0xF9, 0xA5, 0x08,
+0x77, 0xE9, 0x96, 0x08, 0x78, 0xD9, 0x87, 0x08, 0x79, 0xC9, 0x78, 0x08, 0x7A, 0xB9, 0x69, 0x08,
+0x7B, 0xB2, 0x94, 0x88, 0x7C, 0xA2, 0x85, 0x88, 0x7D, 0x92, 0x76, 0x88, 0x7E, 0x82, 0x67, 0x88,
+0x7F, 0x72, 0x58, 0x88, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
@@ -9879,22 +9941,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x39, 0xDF, 0xE3, 0x30, 0x3A, 0x8F, 0x2C, 0xA0, 0x3B, 0xC8, 0xFF, 0xB0, 0x3C, 0x6F, 0x0E, 0xA0,
0x3D, 0xC4, 0x91, 0x30, 0x3E, 0x4E, 0xF0, 0xA0, 0x3F, 0x91, 0xFE, 0x30, 0x40, 0x2E, 0xD2, 0xA0,
0x41, 0x86, 0xF8, 0x30, 0x42, 0x17, 0xEF, 0x20, 0x43, 0x51, 0xC2, 0x30, 0x43, 0xF7, 0xD1, 0x20,
-0x45, 0x4D, 0x53, 0xB0, 0x45, 0xE0, 0xED, 0xA0, 0x47, 0x2D, 0x35, 0xB0, 0x47, 0xC0, 0xCF, 0xA0,
-0x49, 0x0D, 0x17, 0xB0, 0x49, 0xA0, 0xB1, 0xA0, 0x4A, 0xEC, 0xF9, 0xB0, 0x4B, 0x89, 0xCE, 0x20,
-0x4C, 0xD6, 0x16, 0x30, 0x4D, 0x69, 0xB0, 0x20, 0x4E, 0xB5, 0xF8, 0x30, 0x4F, 0x49, 0x92, 0x20,
-0x50, 0x95, 0xDA, 0x30, 0x51, 0x29, 0x74, 0x20, 0x52, 0x75, 0xBC, 0x30, 0x53, 0x09, 0x56, 0x20,
-0x54, 0x55, 0x9E, 0x30, 0x54, 0xE9, 0x38, 0x20, 0x56, 0x35, 0x80, 0x30, 0x56, 0xD2, 0x54, 0xA0,
-0x58, 0x1E, 0x9C, 0xB0, 0x58, 0xB2, 0x36, 0xA0, 0x59, 0xFE, 0x7E, 0xB0, 0x5A, 0x92, 0x18, 0xA0,
-0x5B, 0xDE, 0x60, 0xB0, 0x5C, 0x71, 0xFA, 0xA0, 0x5D, 0xBE, 0x42, 0xB0, 0x5E, 0x51, 0xDC, 0xA0,
-0x5F, 0x9E, 0x24, 0xB0, 0x60, 0x3A, 0xF9, 0x20, 0x61, 0x87, 0x41, 0x30, 0x62, 0x1A, 0xDB, 0x20,
-0x63, 0x67, 0x23, 0x30, 0x63, 0xFA, 0xBD, 0x20, 0x65, 0x47, 0x05, 0x30, 0x65, 0xDA, 0x9F, 0x20,
-0x67, 0x26, 0xE7, 0x30, 0x67, 0xBA, 0x81, 0x20, 0x69, 0x06, 0xC9, 0x30, 0x69, 0x9A, 0x63, 0x20,
-0x6A, 0xE6, 0xAB, 0x30, 0x6B, 0x83, 0x7F, 0xA0, 0x6C, 0xCF, 0xC7, 0xB0, 0x6D, 0x63, 0x61, 0xA0,
-0x6E, 0xAF, 0xA9, 0xB0, 0x6F, 0x43, 0x43, 0xA0, 0x70, 0x8F, 0x8B, 0xB0, 0x71, 0x23, 0x25, 0xA0,
-0x72, 0x6F, 0x6D, 0xB0, 0x73, 0x03, 0x07, 0xA0, 0x74, 0x4F, 0x4F, 0xB0, 0x74, 0xEC, 0x24, 0x20,
-0x76, 0x38, 0x6C, 0x30, 0x76, 0xCC, 0x06, 0x20, 0x78, 0x18, 0x4E, 0x30, 0x78, 0xAB, 0xE8, 0x20,
-0x79, 0xF8, 0x30, 0x30, 0x7A, 0x8B, 0xCA, 0x20, 0x7B, 0xD8, 0x12, 0x30, 0x7C, 0x6B, 0xAC, 0x20,
-0x7D, 0xB7, 0xF4, 0x30, 0x7E, 0x4B, 0x8E, 0x20, 0x7F, 0x97, 0xD6, 0x30, 0x02, 0x01, 0x02, 0x01,
+0x45, 0x4D, 0x53, 0xB0, 0x45, 0xE0, 0xED, 0xA0, 0x47, 0x11, 0x86, 0x30, 0x47, 0xB7, 0x95, 0x20,
+0x48, 0xF1, 0x68, 0x30, 0x49, 0x97, 0x77, 0x20, 0x4A, 0xD1, 0x4A, 0x30, 0x4B, 0x80, 0x93, 0xA0,
+0x4C, 0xB1, 0x2C, 0x30, 0x4D, 0x60, 0x75, 0xA0, 0x4E, 0x91, 0x0E, 0x30, 0x4F, 0x40, 0x57, 0xA0,
+0x50, 0x7A, 0x2A, 0xB0, 0x51, 0x20, 0x39, 0xA0, 0x52, 0x5A, 0x0C, 0xB0, 0x53, 0x00, 0x1B, 0xA0,
+0x54, 0x39, 0xEE, 0xB0, 0x54, 0xDF, 0xFD, 0xA0, 0x56, 0x19, 0xD0, 0xB0, 0x56, 0xC9, 0x1A, 0x20,
+0x57, 0xF9, 0xB2, 0xB0, 0x58, 0xA8, 0xFC, 0x20, 0x59, 0xD9, 0x94, 0xB0, 0x5A, 0x88, 0xDE, 0x20,
+0x5B, 0xC2, 0xB1, 0x30, 0x5C, 0x68, 0xC0, 0x20, 0x5D, 0xA2, 0x93, 0x30, 0x5E, 0x48, 0xA2, 0x20,
+0x5F, 0x82, 0x75, 0x30, 0x60, 0x31, 0xBE, 0xA0, 0x61, 0x62, 0x57, 0x30, 0x62, 0x11, 0xA0, 0xA0,
+0x63, 0x42, 0x39, 0x30, 0x63, 0xF1, 0x82, 0xA0, 0x65, 0x22, 0x1B, 0x30, 0x65, 0xD1, 0x64, 0xA0,
+0x67, 0x0B, 0x37, 0xB0, 0x67, 0xB1, 0x46, 0xA0, 0x68, 0xEB, 0x19, 0xB0, 0x69, 0x91, 0x28, 0xA0,
+0x6A, 0xCA, 0xFB, 0xB0, 0x6B, 0x7A, 0x45, 0x20, 0x6C, 0xAA, 0xDD, 0xB0, 0x6D, 0x5A, 0x27, 0x20,
+0x6E, 0x8A, 0xBF, 0xB0, 0x6F, 0x3A, 0x09, 0x20, 0x70, 0x73, 0xDC, 0x30, 0x71, 0x19, 0xEB, 0x20,
+0x72, 0x53, 0xBE, 0x30, 0x72, 0xF9, 0xCD, 0x20, 0x74, 0x33, 0xA0, 0x30, 0x74, 0xD9, 0xAF, 0x20,
+0x76, 0x13, 0x82, 0x30, 0x76, 0xC2, 0xCB, 0xA0, 0x77, 0xF3, 0x64, 0x30, 0x78, 0xA2, 0xAD, 0xA0,
+0x79, 0xD3, 0x46, 0x30, 0x7A, 0x82, 0x8F, 0xA0, 0x7B, 0xBC, 0x62, 0xB0, 0x7C, 0x62, 0x71, 0xA0,
+0x7D, 0x9C, 0x44, 0xB0, 0x7E, 0x42, 0x53, 0xA0, 0x7F, 0x7C, 0x26, 0xB0, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -10707,22 +10769,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x36, 0xFD, 0xB7, 0x50, 0x38, 0x1B, 0xCC, 0xD0, 0x38, 0xE6, 0xD3, 0xD0, 0x39, 0xFB, 0xAE, 0xD0,
0x3A, 0xC6, 0xB5, 0xD0, 0x3B, 0xDB, 0x90, 0xD0, 0x3C, 0xAF, 0xD2, 0x50, 0x3D, 0xBB, 0x72, 0xD0,
0x3E, 0x8F, 0xB4, 0x50, 0x3F, 0x9B, 0x54, 0xD0, 0x40, 0x6F, 0x96, 0x50, 0x45, 0x44, 0x35, 0x50,
-0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x2D, 0x51, 0xD0, 0x47, 0xD3, 0x6E, 0xD0, 0x49, 0x0D, 0x33, 0xD0,
-0x49, 0xB3, 0x50, 0xD0, 0x4A, 0xED, 0x15, 0xD0, 0x4B, 0x9C, 0x6D, 0x50, 0x4C, 0xD6, 0x32, 0x50,
-0x4D, 0x7C, 0x4F, 0x50, 0x4E, 0xB6, 0x14, 0x50, 0x4F, 0x5C, 0x31, 0x50, 0x50, 0x95, 0xF6, 0x50,
-0x51, 0x3C, 0x13, 0x50, 0x52, 0x75, 0xD8, 0x50, 0x53, 0x1B, 0xF5, 0x50, 0x54, 0x55, 0xBA, 0x50,
-0x54, 0xFB, 0xD7, 0x50, 0x56, 0x35, 0x9C, 0x50, 0x56, 0xE4, 0xF3, 0xD0, 0x58, 0x1E, 0xB8, 0xD0,
-0x58, 0xC4, 0xD5, 0xD0, 0x59, 0xFE, 0x9A, 0xD0, 0x5A, 0xA4, 0xB7, 0xD0, 0x5B, 0xDE, 0x7C, 0xD0,
-0x5C, 0x84, 0x99, 0xD0, 0x5D, 0xBE, 0x5E, 0xD0, 0x5E, 0x64, 0x7B, 0xD0, 0x5F, 0x9E, 0x40, 0xD0,
-0x60, 0x4D, 0x98, 0x50, 0x61, 0x87, 0x5D, 0x50, 0x62, 0x2D, 0x7A, 0x50, 0x63, 0x67, 0x3F, 0x50,
-0x64, 0x0D, 0x5C, 0x50, 0x65, 0x47, 0x21, 0x50, 0x65, 0xED, 0x3E, 0x50, 0x67, 0x27, 0x03, 0x50,
-0x67, 0xCD, 0x20, 0x50, 0x69, 0x06, 0xE5, 0x50, 0x69, 0xAD, 0x02, 0x50, 0x6A, 0xE6, 0xC7, 0x50,
-0x6B, 0x96, 0x1E, 0xD0, 0x6C, 0xCF, 0xE3, 0xD0, 0x6D, 0x76, 0x00, 0xD0, 0x6E, 0xAF, 0xC5, 0xD0,
-0x6F, 0x55, 0xE2, 0xD0, 0x70, 0x8F, 0xA7, 0xD0, 0x71, 0x35, 0xC4, 0xD0, 0x72, 0x6F, 0x89, 0xD0,
-0x73, 0x15, 0xA6, 0xD0, 0x74, 0x4F, 0x6B, 0xD0, 0x74, 0xFE, 0xC3, 0x50, 0x76, 0x38, 0x88, 0x50,
-0x76, 0xDE, 0xA5, 0x50, 0x78, 0x18, 0x6A, 0x50, 0x78, 0xBE, 0x87, 0x50, 0x79, 0xF8, 0x4C, 0x50,
-0x7A, 0x9E, 0x69, 0x50, 0x7B, 0xD8, 0x2E, 0x50, 0x7C, 0x7E, 0x4B, 0x50, 0x7D, 0xB8, 0x10, 0x50,
-0x7E, 0x5E, 0x2D, 0x50, 0x7F, 0x97, 0xF2, 0x50, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
+0x45, 0xF3, 0x8C, 0xD0, 0x47, 0x24, 0x17, 0x50, 0x47, 0xD3, 0x6E, 0xD0, 0x49, 0x03, 0xF9, 0x50,
+0x49, 0xB3, 0x50, 0xD0, 0x4A, 0xE3, 0xDB, 0x50, 0x4B, 0x9C, 0x6D, 0x50, 0x4C, 0xCC, 0xF7, 0xD0,
+0x4D, 0x7C, 0x4F, 0x50, 0x4E, 0xAC, 0xD9, 0xD0, 0x4F, 0x5C, 0x31, 0x50, 0x50, 0x8C, 0xBB, 0xD0,
+0x51, 0x3C, 0x13, 0x50, 0x52, 0x6C, 0x9D, 0xD0, 0x53, 0x1B, 0xF5, 0x50, 0x54, 0x4C, 0x7F, 0xD0,
+0x54, 0xFB, 0xD7, 0x50, 0x56, 0x2C, 0x61, 0xD0, 0x56, 0xE4, 0xF3, 0xD0, 0x58, 0x15, 0x7E, 0x50,
+0x58, 0xC4, 0xD5, 0xD0, 0x59, 0xF5, 0x60, 0x50, 0x5A, 0xA4, 0xB7, 0xD0, 0x5B, 0xD5, 0x42, 0x50,
+0x5C, 0x84, 0x99, 0xD0, 0x5D, 0xB5, 0x24, 0x50, 0x5E, 0x64, 0x7B, 0xD0, 0x5F, 0x95, 0x06, 0x50,
+0x60, 0x4D, 0x98, 0x50, 0x61, 0x7E, 0x22, 0xD0, 0x62, 0x2D, 0x7A, 0x50, 0x63, 0x5E, 0x04, 0xD0,
+0x64, 0x0D, 0x5C, 0x50, 0x65, 0x3D, 0xE6, 0xD0, 0x65, 0xED, 0x3E, 0x50, 0x67, 0x1D, 0xC8, 0xD0,
+0x67, 0xCD, 0x20, 0x50, 0x68, 0xFD, 0xAA, 0xD0, 0x69, 0xAD, 0x02, 0x50, 0x6A, 0xDD, 0x8C, 0xD0,
+0x6B, 0x96, 0x1E, 0xD0, 0x6C, 0xC6, 0xA9, 0x50, 0x6D, 0x76, 0x00, 0xD0, 0x6E, 0xA6, 0x8B, 0x50,
+0x6F, 0x55, 0xE2, 0xD0, 0x70, 0x86, 0x6D, 0x50, 0x71, 0x35, 0xC4, 0xD0, 0x72, 0x66, 0x4F, 0x50,
+0x73, 0x15, 0xA6, 0xD0, 0x74, 0x46, 0x31, 0x50, 0x74, 0xFE, 0xC3, 0x50, 0x76, 0x2F, 0x4D, 0xD0,
+0x76, 0xDE, 0xA5, 0x50, 0x78, 0x0F, 0x2F, 0xD0, 0x78, 0xBE, 0x87, 0x50, 0x79, 0xEF, 0x11, 0xD0,
+0x7A, 0x9E, 0x69, 0x50, 0x7B, 0xCE, 0xF3, 0xD0, 0x7C, 0x7E, 0x4B, 0x50, 0x7D, 0xAE, 0xD5, 0xD0,
+0x7E, 0x5E, 0x2D, 0x50, 0x7F, 0x8E, 0xB7, 0xD0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01,
@@ -10814,22 +10876,22 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x3B, 0xB3, 0x93, 0x50, 0x3C, 0xC8, 0x7C, 0x60, 0x3D, 0x93, 0x75, 0x50, 0x3E, 0xA8, 0x5E, 0x60,
0x3F, 0x73, 0x57, 0x50, 0x40, 0x91, 0x7A, 0xE0, 0x41, 0x5C, 0x73, 0xD0, 0x42, 0x71, 0x5C, 0xE0,
0x43, 0x3C, 0x55, 0xD0, 0x44, 0x51, 0x3E, 0xE0, 0x45, 0x12, 0xFD, 0x50, 0x46, 0x31, 0x20, 0xE0,
-0x46, 0xFC, 0x19, 0xD0, 0x48, 0x11, 0x02, 0xE0, 0x48, 0xDB, 0xFB, 0xD0, 0x49, 0xF0, 0xE4, 0xE0,
-0x4A, 0xBB, 0xDD, 0xD0, 0x4B, 0xDA, 0x01, 0x60, 0x4C, 0xA4, 0xFA, 0x50, 0x4D, 0xB9, 0xE3, 0x60,
-0x4E, 0x84, 0xDC, 0x50, 0x4F, 0x99, 0xC5, 0x60, 0x50, 0x64, 0xBE, 0x50, 0x51, 0x79, 0xA7, 0x60,
-0x52, 0x44, 0xA0, 0x50, 0x53, 0x59, 0x89, 0x60, 0x54, 0x24, 0x82, 0x50, 0x55, 0x39, 0x6B, 0x60,
-0x56, 0x04, 0x64, 0x50, 0x57, 0x22, 0x87, 0xE0, 0x57, 0xED, 0x80, 0xD0, 0x59, 0x02, 0x69, 0xE0,
-0x59, 0xCD, 0x62, 0xD0, 0x5A, 0xE2, 0x4B, 0xE0, 0x5B, 0xAD, 0x44, 0xD0, 0x5C, 0xC2, 0x2D, 0xE0,
-0x5D, 0x8D, 0x26, 0xD0, 0x5E, 0xA2, 0x0F, 0xE0, 0x5F, 0x6D, 0x08, 0xD0, 0x60, 0x8B, 0x2C, 0x60,
-0x61, 0x56, 0x25, 0x50, 0x62, 0x6B, 0x0E, 0x60, 0x63, 0x36, 0x07, 0x50, 0x64, 0x4A, 0xF0, 0x60,
-0x65, 0x15, 0xE9, 0x50, 0x66, 0x2A, 0xD2, 0x60, 0x66, 0xF5, 0xCB, 0x50, 0x68, 0x0A, 0xB4, 0x60,
-0x68, 0xD5, 0xAD, 0x50, 0x69, 0xEA, 0x96, 0x60, 0x6A, 0xB5, 0x8F, 0x50, 0x6B, 0xD3, 0xB2, 0xE0,
-0x6C, 0x9E, 0xAB, 0xD0, 0x6D, 0xB3, 0x94, 0xE0, 0x6E, 0x7E, 0x8D, 0xD0, 0x6F, 0x93, 0x76, 0xE0,
-0x70, 0x5E, 0x6F, 0xD0, 0x71, 0x73, 0x58, 0xE0, 0x72, 0x3E, 0x51, 0xD0, 0x73, 0x53, 0x3A, 0xE0,
-0x74, 0x1E, 0x33, 0xD0, 0x75, 0x3C, 0x57, 0x60, 0x76, 0x07, 0x50, 0x50, 0x77, 0x1C, 0x39, 0x60,
-0x77, 0xE7, 0x32, 0x50, 0x78, 0xFC, 0x1B, 0x60, 0x79, 0xC7, 0x14, 0x50, 0x7A, 0xDB, 0xFD, 0x60,
-0x7B, 0xA6, 0xF6, 0x50, 0x7C, 0xBB, 0xDF, 0x60, 0x7D, 0x86, 0xD8, 0x50, 0x7E, 0x9B, 0xC1, 0x60,
-0x7F, 0x66, 0xBA, 0x50, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+0x46, 0xE0, 0x6A, 0x50, 0x48, 0x11, 0x02, 0xE0, 0x48, 0xB7, 0x11, 0xD0, 0x49, 0xF0, 0xE4, 0xE0,
+0x4A, 0x96, 0xF3, 0xD0, 0x4B, 0xDA, 0x01, 0x60, 0x4C, 0x76, 0xD5, 0xD0, 0x4D, 0xB9, 0xE3, 0x60,
+0x4E, 0x56, 0xB7, 0xD0, 0x4F, 0x99, 0xC5, 0x60, 0x50, 0x3F, 0xD4, 0x50, 0x51, 0x79, 0xA7, 0x60,
+0x52, 0x1F, 0xB6, 0x50, 0x53, 0x59, 0x89, 0x60, 0x53, 0xFF, 0x98, 0x50, 0x55, 0x39, 0x6B, 0x60,
+0x55, 0xDF, 0x7A, 0x50, 0x57, 0x22, 0x87, 0xE0, 0x57, 0xBF, 0x5C, 0x50, 0x59, 0x02, 0x69, 0xE0,
+0x59, 0xA8, 0x78, 0xD0, 0x5A, 0xE2, 0x4B, 0xE0, 0x5B, 0x88, 0x5A, 0xD0, 0x5C, 0xC2, 0x2D, 0xE0,
+0x5D, 0x68, 0x3C, 0xD0, 0x5E, 0xA2, 0x0F, 0xE0, 0x5F, 0x48, 0x1E, 0xD0, 0x60, 0x8B, 0x2C, 0x60,
+0x61, 0x28, 0x00, 0xD0, 0x62, 0x6B, 0x0E, 0x60, 0x63, 0x07, 0xE2, 0xD0, 0x64, 0x4A, 0xF0, 0x60,
+0x64, 0xF0, 0xFF, 0x50, 0x66, 0x2A, 0xD2, 0x60, 0x66, 0xD0, 0xE1, 0x50, 0x68, 0x0A, 0xB4, 0x60,
+0x68, 0xB0, 0xC3, 0x50, 0x69, 0xEA, 0x96, 0x60, 0x6A, 0x90, 0xA5, 0x50, 0x6B, 0xD3, 0xB2, 0xE0,
+0x6C, 0x70, 0x87, 0x50, 0x6D, 0xB3, 0x94, 0xE0, 0x6E, 0x59, 0xA3, 0xD0, 0x6F, 0x93, 0x76, 0xE0,
+0x70, 0x39, 0x85, 0xD0, 0x71, 0x73, 0x58, 0xE0, 0x72, 0x19, 0x67, 0xD0, 0x73, 0x53, 0x3A, 0xE0,
+0x73, 0xF9, 0x49, 0xD0, 0x75, 0x3C, 0x57, 0x60, 0x75, 0xD9, 0x2B, 0xD0, 0x77, 0x1C, 0x39, 0x60,
+0x77, 0xB9, 0x0D, 0xD0, 0x78, 0xFC, 0x1B, 0x60, 0x79, 0xA2, 0x2A, 0x50, 0x7A, 0xDB, 0xFD, 0x60,
+0x7B, 0x82, 0x0C, 0x50, 0x7C, 0xBB, 0xDF, 0x60, 0x7D, 0x61, 0xEE, 0x50, 0x7E, 0x9B, 0xC1, 0x60,
+0x7F, 0x41, 0xD0, 0x50, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
@@ -14909,7 +14971,7 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
/* Iran */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x9A, 0x6C, 0x7D, 0xC8,
+0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x12, 0x9A, 0x6C, 0x7D, 0xC8,
0xD2, 0xDB, 0x12, 0xC8, 0x0E, 0xBB, 0xA2, 0x48, 0x0F, 0x74, 0x2D, 0x40, 0x10, 0x8E, 0x40, 0x30,
0x10, 0xED, 0x3A, 0x40, 0x11, 0x55, 0x67, 0xC8, 0x12, 0x45, 0x4A, 0xB8, 0x13, 0x37, 0xEC, 0xC8,
0x14, 0x2D, 0x15, 0xB8, 0x28, 0x20, 0x76, 0xC8, 0x28, 0xDB, 0x9D, 0xB8, 0x29, 0xCB, 0x9C, 0xC8,
@@ -14919,14 +14981,33 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x36, 0x06, 0xA9, 0x38, 0x36, 0xF5, 0x56, 0xC8, 0x37, 0xE7, 0xDC, 0xB8, 0x38, 0xD6, 0x8A, 0x48,
0x39, 0xC9, 0x10, 0x38, 0x3A, 0xB9, 0x0F, 0x48, 0x3B, 0xAB, 0x95, 0x38, 0x3C, 0x9A, 0x42, 0xC8,
0x3D, 0x8C, 0xC8, 0xB8, 0x3E, 0x7B, 0x76, 0x48, 0x3F, 0x6D, 0xFC, 0x38, 0x40, 0x5C, 0xA9, 0xC8,
-0x41, 0x4F, 0x2F, 0xB8, 0x42, 0x3F, 0x2E, 0xC8, 0x43, 0x31, 0xB4, 0xB8, 0x01, 0x02, 0x04, 0x03,
+0x41, 0x4F, 0x2F, 0xB8, 0x42, 0x3F, 0x2E, 0xC8, 0x43, 0x31, 0xB4, 0xB8, 0x47, 0xE2, 0xC9, 0x48,
+0x48, 0xD5, 0x4F, 0x38, 0x49, 0xC5, 0x4E, 0x48, 0x4A, 0xB7, 0xD4, 0x38, 0x4B, 0xA6, 0x81, 0xC8,
+0x4C, 0x99, 0x07, 0xB8, 0x4D, 0x87, 0xB5, 0x48, 0x4E, 0x7A, 0x3B, 0x38, 0x4F, 0x68, 0xE8, 0xC8,
+0x50, 0x5B, 0x6E, 0xB8, 0x51, 0x4B, 0x6D, 0xC8, 0x52, 0x3D, 0xF3, 0xB8, 0x53, 0x2C, 0xA1, 0x48,
+0x54, 0x1F, 0x27, 0x38, 0x55, 0x0D, 0xD4, 0xC8, 0x56, 0x00, 0x5A, 0xB8, 0x56, 0xEF, 0x08, 0x48,
+0x57, 0xE1, 0x8E, 0x38, 0x58, 0xD1, 0x8D, 0x48, 0x59, 0xC4, 0x13, 0x38, 0x5A, 0xB2, 0xC0, 0xC8,
+0x5B, 0xA5, 0x46, 0xB8, 0x5C, 0x93, 0xF4, 0x48, 0x5D, 0x86, 0x7A, 0x38, 0x5E, 0x75, 0x27, 0xC8,
+0x5F, 0x67, 0xAD, 0xB8, 0x60, 0x57, 0xAC, 0xC8, 0x61, 0x4A, 0x32, 0xB8, 0x62, 0x38, 0xE0, 0x48,
+0x63, 0x2B, 0x66, 0x38, 0x64, 0x1A, 0x13, 0xC8, 0x65, 0x0C, 0x99, 0xB8, 0x65, 0xFB, 0x47, 0x48,
+0x66, 0xED, 0xCD, 0x38, 0x67, 0xDD, 0xCC, 0x48, 0x68, 0xD0, 0x52, 0x38, 0x69, 0xBE, 0xFF, 0xC8,
+0x6A, 0xB1, 0x85, 0xB8, 0x6B, 0xA0, 0x33, 0x48, 0x6C, 0x92, 0xB9, 0x38, 0x6D, 0x81, 0x66, 0xC8,
+0x6E, 0x73, 0xEC, 0xB8, 0x6F, 0x62, 0x9A, 0x48, 0x70, 0x55, 0x20, 0x38, 0x71, 0x45, 0x1F, 0x48,
+0x72, 0x37, 0xA5, 0x38, 0x73, 0x26, 0x52, 0xC8, 0x74, 0x18, 0xD8, 0xB8, 0x75, 0x07, 0x86, 0x48,
+0x75, 0xFA, 0x0C, 0x38, 0x76, 0xE8, 0xB9, 0xC8, 0x77, 0xDB, 0x3F, 0xB8, 0x78, 0xCB, 0x3E, 0xC8,
+0x79, 0xBD, 0xC4, 0xB8, 0x7A, 0xAC, 0x72, 0x48, 0x7B, 0x9E, 0xF8, 0x38, 0x7C, 0x8D, 0xA5, 0xC8,
+0x7D, 0x80, 0x2B, 0xB8, 0x7E, 0x6E, 0xD9, 0x48, 0x7F, 0x61, 0x5F, 0x38, 0x01, 0x02, 0x04, 0x03,
0x04, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
-0x05, 0x02, 0x05, 0x02, 0x00, 0x00, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x38, 0x00, 0x04,
-0x00, 0x00, 0x31, 0x38, 0x00, 0x08, 0x00, 0x00, 0x46, 0x50, 0x01, 0x0D, 0x00, 0x00, 0x38, 0x40,
-0x00, 0x08, 0x00, 0x00, 0x3F, 0x48, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x54, 0x4D, 0x54, 0x00,
-0x49, 0x52, 0x53, 0x54, 0x00, 0x49, 0x52, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02, 0x05, 0x02,
+0x00, 0x00, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x38, 0x00, 0x04, 0x00, 0x00, 0x31, 0x38,
+0x00, 0x08, 0x00, 0x00, 0x46, 0x50, 0x01, 0x0D, 0x00, 0x00, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00,
+0x3F, 0x48, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x54, 0x4D, 0x54, 0x00, 0x49, 0x52, 0x53, 0x54,
+0x00, 0x49, 0x52, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00,
/* Israel */
0x54, 0x5A, 0x69, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -16986,4 +17067,4 @@ const unsigned char timelib_timezone_db_data_builtin[240789] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, };
-const timelib_tzdb timezonedb_builtin = { "2007.6", 551, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+const timelib_tzdb timezonedb_builtin = { "2007.9", 552, timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
diff --git a/ext/date/tests/bug20382-2.phpt b/ext/date/tests/bug20382-2.phpt
index 639f1b799..2026ed44d 100644
--- a/ext/date/tests/bug20382-2.phpt
+++ b/ext/date/tests/bug20382-2.phpt
@@ -90,7 +90,7 @@ result = Monday 1970-01-05 00:00:00 WAT
wanted = Monday 00:00:00
Antarctica/McMurdo
-ts = Monday 2037-09-28 17:17:17 NZST
+ts = Monday 2037-09-28 17:17:17 NZDT
result = Monday 2037-10-05 00:00:00 NZDT
wanted = Monday 00:00:00
diff --git a/ext/date/tests/bug34304.phpt b/ext/date/tests/bug34304.phpt
index a2b26a14c..88030b7be 100644
--- a/ext/date/tests/bug34304.phpt
+++ b/ext/date/tests/bug34304.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #34304 ()
+Bug #34304 (date('w') returns wrong number for sunday, 'N' modifier is missing)
--FILE--
<?php
date_default_timezone_set("UTC");
diff --git a/ext/date/tests/bug35885.phpt b/ext/date/tests/bug35885.phpt
index 60fc2ca69..b3074f7f3 100644
--- a/ext/date/tests/bug35885.phpt
+++ b/ext/date/tests/bug35885.phpt
@@ -4,8 +4,9 @@ Bug #35885 (strtotime("NOW") no longer works)
<?php
date_default_timezone_set("UTC");
-$ts = date(DATE_ISO8601, strtotime('NOW'));
-$ts2 = date(DATE_ISO8601, time());
+$time = time();
+$ts = date(DATE_ISO8601, strtotime('NOW', $time));
+$ts2 = date(DATE_ISO8601, $time);
$res = ($ts == $ts2);
var_dump($res);
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 78e32988a..e84185e8e 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.73.2.12.2.11 2007/08/06 16:22:24 rrichards Exp $ */
+/* $Id: php_dom.c,v 1.73.2.12.2.12 2007/08/30 16:32:34 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -943,6 +943,7 @@ void node_list_unlink(xmlNodePtr node TSRMLS_DC)
case XML_DOCUMENT_TYPE_NODE:
case XML_ENTITY_DECL:
case XML_ATTRIBUTE_NODE:
+ case XML_TEXT_NODE:
break;
default:
node_list_unlink((xmlNodePtr) node->properties TSRMLS_CC);
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index d933ff2e9..b12a7ecf9 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.312.2.20.2.31 2007/08/29 06:26:30 pajoye Exp $ */
+/* $Id: gd.c,v 1.312.2.20.2.32 2007/09/11 21:03:48 pajoye Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -5178,8 +5178,9 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
zval *SIM;
gdImagePtr im_src;
long r,g,b,tmp;
+ long a = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &SIM, &tmp, &r, &g, &b) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) {
RETURN_FALSE;
}
@@ -5189,7 +5190,7 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
RETURN_FALSE;
}
- if (gdImageColor(im_src, (int) r, (int) g, (int) b) == 1) {
+ if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) {
RETURN_TRUE;
}
@@ -5298,7 +5299,7 @@ PHP_FUNCTION(imagefilter)
php_image_filter_smooth
};
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 5) {
+ if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 6) {
WRONG_PARAM_COUNT;
} else if (zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) {
return;
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index 301072f4e..cfb50d4ef 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -2050,14 +2050,14 @@ done:
static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
{
- int l, x1, x2, dy;
+ int i, l, x1, x2, dy;
int oc; /* old pixel value */
int tiled;
int wx2,wy2;
/* stack of filled segments */
struct seg *stack;
struct seg *sp;
- char *pts;
+ char **pts;
if (!im->tile) {
return;
@@ -2067,7 +2067,11 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
tiled = nc==gdTiled;
nc = gdImageTileGet(im,x,y);
- pts = (char *) ecalloc(im->sy * im->sx, sizeof(char));
+
+ pts = (char **) ecalloc(im->sy + 1, sizeof(char *));
+ for (i = 0; i < im->sy + 1; i++) {
+ pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char));
+ }
stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1);
sp = stack;
@@ -2080,9 +2084,9 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
FILL_PUSH(y+1, x, x, -1);
while (sp>stack) {
FILL_POP(y, x1, x2, dy);
- for (x=x1; x>=0 && (!pts[y + x*wx2] && gdImageGetPixel(im,x,y)==oc); x--) {
+ for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) {
nc = gdImageTileGet(im,x,y);
- pts[y + x*wx2]=1;
+ pts[y][x] = 1;
gdImageSetPixel(im,x, y, nc);
}
if (x>=x1) {
@@ -2096,9 +2100,9 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
}
x = x1+1;
do {
- for (; x<wx2 && (!pts[y + x*wx2] && gdImageGetPixel(im,x, y)==oc) ; x++) {
+ for(; x<wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc); x++) {
nc = gdImageTileGet(im,x,y);
- pts[y + x*wx2]=1;
+ pts[y][x] = 1;
gdImageSetPixel(im, x, y, nc);
}
FILL_PUSH(y, l, x-1, dy);
@@ -2106,11 +2110,15 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
if (x>x2+1) {
FILL_PUSH(y, x2+1, x-1, -dy);
}
-skip: for (x++; x<=x2 && (pts[y + x*wx2] || gdImageGetPixel(im,x, y)!=oc); x++);
+skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++);
l = x;
} while (x<=x2);
}
+ for(i = 0; i < im->sy + 1; i++) {
+ efree(pts[i]);
+ }
+
efree(pts);
efree(stack);
}
@@ -2124,6 +2132,11 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
int half1 = 1;
int t;
+ if (x1 == x2 && y1 == y2 && thick == 1) {
+ gdImageSetPixel(im, x1, y1, color);
+ return;
+ }
+
if (y2 < y1) {
t=y1;
y1 = y2;
@@ -3802,15 +3815,14 @@ int gdImageContrast(gdImagePtr src, double contrast)
}
-int gdImageColor(gdImagePtr src, int red, int green, int blue)
+int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha)
{
int x, y;
- int r,g,b,a;
int new_pxl, pxl;
typedef int (*FuncPtr)(gdImagePtr, int, int);
FuncPtr f;
- if (src==NULL || (red<-255||red>255) || (green<-255||green>255) || (blue<-255||blue>255)) {
+ if (src == NULL) {
return 0;
}
@@ -3818,6 +3830,8 @@ int gdImageColor(gdImagePtr src, int red, int green, int blue)
for (y=0; y<src->sy; ++y) {
for (x=0; x<src->sx; ++x) {
+ int r,g,b,a;
+
pxl = f(src, x, y);
r = gdImageRed(src, pxl);
g = gdImageGreen(src, pxl);
@@ -3827,14 +3841,16 @@ int gdImageColor(gdImagePtr src, int red, int green, int blue)
r = r + red;
g = g + green;
b = b + blue;
+ a = a + alpha;
- r = (r > 255)? 255 : ((r < 0)? 0:r);
- g = (g > 255)? 255 : ((g < 0)? 0:g);
- b = (b > 255)? 255 : ((b < 0)? 0:b);
+ r = (r > 255)? 255 : ((r < 0)? 0 : r);
+ g = (g > 255)? 255 : ((g < 0)? 0 : g);
+ b = (b > 255)? 255 : ((b < 0)? 0 : b);
+ a = (a > 127)? 127 : ((a < 0)? 0 : a);
- new_pxl = gdImageColorAllocateAlpha(src, (int)r, (int)g, (int)b, a);
+ new_pxl = gdImageColorAllocateAlpha(src, r, g, b, a);
if (new_pxl == -1) {
- new_pxl = gdImageColorClosestAlpha(src, (int)r, (int)g, (int)b, a);
+ new_pxl = gdImageColorClosestAlpha(src, r, g, b, a);
}
gdImageSetPixel (src, x, y, new_pxl);
}
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index ef6da3c31..7ef2caa48 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -643,7 +643,7 @@ int gdImageBrightness(gdImagePtr src, int brightness);
int gdImageContrast(gdImagePtr src, double contrast);
/* Simply adds or substracts respectively red, green or blue to a pixel */
-int gdImageColor(gdImagePtr src, int red, int green, int blue);
+int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
/* Image convolution by a 3x3 custom matrix */
int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset);
diff --git a/ext/gd/libgd/gd_security.c b/ext/gd/libgd/gd_security.c
index a5fea34c1..897c30253 100644
--- a/ext/gd/libgd/gd_security.c
+++ b/ext/gd/libgd/gd_security.c
@@ -19,12 +19,10 @@
int overflow2(int a, int b)
{
- if(a < 0 || b < 0) {
- php_gd_error("gd warning: one parameter to a memory allocation multiplication is negative, failing operation gracefully\n");
+ if(a <= 0 || b <= 0) {
+ php_gd_error("gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
return 1;
}
- if(b == 0)
- return 0;
if(a > INT_MAX / b) {
php_gd_error("gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
return 1;
diff --git a/ext/gd/tests/bug43121.gif b/ext/gd/tests/bug43121.gif
new file mode 100644
index 000000000..44caffc5e
--- /dev/null
+++ b/ext/gd/tests/bug43121.gif
Binary files differ
diff --git a/ext/gd/tests/bug43121.phpt b/ext/gd/tests/bug43121.phpt
new file mode 100644
index 000000000..ce2d1d6f6
--- /dev/null
+++ b/ext/gd/tests/bug43121.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #43121 (gdImageFill with IMG_COLOR_TILED crashes httpd)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+$im = ImageCreate( 200, 100 );
+$black = ImageColorAllocate( $im, 0, 0, 0 );
+
+$im_tile = ImageCreateFromGif(dirname(__FILE__) . "/bug43121.gif" );
+ImageSetTile( $im, $im_tile );
+ImageFill( $im, 0, 0, IMG_COLOR_TILED );
+
+ImageDestroy( $im );
+
+print "OK";
+?>
+--EXPECTF--
+OK
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index cf638649e..161e7651a 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -17,12 +17,22 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_tiger.c,v 1.4.2.4.2.2 2007/01/08 22:29:25 nlopess Exp $ */
+/* $Id: hash_tiger.c,v 1.4.2.4.2.3 2007/09/04 18:46:21 tony2001 Exp $ */
#include "php_hash.h"
#include "php_hash_tiger.h"
#include "php_hash_tiger_tables.h"
+#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+# if defined(__LITTLE_ENDIAN__)
+# undef WORDS_BIGENDIAN
+# else
+# if defined(__BIG_ENDIAN__)
+# define WORDS_BIGENDIAN
+# endif
+# endif
+#endif
+
/* {{{ */
#define save_abc \
aa = a; \
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index d6149d776..19710c90f 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.124.2.8.2.16 2007/05/19 17:52:30 iliaa Exp $ */
+/* $Id: iconv.c,v 1.124.2.8.2.22 2007/11/01 19:13:49 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -233,12 +233,21 @@ static char _generic_superset_name[] = "UCS-4LE";
#define GENERIC_SUPERSET_NBYTES 4
/* }}} */
+static PHP_INI_MH(OnUpdateStringIconvCharset)
+{
+ if(new_value_length >= ICONV_CSNMAXLEN) {
+ return FAILURE;
+ }
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ return SUCCESS;
+}
+
/* {{{ PHP_INI
*/
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("iconv.input_encoding", ICONV_INPUT_ENCODING, PHP_INI_ALL, OnUpdateString, input_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, PHP_INI_ALL, OnUpdateString, output_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateString, internal_encoding, zend_iconv_globals, iconv_globals)
+ STD_PHP_INI_ENTRY("iconv.input_encoding", ICONV_INPUT_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, input_encoding, zend_iconv_globals, iconv_globals)
+ STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, output_encoding, zend_iconv_globals, iconv_globals)
+ STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, internal_encoding, zend_iconv_globals, iconv_globals)
PHP_INI_END()
/* }}} */
@@ -691,11 +700,16 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
}
}
+ if(len > total_len) {
+ len = total_len;
+ }
+
+
if (offset >= total_len) {
return PHP_ICONV_ERR_SUCCESS;
}
- if ((offset + len) > total_len) {
+ if ((offset + len) > total_len ) {
/* trying to compute the length */
len = total_len - offset;
}
@@ -837,6 +851,9 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval,
cd = iconv_open(GENERIC_SUPERSET_NAME, enc);
if (cd == (iconv_t)(-1)) {
+ if (ndl_buf != NULL) {
+ efree(ndl_buf);
+ }
#if ICONV_SUPPORTS_ERRNO
if (errno == EINVAL) {
return PHP_ICONV_ERR_WRONG_CHARSET;
@@ -1858,7 +1875,7 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset,
PHP_FUNCTION(iconv_strlen)
{
char *charset;
- int charset_len;
+ int charset_len = 0;
char *str;
int str_len;
@@ -1873,6 +1890,11 @@ PHP_FUNCTION(iconv_strlen)
RETURN_FALSE;
}
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
err = _php_iconv_strlen(&retval, str, str_len, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
if (err == PHP_ICONV_ERR_SUCCESS) {
@@ -1888,7 +1910,7 @@ PHP_FUNCTION(iconv_strlen)
PHP_FUNCTION(iconv_substr)
{
char *charset;
- int charset_len;
+ int charset_len = 0;
char *str;
int str_len;
long offset, length;
@@ -1905,6 +1927,11 @@ PHP_FUNCTION(iconv_substr)
RETURN_FALSE;
}
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
if (ZEND_NUM_ARGS() < 3) {
length = str_len;
}
@@ -1925,7 +1952,7 @@ PHP_FUNCTION(iconv_substr)
PHP_FUNCTION(iconv_strpos)
{
char *charset;
- int charset_len;
+ int charset_len = 0;
char *haystk;
int haystk_len;
char *ndl;
@@ -1945,6 +1972,11 @@ PHP_FUNCTION(iconv_strpos)
RETURN_FALSE;
}
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
if (offset < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
RETURN_FALSE;
@@ -1971,7 +2003,7 @@ PHP_FUNCTION(iconv_strpos)
PHP_FUNCTION(iconv_strrpos)
{
char *charset;
- int charset_len;
+ int charset_len = 0;
char *haystk;
int haystk_len;
char *ndl;
@@ -1993,6 +2025,11 @@ PHP_FUNCTION(iconv_strrpos)
RETURN_FALSE;
}
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len,
-1, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC);
@@ -2049,6 +2086,11 @@ PHP_FUNCTION(iconv_mime_encode)
}
if (zend_hash_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset"), (void **)&ppval) == SUCCESS) {
+ if (Z_STRLEN_PP(ppval) >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRLEN_PP(ppval) > 0) {
in_charset = Z_STRVAL_PP(ppval);
}
@@ -2056,6 +2098,11 @@ PHP_FUNCTION(iconv_mime_encode)
if (zend_hash_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset"), (void **)&ppval) == SUCCESS) {
+ if (Z_STRLEN_PP(ppval) >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRLEN_PP(ppval) > 0) {
out_charset = Z_STRVAL_PP(ppval);
}
@@ -2122,7 +2169,7 @@ PHP_FUNCTION(iconv_mime_decode)
char *encoded_str;
int encoded_str_len;
char *charset;
- int charset_len;
+ int charset_len = 0;
long mode = 0;
smart_str retval = {0};
@@ -2137,6 +2184,11 @@ PHP_FUNCTION(iconv_mime_decode)
RETURN_FALSE;
}
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
err = _php_iconv_mime_decode(&retval, encoded_str, encoded_str_len, charset, NULL, mode);
_php_iconv_show_error(err, charset, "???" TSRMLS_CC);
@@ -2160,7 +2212,7 @@ PHP_FUNCTION(iconv_mime_decode_headers)
const char *encoded_str;
int encoded_str_len;
char *charset;
- int charset_len;
+ int charset_len = 0;
long mode = 0;
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
@@ -2173,6 +2225,11 @@ PHP_FUNCTION(iconv_mime_decode_headers)
RETURN_FALSE;
}
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
array_init(return_value);
while (encoded_str_len > 0) {
@@ -2214,12 +2271,10 @@ PHP_FUNCTION(iconv_mime_decode_headers)
}
if (header_name != NULL) {
- zval **elem;
+ zval **elem, *new_elem;
if (zend_hash_find(Z_ARRVAL_P(return_value), header_name, header_name_len, (void **)&elem) == SUCCESS) {
if (Z_TYPE_PP(elem) != IS_ARRAY) {
- zval *new_elem;
-
MAKE_STD_ZVAL(new_elem);
array_init(new_elem);
@@ -2255,13 +2310,18 @@ PHP_NAMED_FUNCTION(php_if_iconv)
{
char *in_charset, *out_charset, *in_buffer, *out_buffer;
size_t out_len;
- int in_charset_len, out_charset_len, in_buffer_len;
+ int in_charset_len = 0, out_charset_len = 0, in_buffer_len;
php_iconv_err_t err;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss",
&in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer, &in_buffer_len) == FAILURE)
return;
+ if (in_charset_len >= ICONV_CSNMAXLEN || out_charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
err = php_iconv_string(in_buffer, (size_t)in_buffer_len,
&out_buffer, &out_len, out_charset, in_charset);
_php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC);
@@ -2330,11 +2390,16 @@ PHP_FUNCTION(ob_iconv_handler)
PHP_FUNCTION(iconv_set_encoding)
{
char *type, *charset;
- int type_len, charset_len, retval;
+ int type_len, charset_len =0, retval;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &type, &type_len, &charset, &charset_len) == FAILURE)
return;
+ if (charset_len >= ICONV_CSNMAXLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
+ RETURN_FALSE;
+ }
+
if(!strcasecmp("input_encoding", type)) {
retval = zend_alter_ini_entry("iconv.input_encoding", sizeof("iconv.input_encoding"), charset, charset_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
} else if(!strcasecmp("output_encoding", type)) {
@@ -2726,6 +2791,10 @@ static php_stream_filter *php_iconv_stream_filter_factory_create(const char *nam
++to_charset;
to_charset_len = strlen(to_charset);
+ if (from_charset_len >= ICONV_CSNMAXLEN || to_charset_len >= ICONV_CSNMAXLEN) {
+ return NULL;
+ }
+
if (NULL == (inst = pemalloc(sizeof(php_iconv_stream_filter), persistent))) {
return NULL;
}
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 4e7feb142..03d17c0e7 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Revision: 1.28.2.2.2.1 $ */
+/* $Revision: 1.28.2.2.2.2 $ */
#ifndef PHP_ICONV_H
#define PHP_ICONV_H
@@ -79,6 +79,10 @@ ZEND_END_MODULE_GLOBALS(iconv)
#define ICONV_OUTPUT_ENCODING "ISO-8859-1"
#define ICONV_INTERNAL_ENCODING "ISO-8859-1"
+#ifndef ICONV_CSNMAXLEN
+#define ICONV_CSNMAXLEN 64
+#endif
+
/* {{{ typedef enum php_iconv_err_t */
typedef enum _php_iconv_err_t {
PHP_ICONV_ERR_SUCCESS = SUCCESS,
diff --git a/ext/iconv/tests/iconv-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..03b3574d6
--- /dev/null
+++ b/ext/iconv/tests/iconv-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,17 @@
+--TEST--
+iconv() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9000000);
+var_dump(iconv($a, "b", "test"));
+var_dump(iconv("x", $a, "test"));
+?>
+--EXPECTF--
+
+Warning: iconv(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
+
+Warning: iconv(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_mime_decode-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv_mime_decode-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..d4ed01d95
--- /dev/null
+++ b/ext/iconv/tests/iconv_mime_decode-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,13 @@
+--TEST--
+iconv_mime_decode() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9000000);
+var_dump(iconv_mime_decode("a", null, $a));
+?>
+--EXPECTF--
+
+Warning: iconv_mime_decode(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_mime_decode_headers-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv_mime_decode_headers-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..48d664d60
--- /dev/null
+++ b/ext/iconv/tests/iconv_mime_decode_headers-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,13 @@
+--TEST--
+iconv_mime_decode_headers() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9000000);
+var_dump(iconv_mime_decode_headers("a", null, $a));
+?>
+--EXPECTF--
+
+Warning: iconv_mime_decode_headers(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_set_encoding-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv_set_encoding-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..e6abca5df
--- /dev/null
+++ b/ext/iconv/tests/iconv_set_encoding-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,21 @@
+--TEST--
+iconv_set_encoding() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9000000);
+var_dump(iconv_set_encoding("input_encoding", $a));
+var_dump(iconv_set_encoding("output_encoding", $a));
+var_dump(iconv_set_encoding("internal_encoding", $a));
+?>
+--EXPECTF--
+
+Warning: iconv_set_encoding(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
+
+Warning: iconv_set_encoding(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
+
+Warning: iconv_set_encoding(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_strlen-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv_strlen-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..348cfb126
--- /dev/null
+++ b/ext/iconv/tests/iconv_strlen-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,13 @@
+--TEST--
+iconv_strlen() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9791999);
+var_dump(iconv_strlen(1, $a));
+?>
+--EXPECTF--
+
+Warning: iconv_strlen(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_strpos-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv_strpos-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..4cb858f0d
--- /dev/null
+++ b/ext/iconv/tests/iconv_strpos-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,13 @@
+--TEST--
+iconv_strpos() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9000000);
+var_dump(iconv_strpos("a", "b", 0, $a));
+?>
+--EXPECTF--
+
+Warning: iconv_strpos(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_strrpos-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/iconv_strrpos-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..948cc67c7
--- /dev/null
+++ b/ext/iconv/tests/iconv_strrpos-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,13 @@
+--TEST--
+iconv_strrpos() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat("/", 9000000);
+var_dump(iconv_strrpos("a", "b", $a));
+?>
+--EXPECTF--
+
+Warning: iconv_strrpos(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/iconv_substr-charset-length-cve-2007-4783.phpt b/ext/iconv/tests/iconv_substr-charset-length-cve-2007-4783.phpt
new file mode 100755
index 000000000..c27e60d1d
--- /dev/null
+++ b/ext/iconv/tests/iconv_substr-charset-length-cve-2007-4783.phpt
@@ -0,0 +1,14 @@
+--TEST--
+iconv_substr() charset parameter length checks (CVE-2007-4783)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+$a = str_repeat('A', 99897);
+$b = str_repeat('/', 2798349);
+var_dump(iconv_substr($a, 0, 1, $b));
+?>
+--EXPECTF--
+
+Warning: iconv_substr(): Charset parameter exceeds the maximum allowed length of %d characters in %s on line %d
+bool(false)
diff --git a/ext/iconv/tests/ob_iconv_handler-charset-length-cve-2007-4840.phpt b/ext/iconv/tests/ob_iconv_handler-charset-length-cve-2007-4840.phpt
new file mode 100755
index 000000000..8cf54b732
--- /dev/null
+++ b/ext/iconv/tests/ob_iconv_handler-charset-length-cve-2007-4840.phpt
@@ -0,0 +1,12 @@
+--TEST--
+ob_iconv_handler() charset parameter length checks (CVE-2007-4840)
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
+--FILE--
+<?php
+ini_set("iconv.output_encoding", str_repeat("a", 9000000));
+ob_start("ob_iconv_handler");
+print "done";
+?>
+--EXPECT--
+done
diff --git a/ext/json/json.c b/ext/json/json.c
index 27394e2d9..393d41f5e 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.9.2.19 2007/07/24 22:57:13 bjori Exp $ */
+/* $Id: json.c,v 1.9.2.20 2007/10/01 15:23:15 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -359,7 +359,7 @@ static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) /* {{{ */
double dbl = Z_DVAL_P(val);
if (!zend_isinf(dbl) && !zend_isnan(dbl)) {
- len = spprintf(&d, 0, "%.*g", (int) EG(precision), dbl);
+ len = spprintf(&d, 0, "%.*k", (int) EG(precision), dbl);
smart_str_appendl(buf, d, len);
efree(d);
} else {
diff --git a/ext/json/tests/bug42785.phpt b/ext/json/tests/bug42785.phpt
new file mode 100644
index 000000000..7bdadbed1
--- /dev/null
+++ b/ext/json/tests/bug42785.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #42785 (Incorrect formatting of double values with non-english locales)
+--SKIPIF--
+<?php
+ if (!extension_loaded("json")) {
+ print "skip";
+ } else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
+ die("skip locale needed for this test is not supported on this platform");
+ }
+?>
+--FILE--
+<?php
+setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
+
+$foo = Array(100.10,"bar");
+var_dump(json_encode($foo));
+
+Class bar {}
+$bar1 = new bar;
+$bar1->a = 100.10;
+$bar1->b = "foo";
+var_dump(json_encode($bar1));
+?>
+--EXPECT--
+string(13) "[100.1,"bar"]"
+string(21) "{"a":100.1,"b":"foo"}"
diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4
index ea60efa6f..a2d607497 100644
--- a/ext/mbstring/config.m4
+++ b/ext/mbstring/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.58.2.4.2.10 2007/07/31 12:23:50 tony2001 Exp $
+dnl $Id: config.m4,v 1.58.2.4.2.11 2007/09/18 21:35:39 hirokawa Exp $
dnl
AC_DEFUN([PHP_MBSTRING_ADD_SOURCES], [
@@ -87,7 +87,7 @@ esac
)
])
- AC_CHECK_HEADERS([stdlib.h string.h strings.h unistd.h sys/time.h sys/times.h])
+ AC_CHECK_HEADERS([stdlib.h string.h strings.h unistd.h sys/time.h sys/times.h stdarg.h])
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(long, 4)
@@ -96,9 +96,6 @@ esac
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
- if test "$cv_php_mbstring_stdarg" = "yes"; then
- AC_DEFINE([HAVE_STDARG_PROTOTYPES], 1, [Define if stdarg.h is available])
- fi
AC_DEFINE([HAVE_MBREGEX], 1, [whether to have multibyte regex support])
diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.h b/ext/mbstring/libmbfl/mbfl/mbfilter.h
index f958e936a..73b7229c2 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfilter.h
+++ b/ext/mbstring/libmbfl/mbfl/mbfilter.h
@@ -104,6 +104,7 @@
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
+#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
/*
* buffering converter
diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c
index 5cac3bdda..f6810738f 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfl_convert.c
+++ b/ext/mbstring/libmbfl/mbfl/mbfl_convert.c
@@ -387,9 +387,14 @@ mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter)
ret = (*filter->filter_function)(filter->illegal_substchar, filter);
break;
case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG:
+ case MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY:
if (c >= 0) {
if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */
- ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"U+");
+ if (mode_backup == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
+ ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"U+");
+ } else { /* entity */
+ ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"&#");
+ }
} else {
if (c < MBFL_WCSGROUP_WCHARMAX) {
m = c & ~MBFL_WCSPLANE_MASK;
@@ -433,6 +438,9 @@ mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter)
if (m == 0 && ret >= 0) {
ret = (*filter->filter_function)(mbfl_hexchar_table[0], filter);
}
+ if (mode_backup == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)";");
+ }
}
}
break;
diff --git a/ext/mbstring/libmbfl/nls/nls_ru.c b/ext/mbstring/libmbfl/nls/nls_ru.c
index 82b7e7ea4..f4d2d2729 100644
--- a/ext/mbstring/libmbfl/nls/nls_ru.c
+++ b/ext/mbstring/libmbfl/nls/nls_ru.c
@@ -1,20 +1,22 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#include "mbfilter.h"
-#include "nls_ru.h"
-
-const mbfl_language mbfl_language_russian = {
- mbfl_no_language_russian,
- "Russian",
- "ru",
- NULL,
- mbfl_no_encoding_koi8r,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit
-};
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
+
+#include "mbfilter.h"
+#include "nls_ru.h"
+
+const mbfl_language mbfl_language_russian = {
+ mbfl_no_language_russian,
+ "Russian",
+ "ru",
+ NULL,
+ mbfl_no_encoding_koi8r,
+ mbfl_no_encoding_qprint,
+ mbfl_no_encoding_8bit
+};
diff --git a/ext/mbstring/libmbfl/nls/nls_ru.h b/ext/mbstring/libmbfl/nls/nls_ru.h
index 51db99815..ba21b9a3d 100644
--- a/ext/mbstring/libmbfl/nls/nls_ru.h
+++ b/ext/mbstring/libmbfl/nls/nls_ru.h
@@ -1,9 +1,9 @@
-#ifndef MBFL_NLS_RU_H
-#define MBFL_NLS_RU_H
-
-#include "mbfilter.h"
-#include "nls_ru.h"
-
-extern const mbfl_language mbfl_language_russian;
-
-#endif /* MBFL_NLS_RU_H */
+#ifndef MBFL_NLS_RU_H
+#define MBFL_NLS_RU_H
+
+#include "mbfilter.h"
+#include "nls_ru.h"
+
+extern const mbfl_language mbfl_language_russian;
+
+#endif /* MBFL_NLS_RU_H */
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 56f2c2f42..d269a2225 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.224.2.22.2.24 2007/07/12 15:31:54 masugata Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.25 2007/09/24 11:51:36 hirokawa Exp $ */
/*
* PHP 4 Multibyte String module "mbstring"
@@ -712,6 +712,9 @@ static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
} else if (strcasecmp("long", new_value) == 0) {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
+ } else if (strcasecmp("entity", new_value) == 0) {
+ MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
+ MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
@@ -1329,6 +1332,8 @@ PHP_FUNCTION(mb_substitute_character)
RETVAL_STRING("none", 1);
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
RETVAL_STRING("long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ RETVAL_STRING("entity", 1);
} else {
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
@@ -1340,6 +1345,8 @@ PHP_FUNCTION(mb_substitute_character)
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
} else if (strcasecmp("long", Z_STRVAL_PP(arg1)) == 0) {
MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
+ } else if (strcasecmp("entity", Z_STRVAL_PP(arg1)) == 0) {
+ MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
convert_to_long_ex(arg1);
if (Z_LVAL_PP(arg1)< 0xffff && Z_LVAL_PP(arg1)> 0x0) {
@@ -3890,6 +3897,8 @@ PHP_FUNCTION(mb_get_info)
add_assoc_string(return_value, "substitute_character", "none", 1);
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
add_assoc_string(return_value, "substitute_character", "long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ add_assoc_string(return_value, "substitute_character", "entity", 1);
} else {
add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar));
}
@@ -3984,6 +3993,8 @@ PHP_FUNCTION(mb_get_info)
RETVAL_STRING("none", 1);
} else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
RETVAL_STRING("long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ RETVAL_STRING("entity", 1);
} else {
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
diff --git a/ext/mbstring/oniguruma/php_onig_compat.h b/ext/mbstring/oniguruma/php_onig_compat.h
index 1de0d6073..94ece40ef 100644
--- a/ext/mbstring/oniguruma/php_onig_compat.h
+++ b/ext/mbstring/oniguruma/php_onig_compat.h
@@ -5,4 +5,10 @@
#define regex_t php_mb_regex_t
#define re_registers php_mb_re_registers
+#ifdef HAVE_STDARG_H
+#ifndef HAVE_STDARG_PROTOTYPES
+#define HAVE_STDARG_PROTOTYPES 1
+#endif
+#endif
+
#endif /* _PHP_MBREGEX_COMPAT_H */
diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c
index 78121cdb2..1f1d8cb84 100644
--- a/ext/mbstring/php_unicode.c
+++ b/ext/mbstring/php_unicode.c
@@ -176,8 +176,7 @@ MBSTRING_API unsigned long php_unicode_toupper(unsigned long code, enum mbfl_no_
l = _uccase_len[0];
r = (l + _uccase_len[1]) - 3;
- if (MBSTRG(current_language) == mbfl_no_language_turkish &&
- enc == mbfl_no_encoding_8859_9) {
+ if (enc == mbfl_no_encoding_8859_9) {
return php_turkish_toupper(code, l, r, field);
}
@@ -208,8 +207,7 @@ MBSTRING_API unsigned long php_unicode_tolower(unsigned long code, enum mbfl_no_
l = 0;
r = _uccase_len[0] - 3;
- if (MBSTRG(current_language) == mbfl_no_language_turkish &&
- enc == mbfl_no_encoding_8859_9) {
+ if (enc == mbfl_no_encoding_8859_9) {
return php_turkish_tolower(code, l, r, field);
}
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index 51e3d9e63..fdf670af3 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mssql.c,v 1.152.2.13.2.4 2007/02/24 02:17:25 helly Exp $ */
+/* $Id: php_mssql.c,v 1.152.2.13.2.5 2007/10/22 22:43:44 iliaa Exp $ */
#ifdef COMPILE_DL_MSSQL
#define HAVE_MSSQL 1
@@ -345,9 +345,7 @@ PHP_RINIT_FUNCTION(mssql)
MS_SQL_G(min_error_severity) = MS_SQL_G(cfg_min_error_severity);
MS_SQL_G(min_message_severity) = MS_SQL_G(cfg_min_message_severity);
if (MS_SQL_G(connect_timeout) < 1) MS_SQL_G(connect_timeout) = 1;
- dbsetlogintime(MS_SQL_G(connect_timeout));
if (MS_SQL_G(timeout) < 0) MS_SQL_G(timeout) = 60;
- dbsettime(MS_SQL_G(timeout));
if (MS_SQL_G(max_procs) != -1) {
dbsetmaxprocs((TDS_SHORT)MS_SQL_G(max_procs));
}
@@ -468,6 +466,9 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
RETURN_FALSE;
}
+ dbsetlogintime(MS_SQL_G(connect_timeout));
+ dbsettime(MS_SQL_G(timeout));
+
/* set a DBLOGIN record */
if ((mssql.login = dblogin()) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate login record");
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index b06973f1c..515f7314b 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mysql.c,v 1.213.2.6.2.15 2007/06/25 16:01:30 scottmac Exp $ */
+/* $Id: php_mysql.c,v 1.213.2.6.2.17 2007/10/08 18:25:52 andrey Exp $ */
/* TODO:
*
@@ -66,7 +66,7 @@
#include <mysql.h>
#include "php_ini.h"
-#include "php_mysql.h"
+#include "php_mysql_structs.h"
/* True globals, no need for thread safety */
static int le_result, le_link, le_plink;
@@ -401,9 +401,11 @@ ZEND_MODULE_STARTUP_D(mysql)
REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
+#if MYSQL_VERSION_ID >= 40000
if (mysql_server_init(0, NULL, NULL)) {
return FAILURE;
}
+#endif
return SUCCESS;
}
@@ -413,8 +415,9 @@ ZEND_MODULE_STARTUP_D(mysql)
*/
PHP_MSHUTDOWN_FUNCTION(mysql)
{
+#if MYSQL_VERSION_ID >= 40000
#ifdef PHP_WIN32
- unsigned long client_ver = mysql_get_client_version;
+ unsigned long client_ver = mysql_get_client_version();
/* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
@@ -422,6 +425,7 @@ PHP_MSHUTDOWN_FUNCTION(mysql)
#else
mysql_server_end();
#endif
+#endif
UNREGISTER_INI_ENTRIES();
return SUCCESS;
@@ -432,7 +436,7 @@ PHP_MSHUTDOWN_FUNCTION(mysql)
*/
PHP_RINIT_FUNCTION(mysql)
{
-#ifdef ZTS
+#if defined(ZTS) && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
@@ -452,7 +456,7 @@ PHP_RINIT_FUNCTION(mysql)
*/
PHP_RSHUTDOWN_FUNCTION(mysql)
{
-#ifdef ZTS
+#if defined(ZTS) && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
#endif
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
index 7721990d5..6de1d3bc6 100644
--- a/ext/mysql/php_mysql.h
+++ b/ext/mysql/php_mysql.h
@@ -17,110 +17,18 @@
*/
-/* $Id: php_mysql.h,v 1.37.2.1.2.2 2007/05/14 17:10:47 scottmac Exp $ */
+/* $Id: php_mysql.h,v 1.37.2.1.2.3 2007/10/08 18:25:52 andrey Exp $ */
#ifndef PHP_MYSQL_H
#define PHP_MYSQL_H
-#ifdef PHP_WIN32
-#define PHP_MYSQL_API __declspec(dllexport)
-#else
-#define PHP_MYSQL_API
-#endif
-
#if HAVE_MYSQL
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
extern zend_module_entry mysql_module_entry;
-
#define mysql_module_ptr &mysql_module_entry
-PHP_MINIT_FUNCTION(mysql);
-PHP_RINIT_FUNCTION(mysql);
-PHP_MSHUTDOWN_FUNCTION(mysql);
-PHP_RSHUTDOWN_FUNCTION(mysql);
-PHP_MINFO_FUNCTION(mysql);
-
-PHP_FUNCTION(mysql_connect);
-PHP_FUNCTION(mysql_pconnect);
-PHP_FUNCTION(mysql_close);
-PHP_FUNCTION(mysql_select_db);
-#if MYSQL_VERSION_ID < 40000
-PHP_FUNCTION(mysql_create_db);
-PHP_FUNCTION(mysql_drop_db);
-#endif
-PHP_FUNCTION(mysql_query);
-PHP_FUNCTION(mysql_unbuffered_query);
-PHP_FUNCTION(mysql_db_query);
-PHP_FUNCTION(mysql_list_dbs);
-PHP_FUNCTION(mysql_list_tables);
-PHP_FUNCTION(mysql_list_fields);
-PHP_FUNCTION(mysql_list_processes);
-PHP_FUNCTION(mysql_error);
-PHP_FUNCTION(mysql_errno);
-PHP_FUNCTION(mysql_affected_rows);
-PHP_FUNCTION(mysql_insert_id);
-PHP_FUNCTION(mysql_result);
-PHP_FUNCTION(mysql_num_rows);
-PHP_FUNCTION(mysql_num_fields);
-PHP_FUNCTION(mysql_fetch_row);
-PHP_FUNCTION(mysql_fetch_array);
-PHP_FUNCTION(mysql_fetch_assoc);
-PHP_FUNCTION(mysql_fetch_object);
-PHP_FUNCTION(mysql_data_seek);
-PHP_FUNCTION(mysql_fetch_lengths);
-PHP_FUNCTION(mysql_fetch_field);
-PHP_FUNCTION(mysql_field_seek);
-PHP_FUNCTION(mysql_free_result);
-PHP_FUNCTION(mysql_field_name);
-PHP_FUNCTION(mysql_field_table);
-PHP_FUNCTION(mysql_field_len);
-PHP_FUNCTION(mysql_field_type);
-PHP_FUNCTION(mysql_field_flags);
-PHP_FUNCTION(mysql_escape_string);
-PHP_FUNCTION(mysql_real_escape_string);
-PHP_FUNCTION(mysql_get_client_info);
-PHP_FUNCTION(mysql_get_host_info);
-PHP_FUNCTION(mysql_get_proto_info);
-PHP_FUNCTION(mysql_get_server_info);
-PHP_FUNCTION(mysql_info);
-PHP_FUNCTION(mysql_stat);
-PHP_FUNCTION(mysql_thread_id);
-PHP_FUNCTION(mysql_client_encoding);
-PHP_FUNCTION(mysql_ping);
-#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007
-PHP_FUNCTION(mysql_set_charset);
-#endif
-
-ZEND_BEGIN_MODULE_GLOBALS(mysql)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- long default_port;
- char *default_host, *default_user, *default_password;
- char *default_socket;
- char *connect_error;
- long connect_errno;
- long connect_timeout;
- long result_allocated;
- long trace_mode;
-ZEND_END_MODULE_GLOBALS(mysql)
-
-#ifdef ZTS
-# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
-#else
-# define MySG(v) (mysql_globals.v)
-#endif
-
-
#else
-
#define mysql_module_ptr NULL
-
#endif
#define phpext_mysql_ptr mysql_module_ptr
diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h
new file mode 100644
index 000000000..c0f9a0bec
--- /dev/null
+++ b/ext/mysql/php_mysql_structs.h
@@ -0,0 +1,128 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2007 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Zeev Suraski <zeev@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+
+/* $Id: php_mysql_structs.h,v 1.1.4.2 2007/10/08 18:25:52 andrey Exp $ */
+
+#ifndef PHP_MYSQL_STRUCTS_H
+#define PHP_MYSQL_STRUCTS_H
+
+#ifdef PHP_WIN32
+#define PHP_MYSQL_API __declspec(dllexport)
+#else
+#define PHP_MYSQL_API
+#endif
+
+#if HAVE_MYSQL
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+extern zend_module_entry mysql_module_entry;
+
+#define mysql_module_ptr &mysql_module_entry
+
+PHP_MINIT_FUNCTION(mysql);
+PHP_RINIT_FUNCTION(mysql);
+PHP_MSHUTDOWN_FUNCTION(mysql);
+PHP_RSHUTDOWN_FUNCTION(mysql);
+PHP_MINFO_FUNCTION(mysql);
+
+PHP_FUNCTION(mysql_connect);
+PHP_FUNCTION(mysql_pconnect);
+PHP_FUNCTION(mysql_close);
+PHP_FUNCTION(mysql_select_db);
+#if MYSQL_VERSION_ID < 40000
+PHP_FUNCTION(mysql_create_db);
+PHP_FUNCTION(mysql_drop_db);
+#endif
+PHP_FUNCTION(mysql_query);
+PHP_FUNCTION(mysql_unbuffered_query);
+PHP_FUNCTION(mysql_db_query);
+PHP_FUNCTION(mysql_list_dbs);
+PHP_FUNCTION(mysql_list_tables);
+PHP_FUNCTION(mysql_list_fields);
+PHP_FUNCTION(mysql_list_processes);
+PHP_FUNCTION(mysql_error);
+PHP_FUNCTION(mysql_errno);
+PHP_FUNCTION(mysql_affected_rows);
+PHP_FUNCTION(mysql_insert_id);
+PHP_FUNCTION(mysql_result);
+PHP_FUNCTION(mysql_num_rows);
+PHP_FUNCTION(mysql_num_fields);
+PHP_FUNCTION(mysql_fetch_row);
+PHP_FUNCTION(mysql_fetch_array);
+PHP_FUNCTION(mysql_fetch_assoc);
+PHP_FUNCTION(mysql_fetch_object);
+PHP_FUNCTION(mysql_data_seek);
+PHP_FUNCTION(mysql_fetch_lengths);
+PHP_FUNCTION(mysql_fetch_field);
+PHP_FUNCTION(mysql_field_seek);
+PHP_FUNCTION(mysql_free_result);
+PHP_FUNCTION(mysql_field_name);
+PHP_FUNCTION(mysql_field_table);
+PHP_FUNCTION(mysql_field_len);
+PHP_FUNCTION(mysql_field_type);
+PHP_FUNCTION(mysql_field_flags);
+PHP_FUNCTION(mysql_escape_string);
+PHP_FUNCTION(mysql_real_escape_string);
+PHP_FUNCTION(mysql_get_client_info);
+PHP_FUNCTION(mysql_get_host_info);
+PHP_FUNCTION(mysql_get_proto_info);
+PHP_FUNCTION(mysql_get_server_info);
+PHP_FUNCTION(mysql_info);
+PHP_FUNCTION(mysql_stat);
+PHP_FUNCTION(mysql_thread_id);
+PHP_FUNCTION(mysql_client_encoding);
+PHP_FUNCTION(mysql_ping);
+#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007
+PHP_FUNCTION(mysql_set_charset);
+#endif
+
+ZEND_BEGIN_MODULE_GLOBALS(mysql)
+ long default_link;
+ long num_links,num_persistent;
+ long max_links,max_persistent;
+ long allow_persistent;
+ long default_port;
+ char *default_host, *default_user, *default_password;
+ char *default_socket;
+ char *connect_error;
+ long connect_errno;
+ long connect_timeout;
+ long result_allocated;
+ long trace_mode;
+ZEND_END_MODULE_GLOBALS(mysql)
+
+#ifdef ZTS
+# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
+#else
+# define MySG(v) (mysql_globals.v)
+#endif
+
+
+#else
+
+#define mysql_module_ptr NULL
+
+#endif
+
+#define phpext_mysql_ptr mysql_module_ptr
+
+#endif /* PHP_MYSQL_STRUCTS_H */
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index d744c91e1..7a5ce3335 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli.c,v 1.72.2.16.2.16 2007/06/25 16:01:30 scottmac Exp $
+ $Id: mysqli.c,v 1.72.2.16.2.21 2007/10/22 10:35:33 andrey Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -125,8 +125,7 @@ void php_clear_stmt_bind(MY_STMT *stmt)
/* {{{ php_clear_mysql */
void php_clear_mysql(MY_MYSQL *mysql) {
if (mysql->li_read) {
- efree(Z_STRVAL_P(mysql->li_read));
- FREE_ZVAL(mysql->li_read);
+ zval_ptr_dtor(&(mysql->li_read));
mysql->li_read = NULL;
}
}
@@ -495,6 +494,12 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_INI_ENTRIES();
+#if MYSQL_VERSION_ID >= 40000
+ if (mysql_server_init(0, NULL, NULL)) {
+ return FAILURE;
+ }
+#endif
+
memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
mysqli_object_handlers.clone_obj = NULL;
mysqli_object_handlers.read_property = mysqli_read_property;
@@ -632,7 +637,7 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
#endif
-
+ REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT);
/* replication */
REGISTER_LONG_CONSTANT("MYSQLI_RPL_MASTER", MYSQL_RPL_MASTER, CONST_CS | CONST_PERSISTENT);
@@ -652,10 +657,6 @@ PHP_MINIT_FUNCTION(mysqli)
REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT);
- if (mysql_server_init(0, NULL, NULL)) {
- return FAILURE;
- }
-
return SUCCESS;
}
/* }}} */
@@ -664,8 +665,9 @@ PHP_MINIT_FUNCTION(mysqli)
*/
PHP_MSHUTDOWN_FUNCTION(mysqli)
{
+#if MYSQL_VERSION_ID >= 40000
#ifdef PHP_WIN32
- unsigned long client_ver = mysql_get_client_version;
+ unsigned long client_ver = mysql_get_client_version();
/* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
@@ -673,6 +675,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
#else
mysql_server_end();
#endif
+#endif
zend_hash_destroy(&mysqli_driver_properties);
zend_hash_destroy(&mysqli_result_properties);
@@ -690,7 +693,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
*/
PHP_RINIT_FUNCTION(mysqli)
{
-#ifdef ZTS
+#ifdef ZTS && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
@@ -706,7 +709,7 @@ PHP_RINIT_FUNCTION(mysqli)
*/
PHP_RSHUTDOWN_FUNCTION(mysqli)
{
-#ifdef ZTS
+#ifdef ZTS && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
#endif
if (MyG(error_msg)) {
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index db8ed7f8e..aa1af4f0a 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_api.c,v 1.118.2.22.2.14 2007/07/24 09:22:16 andrey Exp $
+ $Id: mysqli_api.c,v 1.118.2.22.2.18 2007/10/17 08:19:50 tony2001 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -325,6 +325,9 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DECIMAL:
#ifdef FIELD_TYPE_NEWDECIMAL
@@ -455,6 +458,7 @@ PHP_FUNCTION(mysqli_close)
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_INITIALIZED);
mysql_close(mysql->mysql);
+ mysql->mysql = NULL;
php_clear_mysql(mysql);
efree(mysql);
MYSQLI_CLEAR_RESOURCE(&mysql_link);
@@ -1166,8 +1170,7 @@ PHP_FUNCTION(mysqli_set_local_infile_default)
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
if (mysql->li_read) {
- efree(Z_STRVAL_P(mysql->li_read));
- zval_dtor(mysql->li_read);
+ zval_ptr_dtor(&(mysql->li_read));
mysql->li_read = NULL;
}
}
@@ -1195,11 +1198,14 @@ PHP_FUNCTION(mysqli_set_local_infile_handler)
efree(callback_name);
RETURN_FALSE;
}
- efree(callback_name);
/* save callback function */
- ALLOC_ZVAL(mysql->li_read);
- ZVAL_STRING(mysql->li_read, callback_func->value.str.val, 1);
+ if (!mysql->li_read) {
+ MAKE_STD_ZVAL(mysql->li_read);
+ } else {
+ zval_dtor(mysql->li_read);
+ }
+ ZVAL_STRING(mysql->li_read, callback_name, 0);
RETURN_TRUE;
}
@@ -2000,7 +2006,10 @@ PHP_FUNCTION(mysqli_stmt_store_result)
double - but this is a known problem of the simple MySQL API ;)
*/
for (i = mysql_stmt_field_count(stmt->stmt) - 1; i >=0; --i) {
- if (stmt->stmt->fields && stmt->stmt->fields[i].type == MYSQL_TYPE_BLOB) {
+ if (stmt->stmt->fields && (stmt->stmt->fields[i].type == MYSQL_TYPE_BLOB ||
+ stmt->stmt->fields[i].type == MYSQL_TYPE_MEDIUM_BLOB ||
+ stmt->stmt->fields[i].type == MYSQL_TYPE_LONG_BLOB))
+ {
my_bool tmp=1;
mysql_stmt_attr_set(stmt->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &tmp);
break;
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 6f84ca157..2a2f41d89 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_nonapi.c,v 1.54.2.7.2.4 2007/04/23 09:27:07 tony2001 Exp $
+ $Id: mysqli_nonapi.c,v 1.54.2.7.2.5 2007/09/06 10:07:42 andrey Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -33,8 +33,8 @@
Open a connection to a mysql server */
PHP_FUNCTION(mysqli_connect)
{
- MY_MYSQL *mysql;
- MYSQLI_RESOURCE *mysqli_resource;
+ MY_MYSQL *mysql = NULL;
+ MYSQLI_RESOURCE *mysqli_resource = NULL;
zval *object = getThis();
char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
unsigned int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
@@ -67,7 +67,22 @@ PHP_FUNCTION(mysqli_connect)
}
}
- mysql = (MY_MYSQL *) ecalloc(1, sizeof(MY_MYSQL));
+ if (object && instanceof_function(Z_OBJCE_P(object), mysqli_link_class_entry TSRMLS_CC)) {
+ mysqli_resource = ((mysqli_object *) zend_object_store_get_object(object TSRMLS_CC))->ptr;
+ if (mysqli_resource && mysqli_resource->ptr &&
+ mysqli_resource->status >= MYSQLI_STATUS_INITIALIZED)
+ {
+ mysql = (MY_MYSQL*)mysqli_resource->ptr;
+ php_clear_mysql(mysql);
+ if (mysql->mysql) {
+ mysql_close(mysql->mysql);
+ mysql->mysql = NULL;
+ }
+ }
+ }
+ if (!mysql) {
+ mysql = (MY_MYSQL *) ecalloc(1, sizeof(MY_MYSQL));
+ }
if (!(mysql->mysql = mysql_init(NULL))) {
efree(mysql);
@@ -110,8 +125,10 @@ PHP_FUNCTION(mysqli_connect)
/* set our own local_infile handler */
php_set_local_infile_handler_default(mysql);
- mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
- mysqli_resource->ptr = (void *)mysql;
+ if (!mysqli_resource) {
+ mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+ mysqli_resource->ptr = (void *)mysql;
+ }
mysqli_resource->status = MYSQLI_STATUS_VALID;
if (!object || !instanceof_function(Z_OBJCE_P(object), mysqli_link_class_entry TSRMLS_CC)) {
diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index 8b78a5e5c..4d8bba823 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.c
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_prop.c,v 1.23.2.5.2.2 2007/02/24 02:17:25 helly Exp $
+ $Id: mysqli_prop.c,v 1.23.2.5.2.3 2007/10/16 13:00:32 andrey Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -86,8 +86,8 @@ static int __func(mysqli_object *obj, zval **retval TSRMLS_DC) \
ZVAL_LONG(*retval, l);\
} else { \
char *ret; \
- int l = spprintf(&ret, 0, MYSQLI_LLU_SPEC, (my_ulonglong)l); \
- ZVAL_STRINGL(*retval, ret, l, 0); \
+ int ret_len = spprintf(&ret, 0, MYSQLI_LLU_SPEC, (my_ulonglong)l); \
+ ZVAL_STRINGL(*retval, ret, ret_len, 0); \
} \
}\
return SUCCESS;\
diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
index 7ab599859..e16ff8314 100644
--- a/ext/mysqli/php_mysqli.h
+++ b/ext/mysqli/php_mysqli.h
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: php_mysqli.h,v 1.54.2.7.2.5 2007/02/24 14:33:50 helly Exp $
+ $Id: php_mysqli.h,v 1.54.2.7.2.6 2007/09/12 09:12:56 andrey Exp $
*/
/* A little hack to prevent build break, when mysql is used together with
@@ -241,9 +241,10 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry * TSRML
#define MYSQLI_RETURN_LONG_LONG(__val) \
{ \
if ((__val) < LONG_MAX) { \
- RETURN_LONG((__val)); \
+ RETURN_LONG((long) (__val)); \
} else { \
char *ret; \
+ /* always used with my_ulonglong -> %llu */ \
int l = spprintf(&ret, 0, "%llu", (__val)); \
RETURN_STRINGL(ret, l, 0); \
} \
diff --git a/ext/mysqli/tests/061.phpt b/ext/mysqli/tests/061.phpt
index 813fc0526..b6fd51e53 100644
--- a/ext/mysqli/tests/061.phpt
+++ b/ext/mysqli/tests/061.phpt
@@ -18,7 +18,7 @@ local infile handler
mysqli_real_connect($link, $host, $user, $passwd, "test");
/* create temporary file */
- $filename = dirname(__FILE__) . "061.csv";
+ $filename = dirname(__FILE__) . "/061.csv";
$fp = fopen($filename, "w");
fwrite($fp, "foo;bar");
fclose($fp);
diff --git a/ext/mysqli/tests/bug38710.phpt b/ext/mysqli/tests/bug38710.phpt
index b3e1672ad..b62056868 100755
--- a/ext/mysqli/tests/bug38710.phpt
+++ b/ext/mysqli/tests/bug38710.phpt
@@ -1,7 +1,9 @@
--TEST--
Bug #38710 (data leakage because of nonexisting boundary checking in statements)
--SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+?>
--FILE--
<?php
include "connect.inc";
@@ -12,7 +14,10 @@ $qry->prepare("SELECT REPEAT('a',100000)");
$qry->execute();
$qry->bind_result($text);
$qry->fetch();
-var_dump($text);
+if ($text !== str_repeat('a', mysqli_get_server_version($db) > 50110? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) {
+ var_dump(strlen($text));
+}
+echo "Done";
?>
--EXPECTF--
-string(8193) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+Done
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index e913e16f9..08a0629bf 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.16.2.37 2007/08/06 20:32:54 sixd Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.38 2007/08/31 22:30:27 tony2001 Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with OCI_ATTR_LOBEMPTY
@@ -377,7 +377,7 @@ zend_module_entry oci8_module_entry = {
PHP_RINIT(oci), /* per-request startup function */
PHP_RSHUTDOWN(oci), /* per-request shutdown function */
PHP_MINFO(oci), /* information function */
- "1.2.3",
+ "1.2.4",
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5)
PHP_MODULE_GLOBALS(oci), /* globals descriptor */
PHP_GINIT(oci), /* globals ctor */
@@ -673,8 +673,8 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Version", "1.2.3");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.37 $");
+ php_info_print_table_row(2, "Version", "1.2.4");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.38 $");
snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
diff --git a/ext/oci8/package2.xml b/ext/oci8/package2.xml
index 523023d6e..ff96be442 100644
--- a/ext/oci8/package2.xml
+++ b/ext/oci8/package2.xml
@@ -27,8 +27,14 @@ the Oracle Call Interface (OCI8).
<email>andi@zend.com</email>
<active>yes</active>
</lead>
- <date>2007-08-08</date>
- <time>19:00:00</time>
+ <lead>
+ <name>Christopher Jones</name>
+ <user>sixd</user>
+ <email>sixd@php.net</email>
+ <active>yes</active>
+ </lead>
+ <date>2007-09-01</date>
+ <time>15:00:00</time>
<version>
<release>1.2.4</release>
<api>1.2.4</api>
@@ -38,7 +44,8 @@ the Oracle Call Interface (OCI8).
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP</license>
- <notes>Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback).
+ <notes>Added Oracle 11g support.
+Fixed PECL bug #10194 (crash in Oracle client when memory limit reached in the callback).
Fixed bug #42173 (oci_field_type fixes for INTERVAL and TIMESTAMP types).
Fixed bug #42134 (oci_error() returns false after oci_new_collection() fails).
Fixed bug #41917 (oci_field_precision and oci_field_scale datatypes fixed).
@@ -137,11 +144,6 @@ Various minor improvements.
<file name="connect.inc" role="test" />
<file name="connect_old.phpt" role="test" />
<file name="connect.phpt" role="test" />
- <file name="connect_with_charset_001.diff" role="test" />
- <file name="connect_with_charset_001.exp" role="test" />
- <file name="connect_with_charset_001.log" role="test" />
- <file name="connect_with_charset_001.out" role="test" />
- <file name="connect_with_charset_001.php" role="test" />
<file name="connect_with_charset_001.phpt" role="test" />
<file name="connect_without_oracle_home_old.phpt" role="test" />
<file name="connect_without_oracle_home.phpt" role="test" />
@@ -227,11 +229,6 @@ Various minor improvements.
<file name="lob_036.phpt" role="test" />
<file name="lob_037.phpt" role="test" />
<file name="lob_038.phpt" role="test" />
- <file name="lob_039.diff" role="test" />
- <file name="lob_039.exp" role="test" />
- <file name="lob_039.log" role="test" />
- <file name="lob_039.out" role="test" />
- <file name="lob_039.php" role="test" />
<file name="lob_039.phpt" role="test" />
<file name="lob_040.phpt" role="test" />
<file name="lob_aliases.phpt" role="test" />
diff --git a/ext/oci8/tests/rowid_bind.phpt b/ext/oci8/tests/rowid_bind.phpt
new file mode 100644
index 000000000..f15d8f8bb
--- /dev/null
+++ b/ext/oci8/tests/rowid_bind.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test ROWID bind
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+function do_query($c)
+{
+ $s = oci_parse($c, 'select address from rid_tab order by id');
+ $id = 1;
+ oci_execute($s, OCI_DEFAULT);
+ while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ var_dump($row);
+ }
+}
+
+$stmts = array(
+ "drop table rid_tab",
+ "create table rid_tab (id number, address varchar2(40))",
+ "insert into rid_tab (id, address) values (1, 'original text #1')",
+ "insert into rid_tab (id, address) values (2, 'original text #2')"
+);
+
+foreach ($stmts as $q) {
+ $s = oci_parse($c, $q);
+ @oci_execute($s);
+}
+
+echo "Initial Data\n";
+do_query($c);
+
+$s = oci_parse($c, 'select rowid, address from rid_tab where id = :l_bv for update');
+$id = 1;
+oci_bind_by_name($s, ':l_bv', $id);
+oci_execute($s, OCI_DEFAULT);
+$row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS);
+
+$rid = $row['ROWID'];
+$addr = $row['ADDRESS'];
+
+$addr = 'Some new text';
+
+// Save changes
+$s = oci_parse($c,'update rid_tab set address = :a_bv where rowid = :r_bv');
+oci_bind_by_name($s, ':r_bv', $rid, -1, OCI_B_ROWID);
+oci_bind_by_name($s, ':a_bv', $addr);
+oci_execute($s);
+
+echo "Verify Change\n";
+do_query($c);
+
+// Cleanup
+
+$stmts = array("drop table rid_tab");
+
+foreach ($stmts as $q) {
+ $s = oci_parse($c, $q);
+ @oci_execute($s);
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Initial Data
+array(1) {
+ ["ADDRESS"]=>
+ string(16) "original text #1"
+}
+array(1) {
+ ["ADDRESS"]=>
+ string(16) "original text #2"
+}
+Verify Change
+array(1) {
+ ["ADDRESS"]=>
+ string(13) "Some new text"
+}
+array(1) {
+ ["ADDRESS"]=>
+ string(16) "original text #2"
+}
+Done
diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt
new file mode 100644
index 000000000..25dc2cf56
--- /dev/null
+++ b/ext/oci8/tests/xmltype_01.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Basic XMLType test
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialization
+
+$stmts = array(
+ "drop table xtt",
+ "create table xtt
+ (xt_id number, xt_spec xmltype)
+ xmltype xt_spec store as clob",
+ "insert into xtt (xt_id, xt_spec) values
+ (1,
+ xmltype('<?xml version=\"1.0\"?>
+ <Xt>
+ <XtId>1</XtId>
+ <Size>Big</Size>
+ <Area>12345</Area>
+ <Hardness>20</Hardness>
+ <Lip>Curved</Lip>
+ <Color>Red</Color>
+ <Nice>N</Nice>
+ <Compact>Tiny</Compact>
+ <Material>Steel</Material>
+ </Xt>'))"
+);
+
+foreach ($stmts as $q) {
+ $s = oci_parse($c, $q);
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if ($m['code'] != 942) { // table or view doesn't exist
+ echo $m['message'], "\n";
+ }
+ }
+}
+
+function do_query($c)
+{
+ $s = oci_parse($c, 'select XMLType.getClobVal(xt_spec)
+ from xtt where xt_id = 1');
+ oci_execute($s);
+ $row = oci_fetch_row($s);
+ $data = $row[0]->load();
+ var_dump($data);
+ return($data);
+}
+
+// Check
+echo "Initial Data\n";
+$data = do_query($c);
+
+// Manipulate the data using SimpleXML
+$sx = simplexml_load_string($data);
+$sx->Hardness = $sx->Hardness - 1;
+$sx->Nice = 'Y';
+
+// Insert changes using a temporary CLOB
+$s = oci_parse($c, 'update xtt
+ set xt_spec = XMLType(:clob)
+ where xt_id = 1');
+$lob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s, ':clob', $lob, -1, OCI_B_CLOB);
+$lob->writeTemporary($sx->asXml());
+oci_execute($s);
+$lob->close();
+
+// Verify
+echo "Verify\n";
+$data = do_query($c);
+
+// Cleanup
+
+$stmts = array(
+ "drop table xtt",
+);
+
+foreach ($stmts as $q) {
+ $s = oci_parse($c, $q);
+ @oci_execute($s);
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Initial Data
+string(250) "<?xml version="1.0"?>
+ <Xt>
+ <XtId>1</XtId>
+ <Size>Big</Size>
+ <Area>12345</Area>
+ <Hardness>20</Hardness>
+ <Lip>Curved</Lip>
+ <Color>Red</Color>
+ <Nice>N</Nice>
+ <Compact>Tiny</Compact>
+ <Material>Steel</Material>
+ </Xt>"
+Verify
+string(249) "<?xml version="1.0"?>
+<Xt>
+ <XtId>1</XtId>
+ <Size>Big</Size>
+ <Area>12345</Area>
+ <Hardness>19</Hardness>
+ <Lip>Curved</Lip>
+ <Color>Red</Color>
+ <Nice>Y</Nice>
+ <Compact>Tiny</Compact>
+ <Material>Steel</Material>
+ </Xt>
+"
+Done
diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c
index 053bf180e..64a21f368 100644
--- a/ext/odbc/birdstep.c
+++ b/ext/odbc/birdstep.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: birdstep.c,v 1.13.2.2.2.1 2007/01/01 09:36:03 sebastian Exp $ */
+/* $Id: birdstep.c,v 1.13.2.2.2.2 2007/08/31 07:42:00 jani Exp $ */
/*
* TODO:
@@ -47,6 +47,7 @@
#ifdef HAVE_BIRDSTEP
#include "php_birdstep.h"
#include "ext/standard/info.h"
+#include "php_ini.h"
zend_function_entry birdstep_functions[] = {
PHP_FE(birdstep_connect, NULL)
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index c3e86064a..ea50d5c41 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: openssl.c,v 1.98.2.5.2.41 2007/08/08 06:29:46 pajoye Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.42 2007/10/31 13:23:06 jani Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -46,6 +46,9 @@
#include <openssl/ssl.h>
#include <openssl/pkcs12.h>
+/* Common */
+#include <time.h>
+
#define DEFAULT_KEY_LENGTH 512
#define MIN_KEY_LENGTH 384
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
index f5bc27d33..cc779a2a3 100644
--- a/ext/pcre/config.w32
+++ b/ext/pcre/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.4.2.5.2.5 2007/06/15 19:09:24 nlopess Exp $
+// $Id: config.w32,v 1.4.2.5.2.7 2007/09/11 16:17:33 nlopess Exp $
// vim:ft=javascript
ARG_WITH("pcre-regex", "Perl Compatible Regular Expressions", "yes");
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 6456edfbb..0d87053ba 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config0.m4,v 1.38.2.3.2.8 2007/07/03 17:25:34 sniper Exp $
+dnl $Id: config0.m4,v 1.38.2.3.2.10 2007/09/11 16:17:33 nlopess Exp $
dnl
dnl By default we'll compile and link against the bundled PCRE library
diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog
index 87c2de74d..3b18524fe 100644
--- a/ext/pcre/pcrelib/ChangeLog
+++ b/ext/pcre/pcrelib/ChangeLog
@@ -1,7 +1,172 @@
ChangeLog for PCRE
------------------
-Version 7.2 19-June-07
+Version 7.3 28-Aug-07
+---------------------
+
+ 1. In the rejigging of the build system that eventually resulted in 7.1, the
+ line "#include <pcre.h>" was included in pcre_internal.h. The use of angle
+ brackets there is not right, since it causes compilers to look for an
+ installed pcre.h, not the version that is in the source that is being
+ compiled (which of course may be different). I have changed it back to:
+
+ #include "pcre.h"
+
+ I have a vague recollection that the change was concerned with compiling in
+ different directories, but in the new build system, that is taken care of
+ by the VPATH setting the Makefile.
+
+ 2. The pattern .*$ when run in not-DOTALL UTF-8 mode with newline=any failed
+ when the subject happened to end in the byte 0x85 (e.g. if the last
+ character was \x{1ec5}). *Character* 0x85 is one of the "any" newline
+ characters but of course it shouldn't be taken as a newline when it is part
+ of another character. The bug was that, for an unlimited repeat of . in
+ not-DOTALL UTF-8 mode, PCRE was advancing by bytes rather than by
+ characters when looking for a newline.
+
+ 3. A small performance improvement in the DOTALL UTF-8 mode .* case.
+
+ 4. Debugging: adjusted the names of opcodes for different kinds of parentheses
+ in debug output.
+
+ 5. Arrange to use "%I64d" instead of "%lld" and "%I64u" instead of "%llu" for
+ long printing in the pcrecpp unittest when running under MinGW.
+
+ 6. ESC_K was left out of the EBCDIC table.
+
+ 7. Change 7.0/38 introduced a new limit on the number of nested non-capturing
+ parentheses; I made it 1000, which seemed large enough. Unfortunately, the
+ limit also applies to "virtual nesting" when a pattern is recursive, and in
+ this case 1000 isn't so big. I have been able to remove this limit at the
+ expense of backing off one optimization in certain circumstances. Normally,
+ when pcre_exec() would call its internal match() function recursively and
+ immediately return the result unconditionally, it uses a "tail recursion"
+ feature to save stack. However, when a subpattern that can match an empty
+ string has an unlimited repetition quantifier, it no longer makes this
+ optimization. That gives it a stack frame in which to save the data for
+ checking that an empty string has been matched. Previously this was taken
+ from the 1000-entry workspace that had been reserved. So now there is no
+ explicit limit, but more stack is used.
+
+ 8. Applied Daniel's patches to solve problems with the import/export magic
+ syntax that is required for Windows, and which was going wrong for the
+ pcreposix and pcrecpp parts of the library. These were overlooked when this
+ problem was solved for the main library.
+
+ 9. There were some crude static tests to avoid integer overflow when computing
+ the size of patterns that contain repeated groups with explicit upper
+ limits. As the maximum quantifier is 65535, the maximum group length was
+ set at 30,000 so that the product of these two numbers did not overflow a
+ 32-bit integer. However, it turns out that people want to use groups that
+ are longer than 30,000 bytes (though not repeat them that many times).
+ Change 7.0/17 (the refactoring of the way the pattern size is computed) has
+ made it possible to implement the integer overflow checks in a much more
+ dynamic way, which I have now done. The artificial limitation on group
+ length has been removed - we now have only the limit on the total length of
+ the compiled pattern, which depends on the LINK_SIZE setting.
+
+10. Fixed a bug in the documentation for get/copy named substring when
+ duplicate names are permitted. If none of the named substrings are set, the
+ functions return PCRE_ERROR_NOSUBSTRING (7); the doc said they returned an
+ empty string.
+
+11. Because Perl interprets \Q...\E at a high level, and ignores orphan \E
+ instances, patterns such as [\Q\E] or [\E] or even [^\E] cause an error,
+ because the ] is interpreted as the first data character and the
+ terminating ] is not found. PCRE has been made compatible with Perl in this
+ regard. Previously, it interpreted [\Q\E] as an empty class, and [\E] could
+ cause memory overwriting.
+
+10. Like Perl, PCRE automatically breaks an unlimited repeat after an empty
+ string has been matched (to stop an infinite loop). It was not recognizing
+ a conditional subpattern that could match an empty string if that
+ subpattern was within another subpattern. For example, it looped when
+ trying to match (((?(1)X|))*) but it was OK with ((?(1)X|)*) where the
+ condition was not nested. This bug has been fixed.
+
+12. A pattern like \X?\d or \P{L}?\d in non-UTF-8 mode could cause a backtrack
+ past the start of the subject in the presence of bytes with the top bit
+ set, for example "\x8aBCD".
+
+13. Added Perl 5.10 experimental backtracking controls (*FAIL), (*F), (*PRUNE),
+ (*SKIP), (*THEN), (*COMMIT), and (*ACCEPT).
+
+14. Optimized (?!) to (*FAIL).
+
+15. Updated the test for a valid UTF-8 string to conform to the later RFC 3629.
+ This restricts code points to be within the range 0 to 0x10FFFF, excluding
+ the "low surrogate" sequence 0xD800 to 0xDFFF. Previously, PCRE allowed the
+ full range 0 to 0x7FFFFFFF, as defined by RFC 2279. Internally, it still
+ does: it's just the validity check that is more restrictive.
+
+16. Inserted checks for integer overflows during escape sequence (backslash)
+ processing, and also fixed erroneous offset values for syntax errors during
+ backslash processing.
+
+17. Fixed another case of looking too far back in non-UTF-8 mode (cf 12 above)
+ for patterns like [\PPP\x8a]{1,}\x80 with the subject "A\x80".
+
+18. An unterminated class in a pattern like (?1)\c[ with a "forward reference"
+ caused an overrun.
+
+19. A pattern like (?:[\PPa*]*){8,} which had an "extended class" (one with
+ something other than just ASCII characters) inside a group that had an
+ unlimited repeat caused a loop at compile time (while checking to see
+ whether the group could match an empty string).
+
+20. Debugging a pattern containing \p or \P could cause a crash. For example,
+ [\P{Any}] did so. (Error in the code for printing property names.)
+
+21. An orphan \E inside a character class could cause a crash.
+
+22. A repeated capturing bracket such as (A)? could cause a wild memory
+ reference during compilation.
+
+23. There are several functions in pcre_compile() that scan along a compiled
+ expression for various reasons (e.g. to see if it's fixed length for look
+ behind). There were bugs in these functions when a repeated \p or \P was
+ present in the pattern. These operators have additional parameters compared
+ with \d, etc, and these were not being taken into account when moving along
+ the compiled data. Specifically:
+
+ (a) A item such as \p{Yi}{3} in a lookbehind was not treated as fixed
+ length.
+
+ (b) An item such as \pL+ within a repeated group could cause crashes or
+ loops.
+
+ (c) A pattern such as \p{Yi}+(\P{Yi}+)(?1) could give an incorrect
+ "reference to non-existent subpattern" error.
+
+ (d) A pattern like (\P{Yi}{2}\277)? could loop at compile time.
+
+24. A repeated \S or \W in UTF-8 mode could give wrong answers when multibyte
+ characters were involved (for example /\S{2}/8g with "A\x{a3}BC").
+
+25. Using pcregrep in multiline, inverted mode (-Mv) caused it to loop.
+
+26. Patterns such as [\P{Yi}A] which include \p or \P and just one other
+ character were causing crashes (broken optimization).
+
+27. Patterns such as (\P{Yi}*\277)* (group with possible zero repeat containing
+ \p or \P) caused a compile-time loop.
+
+28. More problems have arisen in unanchored patterns when CRLF is a valid line
+ break. For example, the unstudied pattern [\r\n]A does not match the string
+ "\r\nA" because change 7.0/46 below moves the current point on by two
+ characters after failing to match at the start. However, the pattern \nA
+ *does* match, because it doesn't start till \n, and if [\r\n]A is studied,
+ the same is true. There doesn't seem any very clean way out of this, but
+ what I have chosen to do makes the common cases work: PCRE now takes note
+ of whether there can be an explicit match for \r or \n anywhere in the
+ pattern, and if so, 7.0/46 no longer applies. As part of this change,
+ there's a new PCRE_INFO_HASCRORLF option for finding out whether a compiled
+ pattern has explicit CR or LF references.
+
+29. Added (*CR) etc for changing newline setting at start of pattern.
+
+
+Version 7.2 19-Jun-07
---------------------
1. If the fr_FR locale cannot be found for test 3, try the "french" locale,
diff --git a/ext/pcre/pcrelib/HACKING b/ext/pcre/pcrelib/HACKING
index 49bba8a70..c946cd2bd 100644
--- a/ext/pcre/pcrelib/HACKING
+++ b/ext/pcre/pcrelib/HACKING
@@ -109,15 +109,15 @@ variable length. The first byte in an item is an opcode, and the length of the
item is either implicit in the opcode or contained in the data bytes that
follow it.
-In many cases below "two-byte" data values are specified. This is in fact just
-a default when the number is an offset within the compiled pattern. PCRE can be
+In many cases below LINK_SIZE data values are specified for offsets within the
+compiled pattern. The default value for LINK_SIZE is 2, but PCRE can be
compiled to use 3-byte or 4-byte values for these offsets (impairing the
performance). This is necessary only when patterns whose compiled length is
greater than 64K are going to be processed. In this description, we assume the
-"normal" compilation options. "Two-byte" data values that are counts (e.g. for
-quantifiers) are always just two bytes.
+"normal" compilation options. Data values that are counts (e.g. for
+quantifiers) are always just two bytes long.
-A list of all the opcodes follows:
+A list of the opcodes follows:
Opcodes with no following data
------------------------------
@@ -149,6 +149,13 @@ These items are all just one byte long
OP_EXTUNI match an extended Unicode character
OP_ANYNL match any Unicode newline sequence
+ OP_ACCEPT )
+ OP_COMMIT )
+ OP_FAIL ) These are Perl 5.10's "backtracking
+ OP_PRUNE ) control verbs".
+ OP_SKIP )
+ OP_THEN )
+
Repeating single characters
---------------------------
@@ -404,4 +411,4 @@ at compile time, and so does not cause anything to be put into the compiled
data.
Philip Hazel
-June 2007
+August 2007
diff --git a/ext/pcre/pcrelib/NEWS b/ext/pcre/pcrelib/NEWS
index f1083e860..6a30805bb 100644
--- a/ext/pcre/pcrelib/NEWS
+++ b/ext/pcre/pcrelib/NEWS
@@ -2,6 +2,30 @@ News about PCRE releases
------------------------
+Release 7.3 28-Aug-07
+---------------------
+
+Most changes are bug fixes. Some that are not:
+
+1. There is some support for Perl 5.10's experimental "backtracking control
+ verbs" such as (*PRUNE).
+
+2. UTF-8 checking is now as per RFC 3629 instead of RFC 2279; this is more
+ restrictive in the strings it accepts.
+
+3. Checking for potential integer overflow has been made more dynamic, and as a
+ consequence there is no longer a hard limit on the size of a subpattern that
+ has a limited repeat count.
+
+4. When CRLF is a valid line-ending sequence, pcre_exec() and pcre_dfa_exec()
+ no longer advance by two characters instead of one when an unanchored match
+ fails at CRLF if there are explicit CR or LF matches within the pattern.
+ This gets rid of some anomalous effects that previously occurred.
+
+5. Some PCRE-specific settings for varying the newline options at the start of
+ a pattern have been added.
+
+
Release 7.2 19-Jun-07
---------------------
diff --git a/ext/pcre/pcrelib/NON-UNIX-USE b/ext/pcre/pcrelib/NON-UNIX-USE
index a10c7041a..f1047baa7 100644
--- a/ext/pcre/pcrelib/NON-UNIX-USE
+++ b/ext/pcre/pcrelib/NON-UNIX-USE
@@ -7,6 +7,7 @@ This document contains the following sections:
Generic instructions for the PCRE C library
The C++ wrapper functions
Building for virtual Pascal
+ Stack size in Windows environments
Comments about Win32 builds
Building under Windows with BCC5.5
Building PCRE on OpenVMS
@@ -14,7 +15,7 @@ This document contains the following sections:
GENERAL
-I (Philip Hazel) have no knowledge of Windows or VMS sytems and how their
+I (Philip Hazel) have no experience of Windows or VMS sytems and how their
libraries work. The items in the PCRE distribution and Makefile that relate to
anything other than Unix-like systems are untested by me.
@@ -38,79 +39,97 @@ GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY
The following are generic comments about building the PCRE C library "by hand".
-(1) Copy or rename the file config.h.generic as config.h, and edit the macro
- settings that it contains to whatever is appropriate for your environment.
- In particular, if you want to force a specific value for newline, you can
- define the NEWLINE macro.
-
- An alternative approach is not to edit config.h, but to use -D on the
- compiler command line to make any changes that you need.
-
- NOTE: There have been occasions when the way in which certain parameters in
- config.h are used has changed between releases. (In the configure/make
- world, this is handled automatically.) When upgrading to a new release, you
- are strongly advised to review config.h.generic before re-using what you
- had previously.
-
-(2) Copy or rename the file pcre.h.generic as pcre.h.
-
-(3) EITHER:
- Copy or rename file pcre_chartables.c.dist as pcre_chartables.c.
-
- OR:
- Compile dftables.c as a stand-alone program, and then run it with the
- single argument "pcre_chartables.c". This generates a set of standard
- character tables and writes them to that file. The tables are generated
- using the default C locale for your system. If you want to use a locale
- that is specified by LC_xxx environment variables, add the -L option to
- the dftables command. You must use this method if you are building on
- a system that uses EBCDIC code.
-
- The tables in pcre_chartables.c are defaults. The caller of PCRE can
- specify alternative tables at run time.
-
-(4) Compile the following source files:
-
- pcre_chartables.c
- pcre_compile.c
- pcre_config.c
- pcre_dfa_exec.c
- pcre_exec.c
- pcre_fullinfo.c
- pcre_get.c
- pcre_globals.c
- pcre_info.c
- pcre_maketables.c
- pcre_newline.c
- pcre_ord2utf8.c
- pcre_refcount.c
- pcre_study.c
- pcre_tables.c
- pcre_try_flipped.c
- pcre_ucp_searchfuncs.c
- pcre_valid_utf8.c
- pcre_version.c
- pcre_xclass.c
-
- Now link them all together into an object library in whichever form your
- system keeps such libraries. This is the basic PCRE C library. If your
- system has static and shared libraries, you may have to do this once for
- each type.
-
-(5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
- library.
-
-(6) Compile the test program pcretest.c. This needs the functions in the
- pcre and pcreposix libraries when linking.
-
-(7) Run pcretest on the testinput files in the testdata directory, and check
- that the output matches the corresponding testoutput files. Note that the
- supplied files are in Unix format, with just LF characters as line
- terminators. You may need to edit them to change this if your system uses a
- different convention.
-
-(8) If you want to use the pcregrep command, compile and link pcregrep.c; it
- uses only the basic PCRE library (it does not need the pcreposix library).
+ (1) Copy or rename the file config.h.generic as config.h, and edit the macro
+ settings that it contains to whatever is appropriate for your environment.
+ In particular, if you want to force a specific value for newline, you can
+ define the NEWLINE macro.
+
+ An alternative approach is not to edit config.h, but to use -D on the
+ compiler command line to make any changes that you need.
+
+ NOTE: There have been occasions when the way in which certain parameters
+ in config.h are used has changed between releases. (In the configure/make
+ world, this is handled automatically.) When upgrading to a new release,
+ you are strongly advised to review config.h.generic before re-using what
+ you had previously.
+
+ (2) Copy or rename the file pcre.h.generic as pcre.h.
+
+ (3) EITHER:
+ Copy or rename file pcre_chartables.c.dist as pcre_chartables.c.
+
+ OR:
+ Compile dftables.c as a stand-alone program, and then run it with the
+ single argument "pcre_chartables.c". This generates a set of standard
+ character tables and writes them to that file. The tables are generated
+ using the default C locale for your system. If you want to use a locale
+ that is specified by LC_xxx environment variables, add the -L option to
+ the dftables command. You must use this method if you are building on
+ a system that uses EBCDIC code.
+
+ The tables in pcre_chartables.c are defaults. The caller of PCRE can
+ specify alternative tables at run time.
+
+ (4) Ensure that you have the following header files:
+
+ pcre_internal.h
+ ucp.h
+ ucpinternal.h
+ ucptable.h
+
+ (5) Also ensure that you have the following file, which is #included as source
+ when building a debugging version of PCRE and is also used by pcretest.
+
+ pcre_printint.src
+
+ (6) Compile the following source files:
+
+ pcre_chartables.c
+ pcre_compile.c
+ pcre_config.c
+ pcre_dfa_exec.c
+ pcre_exec.c
+ pcre_fullinfo.c
+ pcre_get.c
+ pcre_globals.c
+ pcre_info.c
+ pcre_maketables.c
+ pcre_newline.c
+ pcre_ord2utf8.c
+ pcre_refcount.c
+ pcre_study.c
+ pcre_tables.c
+ pcre_try_flipped.c
+ pcre_ucp_searchfuncs.c
+ pcre_valid_utf8.c
+ pcre_version.c
+ pcre_xclass.c
+
+ Make sure that you include -I. in the compiler command (or equivalent for
+ an unusual compiler) so that all included PCRE header files are first
+ sought in the current directory. Otherwise you run the risk of picking up
+ a previously-installed file from somewhere else.
+
+ (7) Now link all the compiled code into an object library in whichever form
+ your system keeps such libraries. This is the basic PCRE C library. If
+ your system has static and shared libraries, you may have to do this once
+ for each type.
+
+ (8) Similarly, compile pcreposix.c and link the result (on its own) as the
+ pcreposix library.
+
+ (9) Compile the test program pcretest.c. This needs the functions in the
+ pcre and pcreposix libraries when linking. It also needs the
+ pcre_printint.src source file, which it #includes.
+
+(10) Run pcretest on the testinput files in the testdata directory, and check
+ that the output matches the corresponding testoutput files. Note that the
+ supplied files are in Unix format, with just LF characters as line
+ terminators. You may need to edit them to change this if your system uses
+ a different convention.
+
+(11) If you want to use the pcregrep command, compile and link pcregrep.c; it
+ uses only the basic PCRE library (it does not need the pcreposix library).
THE C++ WRAPPER FUNCTIONS
@@ -131,6 +150,18 @@ additional files. The following files in the distribution are for building PCRE
for use with VP/Borland: makevp_c.txt, makevp_l.txt, makevp.bat, pcregexp.pas.
+STACK SIZE IN WINDOWS ENVIRONMENTS
+
+The default processor stack size of 1Mb in some Windows environments is too
+small for matching patterns that need much recursion. In particular, test 2 may
+fail because of this. Normally, running out of stack causes a crash, but there
+have been cases where the test program has just died silently. See your linker
+documentation for how to increase stack size if you experience problems. The
+Linux default of 8Mb is a reasonable choice for the stack, though even that can
+be too small for some pattern/subject combinations. There is more about stack
+usage in the "pcrestack" documentation.
+
+
COMMENTS ABOUT WIN32 BUILDS
There are two ways of building PCRE using the "configure, make, make install"
@@ -284,5 +315,5 @@ $! Locale could not be set to fr
$!
=========================
-Last Updated: 13 June 2007
+Last Updated: 01 August 2007
****
diff --git a/ext/pcre/pcrelib/config.h b/ext/pcre/pcrelib/config.h
index 510197fa3..b16c6b650 100644
--- a/ext/pcre/pcrelib/config.h
+++ b/ext/pcre/pcrelib/config.h
@@ -178,13 +178,6 @@ them both to 0; an emulation function will be used. */
/* This limit is parameterized just in case anybody ever wants to change it.
Care must be taken if it is increased, because it guards against integer
overflow caused by enormously large patterns. */
-#ifndef MAX_DUPLENGTH
-#define MAX_DUPLENGTH 30000
-#endif
-
-/* This limit is parameterized just in case anybody ever wants to change it.
- Care must be taken if it is increased, because it guards against integer
- overflow caused by enormously large patterns. */
#ifndef MAX_NAME_COUNT
#define MAX_NAME_COUNT 10000
#endif
@@ -224,13 +217,13 @@ them both to 0; an emulation function will be used. */
#define PACKAGE_NAME "PCRE"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "PCRE 7.2"
+#define PACKAGE_STRING "PCRE 7.3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "pcre"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "7.2"
+#define PACKAGE_VERSION "7.3"
/* If you are compiling for a system other than a Unix-like system or
@@ -272,7 +265,7 @@ them both to 0; an emulation function will be used. */
/* Version number of package */
#ifndef VERSION
-#define VERSION "7.2"
+#define VERSION "7.3"
#endif
/* Define to empty if `const' does not conform to ANSI C. */
diff --git a/ext/pcre/pcrelib/dftables.c b/ext/pcre/pcrelib/dftables.c
index baa56a15c..cf3b21052 100644
--- a/ext/pcre/pcrelib/dftables.c
+++ b/ext/pcre/pcrelib/dftables.c
@@ -43,6 +43,8 @@ character tables for PCRE. The tables are built according to the current
locale. Now that pcre_maketables is a function visible to the outside world, we
make use of its code from here in order to be consistent. */
+#include <config.h>
+
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -99,12 +101,15 @@ fprintf(f,
"tables are passed to PCRE by the application that calls it. The tables\n"
"are used only for characters whose code values are less than 256.\n\n");
fprintf(f,
- "The following #include is present because without it gcc 4.x may remove\n"
+ "The following #includes are present because without them gcc 4.x may remove\n"
"the array definition from the final binary if PCRE is built into a static\n"
"library and dead code stripping is activated. This leads to link errors.\n"
"Pulling in the header ensures that the array gets flagged as \"someone\n"
"outside this compilation unit might reference this\" and so it will always\n"
"be supplied to the linker. */\n\n"
+ "#ifdef HAVE_CONFIG_H\n"
+ "#include <config.h>\n"
+ "#endif\n\n"
"#include \"pcre_internal.h\"\n\n");
fprintf(f,
"const unsigned char _pcre_default_tables[] = {\n\n"
diff --git a/ext/pcre/pcrelib/doc/pcre.txt b/ext/pcre/pcrelib/doc/pcre.txt
index 823f15c44..f924f6de8 100644
--- a/ext/pcre/pcrelib/doc/pcre.txt
+++ b/ext/pcre/pcrelib/doc/pcre.txt
@@ -45,30 +45,31 @@ INTRODUCTION
Details of exactly which Perl regular expression features are and are
not supported by PCRE are given in separate documents. See the pcrepat-
- tern and pcrecompat pages.
+ tern and pcrecompat pages. There is a syntax summary in the pcresyntax
+ page.
- Some features of PCRE can be included, excluded, or changed when the
- library is built. The pcre_config() function makes it possible for a
- client to discover which features are available. The features them-
- selves are described in the pcrebuild page. Documentation about build-
- ing PCRE for various operating systems can be found in the README file
+ Some features of PCRE can be included, excluded, or changed when the
+ library is built. The pcre_config() function makes it possible for a
+ client to discover which features are available. The features them-
+ selves are described in the pcrebuild page. Documentation about build-
+ ing PCRE for various operating systems can be found in the README file
in the source distribution.
- The library contains a number of undocumented internal functions and
- data tables that are used by more than one of the exported external
- functions, but which are not intended for use by external callers.
- Their names all begin with "_pcre_", which hopefully will not provoke
+ The library contains a number of undocumented internal functions and
+ data tables that are used by more than one of the exported external
+ functions, but which are not intended for use by external callers.
+ Their names all begin with "_pcre_", which hopefully will not provoke
any name clashes. In some environments, it is possible to control which
- external symbols are exported when a shared library is built, and in
+ external symbols are exported when a shared library is built, and in
these cases the undocumented symbols are not exported.
USER DOCUMENTATION
- The user documentation for PCRE comprises a number of different sec-
- tions. In the "man" format, each of these is a separate "man page". In
- the HTML format, each is a separate page, linked from the index page.
- In the plain text format, all the sections are concatenated, for ease
+ The user documentation for PCRE comprises a number of different sec-
+ tions. In the "man" format, each of these is a separate "man page". In
+ the HTML format, each is a separate page, linked from the index page.
+ In the plain text format, all the sections are concatenated, for ease
of searching. The sections are as follows:
pcre this document
@@ -83,6 +84,7 @@ USER DOCUMENTATION
pcrepartial details of the partial matching facility
pcrepattern syntax and semantics of supported
regular expressions
+ pcresyntax quick syntax reference
pcreperform discussion of performance issues
pcreposix the POSIX-compatible C API
pcreprecompile details of saving and re-using precompiled patterns
@@ -90,26 +92,24 @@ USER DOCUMENTATION
pcrestack discussion of stack usage
pcretest description of the pcretest testing command
- In addition, in the "man" and HTML formats, there is a short page for
+ In addition, in the "man" and HTML formats, there is a short page for
each C library function, listing its arguments and results.
LIMITATIONS
- There are some size limitations in PCRE but it is hoped that they will
+ There are some size limitations in PCRE but it is hoped that they will
never in practice be relevant.
- The maximum length of a compiled pattern is 65539 (sic) bytes if PCRE
+ The maximum length of a compiled pattern is 65539 (sic) bytes if PCRE
is compiled with the default internal linkage size of 2. If you want to
- process regular expressions that are truly enormous, you can compile
- PCRE with an internal linkage size of 3 or 4 (see the README file in
- the source distribution and the pcrebuild documentation for details).
- In these cases the limit is substantially larger. However, the speed
+ process regular expressions that are truly enormous, you can compile
+ PCRE with an internal linkage size of 3 or 4 (see the README file in
+ the source distribution and the pcrebuild documentation for details).
+ In these cases the limit is substantially larger. However, the speed
of execution is slower.
- All values in repeating quantifiers must be less than 65536. The maxi-
- mum compiled length of subpattern with an explicit repeat count is
- 30000 bytes. The maximum number of capturing subpatterns is 65535.
+ All values in repeating quantifiers must be less than 65536.
There is no limit to the number of parenthesized subpatterns, but there
can be no more than 65535 capturing subpatterns.
@@ -117,99 +117,129 @@ LIMITATIONS
The maximum length of name for a named subpattern is 32 characters, and
the maximum number of named subpatterns is 10000.
- The maximum length of a subject string is the largest positive number
- that an integer variable can hold. However, when using the traditional
+ The maximum length of a subject string is the largest positive number
+ that an integer variable can hold. However, when using the traditional
matching function, PCRE uses recursion to handle subpatterns and indef-
- inite repetition. This means that the available stack space may limit
+ inite repetition. This means that the available stack space may limit
the size of a subject string that can be processed by certain patterns.
For a discussion of stack issues, see the pcrestack documentation.
UTF-8 AND UNICODE PROPERTY SUPPORT
- From release 3.3, PCRE has had some support for character strings
- encoded in the UTF-8 format. For release 4.0 this was greatly extended
- to cover most common requirements, and in release 5.0 additional sup-
+ From release 3.3, PCRE has had some support for character strings
+ encoded in the UTF-8 format. For release 4.0 this was greatly extended
+ to cover most common requirements, and in release 5.0 additional sup-
port for Unicode general category properties was added.
- In order process UTF-8 strings, you must build PCRE to include UTF-8
- support in the code, and, in addition, you must call pcre_compile()
- with the PCRE_UTF8 option flag. When you do this, both the pattern and
- any subject strings that are matched against it are treated as UTF-8
+ In order process UTF-8 strings, you must build PCRE to include UTF-8
+ support in the code, and, in addition, you must call pcre_compile()
+ with the PCRE_UTF8 option flag. When you do this, both the pattern and
+ any subject strings that are matched against it are treated as UTF-8
strings instead of just strings of bytes.
- If you compile PCRE with UTF-8 support, but do not use it at run time,
- the library will be a bit bigger, but the additional run time overhead
+ If you compile PCRE with UTF-8 support, but do not use it at run time,
+ the library will be a bit bigger, but the additional run time overhead
is limited to testing the PCRE_UTF8 flag occasionally, so should not be
very big.
If PCRE is built with Unicode character property support (which implies
- UTF-8 support), the escape sequences \p{..}, \P{..}, and \X are sup-
+ UTF-8 support), the escape sequences \p{..}, \P{..}, and \X are sup-
ported. The available properties that can be tested are limited to the
- general category properties such as Lu for an upper case letter or Nd
- for a decimal number, the Unicode script names such as Arabic or Han,
- and the derived properties Any and L&. A full list is given in the
+ general category properties such as Lu for an upper case letter or Nd
+ for a decimal number, the Unicode script names such as Arabic or Han,
+ and the derived properties Any and L&. A full list is given in the
pcrepattern documentation. Only the short names for properties are sup-
- ported. For example, \p{L} matches a letter. Its Perl synonym, \p{Let-
- ter}, is not supported. Furthermore, in Perl, many properties may
- optionally be prefixed by "Is", for compatibility with Perl 5.6. PCRE
+ ported. For example, \p{L} matches a letter. Its Perl synonym, \p{Let-
+ ter}, is not supported. Furthermore, in Perl, many properties may
+ optionally be prefixed by "Is", for compatibility with Perl 5.6. PCRE
does not support this.
- The following comments apply when PCRE is running in UTF-8 mode:
-
- 1. When you set the PCRE_UTF8 flag, the strings passed as patterns and
- subjects are checked for validity on entry to the relevant functions.
- If an invalid UTF-8 string is passed, an error return is given. In some
- situations, you may already know that your strings are valid, and
- therefore want to skip these checks in order to improve performance. If
- you set the PCRE_NO_UTF8_CHECK flag at compile time or at run time,
- PCRE assumes that the pattern or subject it is given (respectively)
- contains only valid UTF-8 codes. In this case, it does not diagnose an
- invalid UTF-8 string. If you pass an invalid UTF-8 string to PCRE when
- PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program may
- crash.
-
- 2. An unbraced hexadecimal escape sequence (such as \xb3) matches a
+ Validity of UTF-8 strings
+
+ When you set the PCRE_UTF8 flag, the strings passed as patterns and
+ subjects are (by default) checked for validity on entry to the relevant
+ functions. From release 7.3 of PCRE, the check is according the rules
+ of RFC 3629, which are themselves derived from the Unicode specifica-
+ tion. Earlier releases of PCRE followed the rules of RFC 2279, which
+ allows the full range of 31-bit values (0 to 0x7FFFFFFF). The current
+ check allows only values in the range U+0 to U+10FFFF, excluding U+D800
+ to U+DFFF.
+
+ The excluded code points are the "Low Surrogate Area" of Unicode, of
+ which the Unicode Standard says this: "The Low Surrogate Area does not
+ contain any character assignments, consequently no character code
+ charts or namelists are provided for this area. Surrogates are reserved
+ for use with UTF-16 and then must be used in pairs." The code points
+ that are encoded by UTF-16 pairs are available as independent code
+ points in the UTF-8 encoding. (In other words, the whole surrogate
+ thing is a fudge for UTF-16 which unfortunately messes up UTF-8.)
+
+ If an invalid UTF-8 string is passed to PCRE, an error return
+ (PCRE_ERROR_BADUTF8) is given. In some situations, you may already know
+ that your strings are valid, and therefore want to skip these checks in
+ order to improve performance. If you set the PCRE_NO_UTF8_CHECK flag at
+ compile time or at run time, PCRE assumes that the pattern or subject
+ it is given (respectively) contains only valid UTF-8 codes. In this
+ case, it does not diagnose an invalid UTF-8 string.
+
+ If you pass an invalid UTF-8 string when PCRE_NO_UTF8_CHECK is set,
+ what happens depends on why the string is invalid. If the string con-
+ forms to the "old" definition of UTF-8 (RFC 2279), it is processed as a
+ string of characters in the range 0 to 0x7FFFFFFF. In other words,
+ apart from the initial validity test, PCRE (when in UTF-8 mode) handles
+ strings according to the more liberal rules of RFC 2279. However, if
+ the string does not even conform to RFC 2279, the result is undefined.
+ Your program may crash.
+
+ If you want to process strings of values in the full range 0 to
+ 0x7FFFFFFF, encoded in a UTF-8-like manner as per the old RFC, you can
+ set PCRE_NO_UTF8_CHECK to bypass the more restrictive test. However, in
+ this situation, you will have to apply your own validity check.
+
+ General comments about UTF-8 mode
+
+ 1. An unbraced hexadecimal escape sequence (such as \xb3) matches a
two-byte UTF-8 character if the value is greater than 127.
- 3. Octal numbers up to \777 are recognized, and match two-byte UTF-8
+ 2. Octal numbers up to \777 are recognized, and match two-byte UTF-8
characters for values greater than \177.
- 4. Repeat quantifiers apply to complete UTF-8 characters, not to indi-
+ 3. Repeat quantifiers apply to complete UTF-8 characters, not to indi-
vidual bytes, for example: \x{100}{3}.
- 5. The dot metacharacter matches one UTF-8 character instead of a sin-
+ 4. The dot metacharacter matches one UTF-8 character instead of a sin-
gle byte.
- 6. The escape sequence \C can be used to match a single byte in UTF-8
- mode, but its use can lead to some strange effects. This facility is
+ 5. The escape sequence \C can be used to match a single byte in UTF-8
+ mode, but its use can lead to some strange effects. This facility is
not available in the alternative matching function, pcre_dfa_exec().
- 7. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
- test characters of any code value, but the characters that PCRE recog-
- nizes as digits, spaces, or word characters remain the same set as
+ 6. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
+ test characters of any code value, but the characters that PCRE recog-
+ nizes as digits, spaces, or word characters remain the same set as
before, all with values less than 256. This remains true even when PCRE
- includes Unicode property support, because to do otherwise would slow
- down PCRE in many common cases. If you really want to test for a wider
- sense of, say, "digit", you must use Unicode property tests such as
+ includes Unicode property support, because to do otherwise would slow
+ down PCRE in many common cases. If you really want to test for a wider
+ sense of, say, "digit", you must use Unicode property tests such as
\p{Nd}.
- 8. Similarly, characters that match the POSIX named character classes
+ 7. Similarly, characters that match the POSIX named character classes
are all low-valued characters.
- 9. However, the Perl 5.10 horizontal and vertical whitespace matching
+ 8. However, the Perl 5.10 horizontal and vertical whitespace matching
escapes (\h, \H, \v, and \V) do match all the appropriate Unicode char-
acters.
- 10. Case-insensitive matching applies only to characters whose values
- are less than 128, unless PCRE is built with Unicode property support.
- Even when Unicode property support is available, PCRE still uses its
- own character tables when checking the case of low-valued characters,
- so as not to degrade performance. The Unicode property information is
+ 9. Case-insensitive matching applies only to characters whose values
+ are less than 128, unless PCRE is built with Unicode property support.
+ Even when Unicode property support is available, PCRE still uses its
+ own character tables when checking the case of low-valued characters,
+ so as not to degrade performance. The Unicode property information is
used only for characters with higher values. Even when Unicode property
support is available, PCRE supports case-insensitive matching only when
- there is a one-to-one mapping between a letter's cases. There are a
- small number of many-to-one mappings in Unicode; these are not sup-
+ there is a one-to-one mapping between a letter's cases. There are a
+ small number of many-to-one mappings in Unicode; these are not sup-
ported by PCRE.
@@ -219,14 +249,14 @@ AUTHOR
University Computing Service
Cambridge CB2 3QH, England.
- Putting an actual email address here seems to have been a spam magnet,
- so I've taken it away. If you want to email me, use my two initials,
+ Putting an actual email address here seems to have been a spam magnet,
+ so I've taken it away. If you want to email me, use my two initials,
followed by the two digits 10, at the domain cam.ac.uk.
REVISION
- Last updated: 13 June 2007
+ Last updated: 09 August 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -459,13 +489,14 @@ USING EBCDIC CODE
PCRE assumes by default that it will run in an environment where the
character code is ASCII (or Unicode, which is a superset of ASCII).
- PCRE can, however, be compiled to run in an EBCDIC environment by
- adding
+ This is the case for most computer operating systems. PCRE can, how-
+ ever, be compiled to run in an EBCDIC environment by adding
--enable-ebcdic
to the configure command. This setting implies --enable-rebuild-charta-
- bles.
+ bles. You should only use it if you know that you are in an EBCDIC
+ environment (for example, an IBM mainframe operating system).
SEE ALSO
@@ -482,7 +513,7 @@ AUTHOR
REVISION
- Last updated: 05 June 2007
+ Last updated: 30 July 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -626,31 +657,34 @@ THE ALTERNATIVE MATCHING ALGORITHM
6. Callouts are supported, but the value of the capture_top field is
always 1, and the value of the capture_last field is always -1.
- 7. The \C escape sequence, which (in the standard algorithm) matches a
+ 7. The \C escape sequence, which (in the standard algorithm) matches a
single byte, even in UTF-8 mode, is not supported because the alterna-
tive algorithm moves through the subject string one character at a
time, for all active paths through the tree.
+ 8. None of the backtracking control verbs such as (*PRUNE) are sup-
+ ported.
+
ADVANTAGES OF THE ALTERNATIVE ALGORITHM
- Using the alternative matching algorithm provides the following advan-
+ Using the alternative matching algorithm provides the following advan-
tages:
1. All possible matches (at a single point in the subject) are automat-
- ically found, and in particular, the longest match is found. To find
+ ically found, and in particular, the longest match is found. To find
more than one match using the standard algorithm, you have to do kludgy
things with callouts.
- 2. There is much better support for partial matching. The restrictions
- on the content of the pattern that apply when using the standard algo-
- rithm for partial matching do not apply to the alternative algorithm.
- For non-anchored patterns, the starting position of a partial match is
+ 2. There is much better support for partial matching. The restrictions
+ on the content of the pattern that apply when using the standard algo-
+ rithm for partial matching do not apply to the alternative algorithm.
+ For non-anchored patterns, the starting position of a partial match is
available.
- 3. Because the alternative algorithm scans the subject string just
- once, and never needs to backtrack, it is possible to pass very long
- subject strings to the matching function in several pieces, checking
+ 3. Because the alternative algorithm scans the subject string just
+ once, and never needs to backtrack, it is possible to pass very long
+ subject strings to the matching function in several pieces, checking
for partial matching each time.
@@ -658,8 +692,8 @@ DISADVANTAGES OF THE ALTERNATIVE ALGORITHM
The alternative algorithm suffers from a number of disadvantages:
- 1. It is substantially slower than the standard algorithm. This is
- partly because it has to search for all possible matches, but is also
+ 1. It is substantially slower than the standard algorithm. This is
+ partly because it has to search for all possible matches, but is also
because it is less susceptible to optimization.
2. Capturing parentheses and back references are not supported.
@@ -677,7 +711,7 @@ AUTHOR
REVISION
- Last updated: 29 May 2007
+ Last updated: 08 August 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -874,13 +908,19 @@ NEWLINES
dard. When PCRE is run, the default can be overridden, either when a
pattern is compiled, or when it is matched.
+ At compile time, the newline convention can be specified by the options
+ argument of pcre_compile(), or it can be specified by special text at
+ the start of the pattern itself; this overrides any other settings. See
+ the pcrepattern page for details of the special character sequences.
+
In the PCRE documentation the word "newline" is used to mean "the char-
- acter or pair of characters that indicate a line break". The choice of
- newline convention affects the handling of the dot, circumflex, and
+ acter or pair of characters that indicate a line break". The choice of
+ newline convention affects the handling of the dot, circumflex, and
dollar metacharacters, the handling of #-comments in /x mode, and, when
- CRLF is a recognized line ending sequence, the match position advance-
- ment for a non-anchored pattern. The choice of newline convention does
- not affect the interpretation of the \n or \r escape sequences.
+ CRLF is a recognized line ending sequence, the match position advance-
+ ment for a non-anchored pattern. There is more detail about this in the
+ section on pcre_exec() options below. The choice of newline convention
+ does not affect the interpretation of the \n or \r escape sequences.
MULTITHREADING
@@ -1221,21 +1261,22 @@ COMPILING A PATTERN
PCRE_NO_UTF8_CHECK
When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
- automatically checked. If an invalid UTF-8 sequence of bytes is found,
- pcre_compile() returns an error. If you already know that your pattern
- is valid, and you want to skip this check for performance reasons, you
- can set the PCRE_NO_UTF8_CHECK option. When it is set, the effect of
- passing an invalid UTF-8 string as a pattern is undefined. It may cause
- your program to crash. Note that this option can also be passed to
- pcre_exec() and pcre_dfa_exec(), to suppress the UTF-8 validity check-
- ing of subject strings.
+ automatically checked. There is a discussion about the validity of
+ UTF-8 strings in the main pcre page. If an invalid UTF-8 sequence of
+ bytes is found, pcre_compile() returns an error. If you already know
+ that your pattern is valid, and you want to skip this check for perfor-
+ mance reasons, you can set the PCRE_NO_UTF8_CHECK option. When it is
+ set, the effect of passing an invalid UTF-8 string as a pattern is
+ undefined. It may cause your program to crash. Note that this option
+ can also be passed to pcre_exec() and pcre_dfa_exec(), to suppress the
+ UTF-8 validity checking of subject strings.
COMPILATION ERROR CODES
- The following table lists the error codes than may be returned by
- pcre_compile2(), along with the error messages that may be returned by
- both compiling functions. As PCRE has developed, some error codes have
+ The following table lists the error codes than may be returned by
+ pcre_compile2(), along with the error messages that may be returned by
+ both compiling functions. As PCRE has developed, some error codes have
fallen out of use. To avoid confusion, they have not been re-used.
0 no error
@@ -1288,10 +1329,10 @@ COMPILATION ERROR CODES
47 unknown property name after \P or \p
48 subpattern name is too long (maximum 32 characters)
49 too many named subpatterns (maximum 10,000)
- 50 repeated subpattern is too long
+ 50 [this code is not in use]
51 octal value is greater than \377 (not in UTF-8 mode)
52 internal error: overran compiling workspace
- 53 internal error: previously-checked referenced subpattern not
+ 53 internal error: previously-checked referenced subpattern not
found
54 DEFINE group contains more than one branch
55 repeating a DEFINE group is not allowed
@@ -1306,32 +1347,32 @@ STUDYING A PATTERN
pcre_extra *pcre_study(const pcre *code, int options
const char **errptr);
- If a compiled pattern is going to be used several times, it is worth
+ If a compiled pattern is going to be used several times, it is worth
spending more time analyzing it in order to speed up the time taken for
- matching. The function pcre_study() takes a pointer to a compiled pat-
+ matching. The function pcre_study() takes a pointer to a compiled pat-
tern as its first argument. If studying the pattern produces additional
- information that will help speed up matching, pcre_study() returns a
- pointer to a pcre_extra block, in which the study_data field points to
+ information that will help speed up matching, pcre_study() returns a
+ pointer to a pcre_extra block, in which the study_data field points to
the results of the study.
The returned value from pcre_study() can be passed directly to
- pcre_exec(). However, a pcre_extra block also contains other fields
- that can be set by the caller before the block is passed; these are
+ pcre_exec(). However, a pcre_extra block also contains other fields
+ that can be set by the caller before the block is passed; these are
described below in the section on matching a pattern.
- If studying the pattern does not produce any additional information
+ If studying the pattern does not produce any additional information
pcre_study() returns NULL. In that circumstance, if the calling program
- wants to pass any of the other fields to pcre_exec(), it must set up
+ wants to pass any of the other fields to pcre_exec(), it must set up
its own pcre_extra block.
- The second argument of pcre_study() contains option bits. At present,
+ The second argument of pcre_study() contains option bits. At present,
no options are defined, and this argument should always be zero.
- The third argument for pcre_study() is a pointer for an error message.
- If studying succeeds (even if no data is returned), the variable it
- points to is set to NULL. Otherwise it is set to point to a textual
+ The third argument for pcre_study() is a pointer for an error message.
+ If studying succeeds (even if no data is returned), the variable it
+ points to is set to NULL. Otherwise it is set to point to a textual
error message. This is a static string that is part of the library. You
- must not try to free it. You should test the error pointer for NULL
+ must not try to free it. You should test the error pointer for NULL
after calling pcre_study(), to be sure that it has run successfully.
This is a typical call to pcre_study():
@@ -1343,62 +1384,62 @@ STUDYING A PATTERN
&error); /* set to NULL or points to a message */
At present, studying a pattern is useful only for non-anchored patterns
- that do not have a single fixed starting character. A bitmap of possi-
+ that do not have a single fixed starting character. A bitmap of possi-
ble starting bytes is created.
LOCALE SUPPORT
- PCRE handles caseless matching, and determines whether characters are
- letters, digits, or whatever, by reference to a set of tables, indexed
- by character value. When running in UTF-8 mode, this applies only to
- characters with codes less than 128. Higher-valued codes never match
- escapes such as \w or \d, but can be tested with \p if PCRE is built
- with Unicode character property support. The use of locales with Uni-
- code is discouraged. If you are handling characters with codes greater
- than 128, you should either use UTF-8 and Unicode, or use locales, but
+ PCRE handles caseless matching, and determines whether characters are
+ letters, digits, or whatever, by reference to a set of tables, indexed
+ by character value. When running in UTF-8 mode, this applies only to
+ characters with codes less than 128. Higher-valued codes never match
+ escapes such as \w or \d, but can be tested with \p if PCRE is built
+ with Unicode character property support. The use of locales with Uni-
+ code is discouraged. If you are handling characters with codes greater
+ than 128, you should either use UTF-8 and Unicode, or use locales, but
not try to mix the two.
- PCRE contains an internal set of tables that are used when the final
- argument of pcre_compile() is NULL. These are sufficient for many
+ PCRE contains an internal set of tables that are used when the final
+ argument of pcre_compile() is NULL. These are sufficient for many
applications. Normally, the internal tables recognize only ASCII char-
acters. However, when PCRE is built, it is possible to cause the inter-
nal tables to be rebuilt in the default "C" locale of the local system,
which may cause them to be different.
- The internal tables can always be overridden by tables supplied by the
+ The internal tables can always be overridden by tables supplied by the
application that calls PCRE. These may be created in a different locale
- from the default. As more and more applications change to using Uni-
+ from the default. As more and more applications change to using Uni-
code, the need for this locale support is expected to die away.
- External tables are built by calling the pcre_maketables() function,
- which has no arguments, in the relevant locale. The result can then be
- passed to pcre_compile() or pcre_exec() as often as necessary. For
- example, to build and use tables that are appropriate for the French
- locale (where accented characters with values greater than 128 are
+ External tables are built by calling the pcre_maketables() function,
+ which has no arguments, in the relevant locale. The result can then be
+ passed to pcre_compile() or pcre_exec() as often as necessary. For
+ example, to build and use tables that are appropriate for the French
+ locale (where accented characters with values greater than 128 are
treated as letters), the following code could be used:
setlocale(LC_CTYPE, "fr_FR");
tables = pcre_maketables();
re = pcre_compile(..., tables);
- The locale name "fr_FR" is used on Linux and other Unix-like systems;
+ The locale name "fr_FR" is used on Linux and other Unix-like systems;
if you are using Windows, the name for the French locale is "french".
- When pcre_maketables() runs, the tables are built in memory that is
- obtained via pcre_malloc. It is the caller's responsibility to ensure
- that the memory containing the tables remains available for as long as
+ When pcre_maketables() runs, the tables are built in memory that is
+ obtained via pcre_malloc. It is the caller's responsibility to ensure
+ that the memory containing the tables remains available for as long as
it is needed.
The pointer that is passed to pcre_compile() is saved with the compiled
- pattern, and the same tables are used via this pointer by pcre_study()
+ pattern, and the same tables are used via this pointer by pcre_study()
and normally also by pcre_exec(). Thus, by default, for any single pat-
tern, compilation, studying and matching all happen in the same locale,
but different patterns can be compiled in different locales.
- It is possible to pass a table pointer or NULL (indicating the use of
- the internal tables) to pcre_exec(). Although not intended for this
- purpose, this facility could be used to match a pattern in a different
+ It is possible to pass a table pointer or NULL (indicating the use of
+ the internal tables) to pcre_exec(). Although not intended for this
+ purpose, this facility could be used to match a pattern in a different
locale from the one in which it was compiled. Passing table pointers at
run time is discussed below in the section on matching a pattern.
@@ -1408,15 +1449,15 @@ INFORMATION ABOUT A PATTERN
int pcre_fullinfo(const pcre *code, const pcre_extra *extra,
int what, void *where);
- The pcre_fullinfo() function returns information about a compiled pat-
+ The pcre_fullinfo() function returns information about a compiled pat-
tern. It replaces the obsolete pcre_info() function, which is neverthe-
less retained for backwards compability (and is documented below).
- The first argument for pcre_fullinfo() is a pointer to the compiled
- pattern. The second argument is the result of pcre_study(), or NULL if
- the pattern was not studied. The third argument specifies which piece
- of information is required, and the fourth argument is a pointer to a
- variable to receive the data. The yield of the function is zero for
+ The first argument for pcre_fullinfo() is a pointer to the compiled
+ pattern. The second argument is the result of pcre_study(), or NULL if
+ the pattern was not studied. The third argument specifies which piece
+ of information is required, and the fourth argument is a pointer to a
+ variable to receive the data. The yield of the function is zero for
success, or one of the following negative numbers:
PCRE_ERROR_NULL the argument code was NULL
@@ -1424,9 +1465,9 @@ INFORMATION ABOUT A PATTERN
PCRE_ERROR_BADMAGIC the "magic number" was not found
PCRE_ERROR_BADOPTION the value of what was invalid
- The "magic number" is placed at the start of each compiled pattern as
- an simple check against passing an arbitrary memory pointer. Here is a
- typical call of pcre_fullinfo(), to obtain the length of the compiled
+ The "magic number" is placed at the start of each compiled pattern as
+ an simple check against passing an arbitrary memory pointer. Here is a
+ typical call of pcre_fullinfo(), to obtain the length of the compiled
pattern:
int rc;
@@ -1437,69 +1478,75 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_SIZE, /* what is required */
&length); /* where to put the data */
- The possible values for the third argument are defined in pcre.h, and
+ The possible values for the third argument are defined in pcre.h, and
are as follows:
PCRE_INFO_BACKREFMAX
- Return the number of the highest back reference in the pattern. The
- fourth argument should point to an int variable. Zero is returned if
+ Return the number of the highest back reference in the pattern. The
+ fourth argument should point to an int variable. Zero is returned if
there are no back references.
PCRE_INFO_CAPTURECOUNT
- Return the number of capturing subpatterns in the pattern. The fourth
+ Return the number of capturing subpatterns in the pattern. The fourth
argument should point to an int variable.
PCRE_INFO_DEFAULT_TABLES
- Return a pointer to the internal default character tables within PCRE.
- The fourth argument should point to an unsigned char * variable. This
+ Return a pointer to the internal default character tables within PCRE.
+ The fourth argument should point to an unsigned char * variable. This
information call is provided for internal use by the pcre_study() func-
- tion. External callers can cause PCRE to use its internal tables by
+ tion. External callers can cause PCRE to use its internal tables by
passing a NULL table pointer.
PCRE_INFO_FIRSTBYTE
- Return information about the first byte of any matched string, for a
- non-anchored pattern. The fourth argument should point to an int vari-
- able. (This option used to be called PCRE_INFO_FIRSTCHAR; the old name
+ Return information about the first byte of any matched string, for a
+ non-anchored pattern. The fourth argument should point to an int vari-
+ able. (This option used to be called PCRE_INFO_FIRSTCHAR; the old name
is still recognized for backwards compatibility.)
- If there is a fixed first byte, for example, from a pattern such as
+ If there is a fixed first byte, for example, from a pattern such as
(cat|cow|coyote), its value is returned. Otherwise, if either
- (a) the pattern was compiled with the PCRE_MULTILINE option, and every
+ (a) the pattern was compiled with the PCRE_MULTILINE option, and every
branch starts with "^", or
(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not
set (if it were set, the pattern would be anchored),
- -1 is returned, indicating that the pattern matches only at the start
- of a subject string or after any newline within the string. Otherwise
+ -1 is returned, indicating that the pattern matches only at the start
+ of a subject string or after any newline within the string. Otherwise
-2 is returned. For anchored patterns, -2 is returned.
PCRE_INFO_FIRSTTABLE
- If the pattern was studied, and this resulted in the construction of a
+ If the pattern was studied, and this resulted in the construction of a
256-bit table indicating a fixed set of bytes for the first byte in any
- matching string, a pointer to the table is returned. Otherwise NULL is
- returned. The fourth argument should point to an unsigned char * vari-
+ matching string, a pointer to the table is returned. Otherwise NULL is
+ returned. The fourth argument should point to an unsigned char * vari-
able.
+ PCRE_INFO_HASCRORLF
+
+ Return 1 if the pattern contains any explicit matches for CR or LF
+ characters, otherwise 0. The fourth argument should point to an int
+ variable.
+
PCRE_INFO_JCHANGED
- Return 1 if the (?J) option setting is used in the pattern, otherwise
+ Return 1 if the (?J) option setting is used in the pattern, otherwise
0. The fourth argument should point to an int variable. The (?J) inter-
nal option setting changes the local PCRE_DUPNAMES option.
PCRE_INFO_LASTLITERAL
- Return the value of the rightmost literal byte that must exist in any
- matched string, other than at its start, if such a byte has been
+ Return the value of the rightmost literal byte that must exist in any
+ matched string, other than at its start, if such a byte has been
recorded. The fourth argument should point to an int variable. If there
- is no such byte, -1 is returned. For anchored patterns, a last literal
- byte is recorded only if it follows something of variable length. For
+ is no such byte, -1 is returned. For anchored patterns, a last literal
+ byte is recorded only if it follows something of variable length. For
example, for the pattern /^a\d+z\d+/ the returned value is "z", but for
/^a\dz\d/ the returned value is -1.
@@ -1507,34 +1554,34 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_NAMEENTRYSIZE
PCRE_INFO_NAMETABLE
- PCRE supports the use of named as well as numbered capturing parenthe-
- ses. The names are just an additional way of identifying the parenthe-
+ PCRE supports the use of named as well as numbered capturing parenthe-
+ ses. The names are just an additional way of identifying the parenthe-
ses, which still acquire numbers. Several convenience functions such as
- pcre_get_named_substring() are provided for extracting captured sub-
- strings by name. It is also possible to extract the data directly, by
- first converting the name to a number in order to access the correct
+ pcre_get_named_substring() are provided for extracting captured sub-
+ strings by name. It is also possible to extract the data directly, by
+ first converting the name to a number in order to access the correct
pointers in the output vector (described with pcre_exec() below). To do
- the conversion, you need to use the name-to-number map, which is
+ the conversion, you need to use the name-to-number map, which is
described by these three values.
The map consists of a number of fixed-size entries. PCRE_INFO_NAMECOUNT
gives the number of entries, and PCRE_INFO_NAMEENTRYSIZE gives the size
- of each entry; both of these return an int value. The entry size
- depends on the length of the longest name. PCRE_INFO_NAMETABLE returns
- a pointer to the first entry of the table (a pointer to char). The
+ of each entry; both of these return an int value. The entry size
+ depends on the length of the longest name. PCRE_INFO_NAMETABLE returns
+ a pointer to the first entry of the table (a pointer to char). The
first two bytes of each entry are the number of the capturing parenthe-
- sis, most significant byte first. The rest of the entry is the corre-
- sponding name, zero terminated. The names are in alphabetical order.
+ sis, most significant byte first. The rest of the entry is the corre-
+ sponding name, zero terminated. The names are in alphabetical order.
When PCRE_DUPNAMES is set, duplicate names are in order of their paren-
- theses numbers. For example, consider the following pattern (assume
- PCRE_EXTENDED is set, so white space - including newlines - is
+ theses numbers. For example, consider the following pattern (assume
+ PCRE_EXTENDED is set, so white space - including newlines - is
ignored):
(?<date> (?<year>(\d\d)?\d\d) -
(?<month>\d\d) - (?<day>\d\d) )
- There are four named subpatterns, so the table has four entries, and
- each entry in the table is eight bytes long. The table is as follows,
+ There are four named subpatterns, so the table has four entries, and
+ each entry in the table is eight bytes long. The table is as follows,
with non-printing bytes shows in hexadecimal, and undefined bytes shown
as ??:
@@ -1543,25 +1590,29 @@ INFORMATION ABOUT A PATTERN
00 04 m o n t h 00
00 02 y e a r 00 ??
- When writing code to extract data from named subpatterns using the
- name-to-number map, remember that the length of the entries is likely
+ When writing code to extract data from named subpatterns using the
+ name-to-number map, remember that the length of the entries is likely
to be different for each compiled pattern.
PCRE_INFO_OKPARTIAL
- Return 1 if the pattern can be used for partial matching, otherwise 0.
- The fourth argument should point to an int variable. The pcrepartial
- documentation lists the restrictions that apply to patterns when par-
+ Return 1 if the pattern can be used for partial matching, otherwise 0.
+ The fourth argument should point to an int variable. The pcrepartial
+ documentation lists the restrictions that apply to patterns when par-
tial matching is used.
PCRE_INFO_OPTIONS
- Return a copy of the options with which the pattern was compiled. The
- fourth argument should point to an unsigned long int variable. These
+ Return a copy of the options with which the pattern was compiled. The
+ fourth argument should point to an unsigned long int variable. These
option bits are those specified in the call to pcre_compile(), modified
- by any top-level option settings within the pattern itself.
+ by any top-level option settings at the start of the pattern itself. In
+ other words, they are the options that will be in force when matching
+ starts. For example, if the pattern /(?im)abc(?-i)d/ is compiled with
+ the PCRE_EXTENDED option, the result is PCRE_CASELESS, PCRE_MULTILINE,
+ and PCRE_EXTENDED.
- A pattern is automatically anchored by PCRE if all of its top-level
+ A pattern is automatically anchored by PCRE if all of its top-level
alternatives begin with one of the following:
^ unless PCRE_MULTILINE is set
@@ -1575,7 +1626,7 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_SIZE
- Return the size of the compiled pattern, that is, the value that was
+ Return the size of the compiled pattern, that is, the value that was
passed as the argument to pcre_malloc() when PCRE was getting memory in
which to place the compiled data. The fourth argument should point to a
size_t variable.
@@ -1583,9 +1634,9 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_STUDYSIZE
Return the size of the data block pointed to by the study_data field in
- a pcre_extra block. That is, it is the value that was passed to
+ a pcre_extra block. That is, it is the value that was passed to
pcre_malloc() when PCRE was getting memory into which to place the data
- created by pcre_study(). The fourth argument should point to a size_t
+ created by pcre_study(). The fourth argument should point to a size_t
variable.
@@ -1593,21 +1644,21 @@ OBSOLETE INFO FUNCTION
int pcre_info(const pcre *code, int *optptr, int *firstcharptr);
- The pcre_info() function is now obsolete because its interface is too
- restrictive to return all the available data about a compiled pattern.
- New programs should use pcre_fullinfo() instead. The yield of
- pcre_info() is the number of capturing subpatterns, or one of the fol-
+ The pcre_info() function is now obsolete because its interface is too
+ restrictive to return all the available data about a compiled pattern.
+ New programs should use pcre_fullinfo() instead. The yield of
+ pcre_info() is the number of capturing subpatterns, or one of the fol-
lowing negative numbers:
PCRE_ERROR_NULL the argument code was NULL
PCRE_ERROR_BADMAGIC the "magic number" was not found
- If the optptr argument is not NULL, a copy of the options with which
- the pattern was compiled is placed in the integer it points to (see
+ If the optptr argument is not NULL, a copy of the options with which
+ the pattern was compiled is placed in the integer it points to (see
PCRE_INFO_OPTIONS above).
- If the pattern is not anchored and the firstcharptr argument is not
- NULL, it is used to pass back information about the first character of
+ If the pattern is not anchored and the firstcharptr argument is not
+ NULL, it is used to pass back information about the first character of
any matched string (see PCRE_INFO_FIRSTBYTE above).
@@ -1615,21 +1666,21 @@ REFERENCE COUNTS
int pcre_refcount(pcre *code, int adjust);
- The pcre_refcount() function is used to maintain a reference count in
+ The pcre_refcount() function is used to maintain a reference count in
the data block that contains a compiled pattern. It is provided for the
- benefit of applications that operate in an object-oriented manner,
+ benefit of applications that operate in an object-oriented manner,
where different parts of the application may be using the same compiled
pattern, but you want to free the block when they are all done.
When a pattern is compiled, the reference count field is initialized to
- zero. It is changed only by calling this function, whose action is to
- add the adjust value (which may be positive or negative) to it. The
+ zero. It is changed only by calling this function, whose action is to
+ add the adjust value (which may be positive or negative) to it. The
yield of the function is the new value. However, the value of the count
- is constrained to lie between 0 and 65535, inclusive. If the new value
+ is constrained to lie between 0 and 65535, inclusive. If the new value
is outside these limits, it is forced to the appropriate limit value.
- Except when it is zero, the reference count is not correctly preserved
- if a pattern is compiled on one host and then transferred to a host
+ Except when it is zero, the reference count is not correctly preserved
+ if a pattern is compiled on one host and then transferred to a host
whose byte-order is different. (This seems a highly unlikely scenario.)
@@ -1639,18 +1690,18 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
const char *subject, int length, int startoffset,
int options, int *ovector, int ovecsize);
- The function pcre_exec() is called to match a subject string against a
- compiled pattern, which is passed in the code argument. If the pattern
+ The function pcre_exec() is called to match a subject string against a
+ compiled pattern, which is passed in the code argument. If the pattern
has been studied, the result of the study should be passed in the extra
- argument. This function is the main matching facility of the library,
+ argument. This function is the main matching facility of the library,
and it operates in a Perl-like manner. For specialist use there is also
- an alternative matching function, which is described below in the sec-
+ an alternative matching function, which is described below in the sec-
tion about the pcre_dfa_exec() function.
- In most applications, the pattern will have been compiled (and option-
- ally studied) in the same process that calls pcre_exec(). However, it
+ In most applications, the pattern will have been compiled (and option-
+ ally studied) in the same process that calls pcre_exec(). However, it
is possible to save compiled patterns and study data, and then use them
- later in different processes, possibly even on different hosts. For a
+ later in different processes, possibly even on different hosts. For a
discussion about this, see the pcreprecompile documentation.
Here is an example of a simple call to pcre_exec():
@@ -1669,10 +1720,10 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
Extra data for pcre_exec()
- If the extra argument is not NULL, it must point to a pcre_extra data
- block. The pcre_study() function returns such a block (when it doesn't
- return NULL), but you can also create one for yourself, and pass addi-
- tional information in it. The pcre_extra block contains the following
+ If the extra argument is not NULL, it must point to a pcre_extra data
+ block. The pcre_study() function returns such a block (when it doesn't
+ return NULL), but you can also create one for yourself, and pass addi-
+ tional information in it. The pcre_extra block contains the following
fields (not necessarily in this order):
unsigned long int flags;
@@ -1682,7 +1733,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
void *callout_data;
const unsigned char *tables;
- The flags field is a bitmap that specifies which of the other fields
+ The flags field is a bitmap that specifies which of the other fields
are set. The flag bits are:
PCRE_EXTRA_STUDY_DATA
@@ -1691,75 +1742,75 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_EXTRA_CALLOUT_DATA
PCRE_EXTRA_TABLES
- Other flag bits should be set to zero. The study_data field is set in
- the pcre_extra block that is returned by pcre_study(), together with
+ Other flag bits should be set to zero. The study_data field is set in
+ the pcre_extra block that is returned by pcre_study(), together with
the appropriate flag bit. You should not set this yourself, but you may
- add to the block by setting the other fields and their corresponding
+ add to the block by setting the other fields and their corresponding
flag bits.
The match_limit field provides a means of preventing PCRE from using up
- a vast amount of resources when running patterns that are not going to
- match, but which have a very large number of possibilities in their
- search trees. The classic example is the use of nested unlimited
+ a vast amount of resources when running patterns that are not going to
+ match, but which have a very large number of possibilities in their
+ search trees. The classic example is the use of nested unlimited
repeats.
- Internally, PCRE uses a function called match() which it calls repeat-
- edly (sometimes recursively). The limit set by match_limit is imposed
- on the number of times this function is called during a match, which
- has the effect of limiting the amount of backtracking that can take
+ Internally, PCRE uses a function called match() which it calls repeat-
+ edly (sometimes recursively). The limit set by match_limit is imposed
+ on the number of times this function is called during a match, which
+ has the effect of limiting the amount of backtracking that can take
place. For patterns that are not anchored, the count restarts from zero
for each position in the subject string.
- The default value for the limit can be set when PCRE is built; the
- default default is 10 million, which handles all but the most extreme
- cases. You can override the default by suppling pcre_exec() with a
- pcre_extra block in which match_limit is set, and
- PCRE_EXTRA_MATCH_LIMIT is set in the flags field. If the limit is
+ The default value for the limit can be set when PCRE is built; the
+ default default is 10 million, which handles all but the most extreme
+ cases. You can override the default by suppling pcre_exec() with a
+ pcre_extra block in which match_limit is set, and
+ PCRE_EXTRA_MATCH_LIMIT is set in the flags field. If the limit is
exceeded, pcre_exec() returns PCRE_ERROR_MATCHLIMIT.
- The match_limit_recursion field is similar to match_limit, but instead
+ The match_limit_recursion field is similar to match_limit, but instead
of limiting the total number of times that match() is called, it limits
- the depth of recursion. The recursion depth is a smaller number than
- the total number of calls, because not all calls to match() are recur-
+ the depth of recursion. The recursion depth is a smaller number than
+ the total number of calls, because not all calls to match() are recur-
sive. This limit is of use only if it is set smaller than match_limit.
- Limiting the recursion depth limits the amount of stack that can be
+ Limiting the recursion depth limits the amount of stack that can be
used, or, when PCRE has been compiled to use memory on the heap instead
of the stack, the amount of heap memory that can be used.
- The default value for match_limit_recursion can be set when PCRE is
- built; the default default is the same value as the default for
- match_limit. You can override the default by suppling pcre_exec() with
- a pcre_extra block in which match_limit_recursion is set, and
- PCRE_EXTRA_MATCH_LIMIT_RECURSION is set in the flags field. If the
+ The default value for match_limit_recursion can be set when PCRE is
+ built; the default default is the same value as the default for
+ match_limit. You can override the default by suppling pcre_exec() with
+ a pcre_extra block in which match_limit_recursion is set, and
+ PCRE_EXTRA_MATCH_LIMIT_RECURSION is set in the flags field. If the
limit is exceeded, pcre_exec() returns PCRE_ERROR_RECURSIONLIMIT.
- The pcre_callout field is used in conjunction with the "callout" fea-
+ The pcre_callout field is used in conjunction with the "callout" fea-
ture, which is described in the pcrecallout documentation.
- The tables field is used to pass a character tables pointer to
- pcre_exec(); this overrides the value that is stored with the compiled
- pattern. A non-NULL value is stored with the compiled pattern only if
- custom tables were supplied to pcre_compile() via its tableptr argu-
+ The tables field is used to pass a character tables pointer to
+ pcre_exec(); this overrides the value that is stored with the compiled
+ pattern. A non-NULL value is stored with the compiled pattern only if
+ custom tables were supplied to pcre_compile() via its tableptr argu-
ment. If NULL is passed to pcre_exec() using this mechanism, it forces
- PCRE's internal tables to be used. This facility is helpful when re-
- using patterns that have been saved after compiling with an external
- set of tables, because the external tables might be at a different
- address when pcre_exec() is called. See the pcreprecompile documenta-
+ PCRE's internal tables to be used. This facility is helpful when re-
+ using patterns that have been saved after compiling with an external
+ set of tables, because the external tables might be at a different
+ address when pcre_exec() is called. See the pcreprecompile documenta-
tion for a discussion of saving compiled patterns for later use.
Option bits for pcre_exec()
- The unused bits of the options argument for pcre_exec() must be zero.
- The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_xxx,
+ The unused bits of the options argument for pcre_exec() must be zero.
+ The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_xxx,
PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK and
PCRE_PARTIAL.
PCRE_ANCHORED
- The PCRE_ANCHORED option limits pcre_exec() to matching at the first
- matching position. If a pattern was compiled with PCRE_ANCHORED, or
- turned out to be anchored by virtue of its contents, it cannot be made
+ The PCRE_ANCHORED option limits pcre_exec() to matching at the first
+ matching position. If a pattern was compiled with PCRE_ANCHORED, or
+ turned out to be anchored by virtue of its contents, it cannot be made
unachored at matching time.
PCRE_NEWLINE_CR
@@ -1768,16 +1819,33 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_NEWLINE_ANYCRLF
PCRE_NEWLINE_ANY
- These options override the newline definition that was chosen or
- defaulted when the pattern was compiled. For details, see the descrip-
- tion of pcre_compile() above. During matching, the newline choice
- affects the behaviour of the dot, circumflex, and dollar metacharac-
- ters. It may also alter the way the match position is advanced after a
- match failure for an unanchored pattern. When PCRE_NEWLINE_CRLF,
- PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is set, and a match attempt
- fails when the current position is at a CRLF sequence, the match posi-
- tion is advanced by two characters instead of one, in other words, to
- after the CRLF.
+ These options override the newline definition that was chosen or
+ defaulted when the pattern was compiled. For details, see the descrip-
+ tion of pcre_compile() above. During matching, the newline choice
+ affects the behaviour of the dot, circumflex, and dollar metacharac-
+ ters. It may also alter the way the match position is advanced after a
+ match failure for an unanchored pattern.
+
+ When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is
+ set, and a match attempt for an unanchored pattern fails when the cur-
+ rent position is at a CRLF sequence, and the pattern contains no
+ explicit matches for CR or NL characters, the match position is
+ advanced by two characters instead of one, in other words, to after the
+ CRLF.
+
+ The above rule is a compromise that makes the most common cases work as
+ expected. For example, if the pattern is .+A (and the PCRE_DOTALL
+ option is not set), it does not match the string "\r\nA" because, after
+ failing at the start, it skips both the CR and the LF before retrying.
+ However, the pattern [\r\n]A does match that string, because it con-
+ tains an explicit CR or LF reference, and so advances only by one char-
+ acter after the first failure. Note than an explicit CR or LF refer-
+ ence occurs for negated character classes such as [^X] because they can
+ match CR or LF characters.
+
+ Notwithstanding the above, anomalous effects may still occur when CRLF
+ is a valid newline sequence and explicit \r or \n escapes appear in the
+ pattern.
PCRE_NOTBOL
@@ -1824,140 +1892,141 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
When PCRE_UTF8 is set at compile time, the validity of the subject as a
UTF-8 string is automatically checked when pcre_exec() is subsequently
called. The value of startoffset is also checked to ensure that it
- points to the start of a UTF-8 character. If an invalid UTF-8 sequence
- of bytes is found, pcre_exec() returns the error PCRE_ERROR_BADUTF8. If
- startoffset contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is
- returned.
-
- If you already know that your subject is valid, and you want to skip
- these checks for performance reasons, you can set the
- PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
- do this for the second and subsequent calls to pcre_exec() if you are
- making repeated calls to find all the matches in a single subject
- string. However, you should be sure that the value of startoffset
- points to the start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
- set, the effect of passing an invalid UTF-8 string as a subject, or a
- value of startoffset that does not point to the start of a UTF-8 char-
+ points to the start of a UTF-8 character. There is a discussion about
+ the validity of UTF-8 strings in the section on UTF-8 support in the
+ main pcre page. If an invalid UTF-8 sequence of bytes is found,
+ pcre_exec() returns the error PCRE_ERROR_BADUTF8. If startoffset con-
+ tains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.
+
+ If you already know that your subject is valid, and you want to skip
+ these checks for performance reasons, you can set the
+ PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
+ do this for the second and subsequent calls to pcre_exec() if you are
+ making repeated calls to find all the matches in a single subject
+ string. However, you should be sure that the value of startoffset
+ points to the start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
+ set, the effect of passing an invalid UTF-8 string as a subject, or a
+ value of startoffset that does not point to the start of a UTF-8 char-
acter, is undefined. Your program may crash.
PCRE_PARTIAL
- This option turns on the partial matching feature. If the subject
- string fails to match the pattern, but at some point during the match-
- ing process the end of the subject was reached (that is, the subject
- partially matches the pattern and the failure to match occurred only
- because there were not enough subject characters), pcre_exec() returns
- PCRE_ERROR_PARTIAL instead of PCRE_ERROR_NOMATCH. When PCRE_PARTIAL is
- used, there are restrictions on what may appear in the pattern. These
+ This option turns on the partial matching feature. If the subject
+ string fails to match the pattern, but at some point during the match-
+ ing process the end of the subject was reached (that is, the subject
+ partially matches the pattern and the failure to match occurred only
+ because there were not enough subject characters), pcre_exec() returns
+ PCRE_ERROR_PARTIAL instead of PCRE_ERROR_NOMATCH. When PCRE_PARTIAL is
+ used, there are restrictions on what may appear in the pattern. These
are discussed in the pcrepartial documentation.
The string to be matched by pcre_exec()
- The subject string is passed to pcre_exec() as a pointer in subject, a
- length in length, and a starting byte offset in startoffset. In UTF-8
- mode, the byte offset must point to the start of a UTF-8 character.
- Unlike the pattern string, the subject may contain binary zero bytes.
- When the starting offset is zero, the search for a match starts at the
+ The subject string is passed to pcre_exec() as a pointer in subject, a
+ length in length, and a starting byte offset in startoffset. In UTF-8
+ mode, the byte offset must point to the start of a UTF-8 character.
+ Unlike the pattern string, the subject may contain binary zero bytes.
+ When the starting offset is zero, the search for a match starts at the
beginning of the subject, and this is by far the most common case.
- A non-zero starting offset is useful when searching for another match
- in the same subject by calling pcre_exec() again after a previous suc-
- cess. Setting startoffset differs from just passing over a shortened
- string and setting PCRE_NOTBOL in the case of a pattern that begins
+ A non-zero starting offset is useful when searching for another match
+ in the same subject by calling pcre_exec() again after a previous suc-
+ cess. Setting startoffset differs from just passing over a shortened
+ string and setting PCRE_NOTBOL in the case of a pattern that begins
with any kind of lookbehind. For example, consider the pattern
\Biss\B
- which finds occurrences of "iss" in the middle of words. (\B matches
- only if the current position in the subject is not a word boundary.)
- When applied to the string "Mississipi" the first call to pcre_exec()
- finds the first occurrence. If pcre_exec() is called again with just
- the remainder of the subject, namely "issipi", it does not match,
+ which finds occurrences of "iss" in the middle of words. (\B matches
+ only if the current position in the subject is not a word boundary.)
+ When applied to the string "Mississipi" the first call to pcre_exec()
+ finds the first occurrence. If pcre_exec() is called again with just
+ the remainder of the subject, namely "issipi", it does not match,
because \B is always false at the start of the subject, which is deemed
- to be a word boundary. However, if pcre_exec() is passed the entire
+ to be a word boundary. However, if pcre_exec() is passed the entire
string again, but with startoffset set to 4, it finds the second occur-
- rence of "iss" because it is able to look behind the starting point to
+ rence of "iss" because it is able to look behind the starting point to
discover that it is preceded by a letter.
- If a non-zero starting offset is passed when the pattern is anchored,
+ If a non-zero starting offset is passed when the pattern is anchored,
one attempt to match at the given offset is made. This can only succeed
- if the pattern does not require the match to be at the start of the
+ if the pattern does not require the match to be at the start of the
subject.
How pcre_exec() returns captured substrings
- In general, a pattern matches a certain portion of the subject, and in
- addition, further substrings from the subject may be picked out by
- parts of the pattern. Following the usage in Jeffrey Friedl's book,
- this is called "capturing" in what follows, and the phrase "capturing
- subpattern" is used for a fragment of a pattern that picks out a sub-
- string. PCRE supports several other kinds of parenthesized subpattern
+ In general, a pattern matches a certain portion of the subject, and in
+ addition, further substrings from the subject may be picked out by
+ parts of the pattern. Following the usage in Jeffrey Friedl's book,
+ this is called "capturing" in what follows, and the phrase "capturing
+ subpattern" is used for a fragment of a pattern that picks out a sub-
+ string. PCRE supports several other kinds of parenthesized subpattern
that do not cause substrings to be captured.
- Captured substrings are returned to the caller via a vector of integer
- offsets whose address is passed in ovector. The number of elements in
- the vector is passed in ovecsize, which must be a non-negative number.
+ Captured substrings are returned to the caller via a vector of integer
+ offsets whose address is passed in ovector. The number of elements in
+ the vector is passed in ovecsize, which must be a non-negative number.
Note: this argument is NOT the size of ovector in bytes.
- The first two-thirds of the vector is used to pass back captured sub-
- strings, each substring using a pair of integers. The remaining third
- of the vector is used as workspace by pcre_exec() while matching cap-
- turing subpatterns, and is not available for passing back information.
- The length passed in ovecsize should always be a multiple of three. If
+ The first two-thirds of the vector is used to pass back captured sub-
+ strings, each substring using a pair of integers. The remaining third
+ of the vector is used as workspace by pcre_exec() while matching cap-
+ turing subpatterns, and is not available for passing back information.
+ The length passed in ovecsize should always be a multiple of three. If
it is not, it is rounded down.
- When a match is successful, information about captured substrings is
- returned in pairs of integers, starting at the beginning of ovector,
- and continuing up to two-thirds of its length at the most. The first
+ When a match is successful, information about captured substrings is
+ returned in pairs of integers, starting at the beginning of ovector,
+ and continuing up to two-thirds of its length at the most. The first
element of a pair is set to the offset of the first character in a sub-
- string, and the second is set to the offset of the first character
- after the end of a substring. The first pair, ovector[0] and ovec-
- tor[1], identify the portion of the subject string matched by the
- entire pattern. The next pair is used for the first capturing subpat-
+ string, and the second is set to the offset of the first character
+ after the end of a substring. The first pair, ovector[0] and ovec-
+ tor[1], identify the portion of the subject string matched by the
+ entire pattern. The next pair is used for the first capturing subpat-
tern, and so on. The value returned by pcre_exec() is one more than the
highest numbered pair that has been set. For example, if two substrings
- have been captured, the returned value is 3. If there are no capturing
- subpatterns, the return value from a successful match is 1, indicating
+ have been captured, the returned value is 3. If there are no capturing
+ subpatterns, the return value from a successful match is 1, indicating
that just the first pair of offsets has been set.
If a capturing subpattern is matched repeatedly, it is the last portion
of the string that it matched that is returned.
- If the vector is too small to hold all the captured substring offsets,
+ If the vector is too small to hold all the captured substring offsets,
it is used as far as possible (up to two-thirds of its length), and the
- function returns a value of zero. In particular, if the substring off-
+ function returns a value of zero. In particular, if the substring off-
sets are not of interest, pcre_exec() may be called with ovector passed
- as NULL and ovecsize as zero. However, if the pattern contains back
- references and the ovector is not big enough to remember the related
- substrings, PCRE has to get additional memory for use during matching.
+ as NULL and ovecsize as zero. However, if the pattern contains back
+ references and the ovector is not big enough to remember the related
+ substrings, PCRE has to get additional memory for use during matching.
Thus it is usually advisable to supply an ovector.
- The pcre_info() function can be used to find out how many capturing
- subpatterns there are in a compiled pattern. The smallest size for
- ovector that will allow for n captured substrings, in addition to the
+ The pcre_info() function can be used to find out how many capturing
+ subpatterns there are in a compiled pattern. The smallest size for
+ ovector that will allow for n captured substrings, in addition to the
offsets of the substring matched by the whole pattern, is (n+1)*3.
- It is possible for capturing subpattern number n+1 to match some part
+ It is possible for capturing subpattern number n+1 to match some part
of the subject when subpattern n has not been used at all. For example,
- if the string "abc" is matched against the pattern (a|(z))(bc) the
+ if the string "abc" is matched against the pattern (a|(z))(bc) the
return from the function is 4, and subpatterns 1 and 3 are matched, but
- 2 is not. When this happens, both values in the offset pairs corre-
+ 2 is not. When this happens, both values in the offset pairs corre-
sponding to unused subpatterns are set to -1.
- Offset values that correspond to unused subpatterns at the end of the
- expression are also set to -1. For example, if the string "abc" is
- matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
- matched. The return from the function is 2, because the highest used
+ Offset values that correspond to unused subpatterns at the end of the
+ expression are also set to -1. For example, if the string "abc" is
+ matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
+ matched. The return from the function is 2, because the highest used
capturing subpattern number is 1. However, you can refer to the offsets
- for the second and third capturing subpatterns if you wish (assuming
+ for the second and third capturing subpatterns if you wish (assuming
the vector is large enough, of course).
- Some convenience functions are provided for extracting the captured
+ Some convenience functions are provided for extracting the captured
substrings as separate strings. These are described below.
Error return values from pcre_exec()
- If pcre_exec() fails, it returns a negative number. The following are
+ If pcre_exec() fails, it returns a negative number. The following are
defined in the header file:
PCRE_ERROR_NOMATCH (-1)
@@ -1966,7 +2035,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_NULL (-2)
- Either code or subject was passed as NULL, or ovector was NULL and
+ Either code or subject was passed as NULL, or ovector was NULL and
ovecsize was not zero.
PCRE_ERROR_BADOPTION (-3)
@@ -1975,94 +2044,86 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_BADMAGIC (-4)
- PCRE stores a 4-byte "magic number" at the start of the compiled code,
+ PCRE stores a 4-byte "magic number" at the start of the compiled code,
to catch the case when it is passed a junk pointer and to detect when a
pattern that was compiled in an environment of one endianness is run in
- an environment with the other endianness. This is the error that PCRE
+ an environment with the other endianness. This is the error that PCRE
gives when the magic number is not present.
PCRE_ERROR_UNKNOWN_OPCODE (-5)
While running the pattern match, an unknown item was encountered in the
- compiled pattern. This error could be caused by a bug in PCRE or by
+ compiled pattern. This error could be caused by a bug in PCRE or by
overwriting of the compiled pattern.
PCRE_ERROR_NOMEMORY (-6)
- If a pattern contains back references, but the ovector that is passed
+ If a pattern contains back references, but the ovector that is passed
to pcre_exec() is not big enough to remember the referenced substrings,
- PCRE gets a block of memory at the start of matching to use for this
- purpose. If the call via pcre_malloc() fails, this error is given. The
+ PCRE gets a block of memory at the start of matching to use for this
+ purpose. If the call via pcre_malloc() fails, this error is given. The
memory is automatically freed at the end of matching.
PCRE_ERROR_NOSUBSTRING (-7)
- This error is used by the pcre_copy_substring(), pcre_get_substring(),
+ This error is used by the pcre_copy_substring(), pcre_get_substring(),
and pcre_get_substring_list() functions (see below). It is never
returned by pcre_exec().
PCRE_ERROR_MATCHLIMIT (-8)
- The backtracking limit, as specified by the match_limit field in a
- pcre_extra structure (or defaulted) was reached. See the description
+ The backtracking limit, as specified by the match_limit field in a
+ pcre_extra structure (or defaulted) was reached. See the description
above.
PCRE_ERROR_CALLOUT (-9)
This error is never generated by pcre_exec() itself. It is provided for
- use by callout functions that want to yield a distinctive error code.
+ use by callout functions that want to yield a distinctive error code.
See the pcrecallout documentation for details.
PCRE_ERROR_BADUTF8 (-10)
- A string that contains an invalid UTF-8 byte sequence was passed as a
+ A string that contains an invalid UTF-8 byte sequence was passed as a
subject.
PCRE_ERROR_BADUTF8_OFFSET (-11)
The UTF-8 byte sequence that was passed as a subject was valid, but the
- value of startoffset did not point to the beginning of a UTF-8 charac-
+ value of startoffset did not point to the beginning of a UTF-8 charac-
ter.
PCRE_ERROR_PARTIAL (-12)
- The subject string did not match, but it did match partially. See the
+ The subject string did not match, but it did match partially. See the
pcrepartial documentation for details of partial matching.
PCRE_ERROR_BADPARTIAL (-13)
- The PCRE_PARTIAL option was used with a compiled pattern containing
- items that are not supported for partial matching. See the pcrepartial
+ The PCRE_PARTIAL option was used with a compiled pattern containing
+ items that are not supported for partial matching. See the pcrepartial
documentation for details of partial matching.
PCRE_ERROR_INTERNAL (-14)
- An unexpected internal error has occurred. This error could be caused
+ An unexpected internal error has occurred. This error could be caused
by a bug in PCRE or by overwriting of the compiled pattern.
PCRE_ERROR_BADCOUNT (-15)
- This error is given if the value of the ovecsize argument is negative.
+ This error is given if the value of the ovecsize argument is negative.
PCRE_ERROR_RECURSIONLIMIT (-21)
The internal recursion limit, as specified by the match_limit_recursion
- field in a pcre_extra structure (or defaulted) was reached. See the
+ field in a pcre_extra structure (or defaulted) was reached. See the
description above.
- PCRE_ERROR_NULLWSLIMIT (-22)
-
- When a group that can match an empty substring is repeated with an
- unbounded upper limit, the subject position at the start of the group
- must be remembered, so that a test for an empty string can be made when
- the end of the group is reached. Some workspace is required for this;
- if it runs out, this error is given.
-
PCRE_ERROR_BADNEWLINE (-23)
An invalid combination of PCRE_NEWLINE_xxx options was given.
- Error numbers -16 to -20 are not used by pcre_exec().
+ Error numbers -16 to -20 and -22 are not used by pcre_exec().
EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
@@ -2078,78 +2139,78 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
int pcre_get_substring_list(const char *subject,
int *ovector, int stringcount, const char ***listptr);
- Captured substrings can be accessed directly by using the offsets
- returned by pcre_exec() in ovector. For convenience, the functions
+ Captured substrings can be accessed directly by using the offsets
+ returned by pcre_exec() in ovector. For convenience, the functions
pcre_copy_substring(), pcre_get_substring(), and pcre_get_sub-
- string_list() are provided for extracting captured substrings as new,
- separate, zero-terminated strings. These functions identify substrings
- by number. The next section describes functions for extracting named
+ string_list() are provided for extracting captured substrings as new,
+ separate, zero-terminated strings. These functions identify substrings
+ by number. The next section describes functions for extracting named
substrings.
- A substring that contains a binary zero is correctly extracted and has
- a further zero added on the end, but the result is not, of course, a C
- string. However, you can process such a string by referring to the
- length that is returned by pcre_copy_substring() and pcre_get_sub-
+ A substring that contains a binary zero is correctly extracted and has
+ a further zero added on the end, but the result is not, of course, a C
+ string. However, you can process such a string by referring to the
+ length that is returned by pcre_copy_substring() and pcre_get_sub-
string(). Unfortunately, the interface to pcre_get_substring_list() is
- not adequate for handling strings containing binary zeros, because the
+ not adequate for handling strings containing binary zeros, because the
end of the final string is not independently indicated.
- The first three arguments are the same for all three of these func-
- tions: subject is the subject string that has just been successfully
+ The first three arguments are the same for all three of these func-
+ tions: subject is the subject string that has just been successfully
matched, ovector is a pointer to the vector of integer offsets that was
passed to pcre_exec(), and stringcount is the number of substrings that
- were captured by the match, including the substring that matched the
+ were captured by the match, including the substring that matched the
entire regular expression. This is the value returned by pcre_exec() if
- it is greater than zero. If pcre_exec() returned zero, indicating that
- it ran out of space in ovector, the value passed as stringcount should
+ it is greater than zero. If pcre_exec() returned zero, indicating that
+ it ran out of space in ovector, the value passed as stringcount should
be the number of elements in the vector divided by three.
- The functions pcre_copy_substring() and pcre_get_substring() extract a
- single substring, whose number is given as stringnumber. A value of
- zero extracts the substring that matched the entire pattern, whereas
- higher values extract the captured substrings. For pcre_copy_sub-
- string(), the string is placed in buffer, whose length is given by
- buffersize, while for pcre_get_substring() a new block of memory is
- obtained via pcre_malloc, and its address is returned via stringptr.
- The yield of the function is the length of the string, not including
+ The functions pcre_copy_substring() and pcre_get_substring() extract a
+ single substring, whose number is given as stringnumber. A value of
+ zero extracts the substring that matched the entire pattern, whereas
+ higher values extract the captured substrings. For pcre_copy_sub-
+ string(), the string is placed in buffer, whose length is given by
+ buffersize, while for pcre_get_substring() a new block of memory is
+ obtained via pcre_malloc, and its address is returned via stringptr.
+ The yield of the function is the length of the string, not including
the terminating zero, or one of these error codes:
PCRE_ERROR_NOMEMORY (-6)
- The buffer was too small for pcre_copy_substring(), or the attempt to
+ The buffer was too small for pcre_copy_substring(), or the attempt to
get memory failed for pcre_get_substring().
PCRE_ERROR_NOSUBSTRING (-7)
There is no substring whose number is stringnumber.
- The pcre_get_substring_list() function extracts all available sub-
- strings and builds a list of pointers to them. All this is done in a
+ The pcre_get_substring_list() function extracts all available sub-
+ strings and builds a list of pointers to them. All this is done in a
single block of memory that is obtained via pcre_malloc. The address of
- the memory block is returned via listptr, which is also the start of
- the list of string pointers. The end of the list is marked by a NULL
- pointer. The yield of the function is zero if all went well, or the
+ the memory block is returned via listptr, which is also the start of
+ the list of string pointers. The end of the list is marked by a NULL
+ pointer. The yield of the function is zero if all went well, or the
error code
PCRE_ERROR_NOMEMORY (-6)
if the attempt to get the memory block failed.
- When any of these functions encounter a substring that is unset, which
- can happen when capturing subpattern number n+1 matches some part of
- the subject, but subpattern n has not been used at all, they return an
+ When any of these functions encounter a substring that is unset, which
+ can happen when capturing subpattern number n+1 matches some part of
+ the subject, but subpattern n has not been used at all, they return an
empty string. This can be distinguished from a genuine zero-length sub-
- string by inspecting the appropriate offset in ovector, which is nega-
+ string by inspecting the appropriate offset in ovector, which is nega-
tive for unset substrings.
- The two convenience functions pcre_free_substring() and pcre_free_sub-
- string_list() can be used to free the memory returned by a previous
+ The two convenience functions pcre_free_substring() and pcre_free_sub-
+ string_list() can be used to free the memory returned by a previous
call of pcre_get_substring() or pcre_get_substring_list(), respec-
- tively. They do nothing more than call the function pointed to by
- pcre_free, which of course could be called directly from a C program.
- However, PCRE is used in some situations where it is linked via a spe-
- cial interface to another programming language that cannot use
- pcre_free directly; it is for these cases that the functions are pro-
+ tively. They do nothing more than call the function pointed to by
+ pcre_free, which of course could be called directly from a C program.
+ However, PCRE is used in some situations where it is linked via a spe-
+ cial interface to another programming language that cannot use
+ pcre_free directly; it is for these cases that the functions are pro-
vided.
@@ -2168,7 +2229,7 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
int stringcount, const char *stringname,
const char **stringptr);
- To extract a substring by name, you first have to find associated num-
+ To extract a substring by name, you first have to find associated num-
ber. For example, for this pattern
(a+)b(?<xxx>\d+)...
@@ -2177,27 +2238,27 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
be unique (PCRE_DUPNAMES was not set), you can find the number from the
name by calling pcre_get_stringnumber(). The first argument is the com-
piled pattern, and the second is the name. The yield of the function is
- the subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if there is no
+ the subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if there is no
subpattern of that name.
Given the number, you can extract the substring directly, or use one of
the functions described in the previous section. For convenience, there
are also two functions that do the whole job.
- Most of the arguments of pcre_copy_named_substring() and
- pcre_get_named_substring() are the same as those for the similarly
- named functions that extract by number. As these are described in the
- previous section, they are not re-described here. There are just two
+ Most of the arguments of pcre_copy_named_substring() and
+ pcre_get_named_substring() are the same as those for the similarly
+ named functions that extract by number. As these are described in the
+ previous section, they are not re-described here. There are just two
differences:
- First, instead of a substring number, a substring name is given. Sec-
+ First, instead of a substring number, a substring name is given. Sec-
ond, there is an extra argument, given at the start, which is a pointer
- to the compiled pattern. This is needed in order to gain access to the
+ to the compiled pattern. This is needed in order to gain access to the
name-to-number translation table.
- These functions call pcre_get_stringnumber(), and if it succeeds, they
- then call pcre_copy_substring() or pcre_get_substring(), as appropri-
- ate. NOTE: If PCRE_DUPNAMES is set and there are duplicate names, the
+ These functions call pcre_get_stringnumber(), and if it succeeds, they
+ then call pcre_copy_substring() or pcre_get_substring(), as appropri-
+ ate. NOTE: If PCRE_DUPNAMES is set and there are duplicate names, the
behaviour may not be what you want (see the next section).
@@ -2206,45 +2267,47 @@ DUPLICATE SUBPATTERN NAMES
int pcre_get_stringtable_entries(const pcre *code,
const char *name, char **first, char **last);
- When a pattern is compiled with the PCRE_DUPNAMES option, names for
- subpatterns are not required to be unique. Normally, patterns with
- duplicate names are such that in any one match, only one of the named
- subpatterns participates. An example is shown in the pcrepattern docu-
- mentation. When duplicates are present, pcre_copy_named_substring() and
- pcre_get_named_substring() return the first substring corresponding to
- the given name that is set. If none are set, an empty string is
- returned. The pcre_get_stringnumber() function returns one of the num-
- bers that are associated with the name, but it is not defined which it
- is.
-
- If you want to get full details of all captured substrings for a given
- name, you must use the pcre_get_stringtable_entries() function. The
+ When a pattern is compiled with the PCRE_DUPNAMES option, names for
+ subpatterns are not required to be unique. Normally, patterns with
+ duplicate names are such that in any one match, only one of the named
+ subpatterns participates. An example is shown in the pcrepattern docu-
+ mentation.
+
+ When duplicates are present, pcre_copy_named_substring() and
+ pcre_get_named_substring() return the first substring corresponding to
+ the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING
+ (-7) is returned; no data is returned. The pcre_get_stringnumber()
+ function returns one of the numbers that are associated with the name,
+ but it is not defined which it is.
+
+ If you want to get full details of all captured substrings for a given
+ name, you must use the pcre_get_stringtable_entries() function. The
first argument is the compiled pattern, and the second is the name. The
- third and fourth are pointers to variables which are updated by the
+ third and fourth are pointers to variables which are updated by the
function. After it has run, they point to the first and last entries in
- the name-to-number table for the given name. The function itself
- returns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if
- there are none. The format of the table is described above in the sec-
- tion entitled Information about a pattern. Given all the relevant
- entries for the name, you can extract each of their numbers, and hence
+ the name-to-number table for the given name. The function itself
+ returns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if
+ there are none. The format of the table is described above in the sec-
+ tion entitled Information about a pattern. Given all the relevant
+ entries for the name, you can extract each of their numbers, and hence
the captured data, if any.
FINDING ALL POSSIBLE MATCHES
- The traditional matching function uses a similar algorithm to Perl,
+ The traditional matching function uses a similar algorithm to Perl,
which stops when it finds the first match, starting at a given point in
- the subject. If you want to find all possible matches, or the longest
- possible match, consider using the alternative matching function (see
- below) instead. If you cannot use the alternative function, but still
- need to find all possible matches, you can kludge it up by making use
+ the subject. If you want to find all possible matches, or the longest
+ possible match, consider using the alternative matching function (see
+ below) instead. If you cannot use the alternative function, but still
+ need to find all possible matches, you can kludge it up by making use
of the callout facility, which is described in the pcrecallout documen-
tation.
What you have to do is to insert a callout right at the end of the pat-
- tern. When your callout function is called, extract and save the cur-
- rent matched substring. Then return 1, which forces pcre_exec() to
- backtrack and try other alternatives. Ultimately, when it runs out of
+ tern. When your callout function is called, extract and save the cur-
+ rent matched substring. Then return 1, which forces pcre_exec() to
+ backtrack and try other alternatives. Ultimately, when it runs out of
matches, pcre_exec() will yield PCRE_ERROR_NOMATCH.
@@ -2255,25 +2318,25 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
int options, int *ovector, int ovecsize,
int *workspace, int wscount);
- The function pcre_dfa_exec() is called to match a subject string
- against a compiled pattern, using a matching algorithm that scans the
- subject string just once, and does not backtrack. This has different
- characteristics to the normal algorithm, and is not compatible with
- Perl. Some of the features of PCRE patterns are not supported. Never-
- theless, there are times when this kind of matching can be useful. For
+ The function pcre_dfa_exec() is called to match a subject string
+ against a compiled pattern, using a matching algorithm that scans the
+ subject string just once, and does not backtrack. This has different
+ characteristics to the normal algorithm, and is not compatible with
+ Perl. Some of the features of PCRE patterns are not supported. Never-
+ theless, there are times when this kind of matching can be useful. For
a discussion of the two matching algorithms, see the pcrematching docu-
mentation.
- The arguments for the pcre_dfa_exec() function are the same as for
+ The arguments for the pcre_dfa_exec() function are the same as for
pcre_exec(), plus two extras. The ovector argument is used in a differ-
- ent way, and this is described below. The other common arguments are
- used in the same way as for pcre_exec(), so their description is not
+ ent way, and this is described below. The other common arguments are
+ used in the same way as for pcre_exec(), so their description is not
repeated here.
- The two additional arguments provide workspace for the function. The
- workspace vector should contain at least 20 elements. It is used for
+ The two additional arguments provide workspace for the function. The
+ workspace vector should contain at least 20 elements. It is used for
keeping track of multiple paths through the pattern tree. More
- workspace will be needed for patterns and subjects where there are a
+ workspace will be needed for patterns and subjects where there are a
lot of potential matches.
Here is an example of a simple call to pcre_dfa_exec():
@@ -2295,47 +2358,47 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
Option bits for pcre_dfa_exec()
- The unused bits of the options argument for pcre_dfa_exec() must be
- zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
- LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK,
+ The unused bits of the options argument for pcre_dfa_exec() must be
+ zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
+ LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK,
PCRE_PARTIAL, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
three of these are the same as for pcre_exec(), so their description is
not repeated here.
PCRE_PARTIAL
- This has the same general effect as it does for pcre_exec(), but the
- details are slightly different. When PCRE_PARTIAL is set for
- pcre_dfa_exec(), the return code PCRE_ERROR_NOMATCH is converted into
- PCRE_ERROR_PARTIAL if the end of the subject is reached, there have
+ This has the same general effect as it does for pcre_exec(), but the
+ details are slightly different. When PCRE_PARTIAL is set for
+ pcre_dfa_exec(), the return code PCRE_ERROR_NOMATCH is converted into
+ PCRE_ERROR_PARTIAL if the end of the subject is reached, there have
been no complete matches, but there is still at least one matching pos-
- sibility. The portion of the string that provided the partial match is
+ sibility. The portion of the string that provided the partial match is
set as the first matching string.
PCRE_DFA_SHORTEST
- Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to
+ Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to
stop as soon as it has found one match. Because of the way the alterna-
- tive algorithm works, this is necessarily the shortest possible match
+ tive algorithm works, this is necessarily the shortest possible match
at the first possible matching point in the subject string.
PCRE_DFA_RESTART
- When pcre_dfa_exec() is called with the PCRE_PARTIAL option, and
- returns a partial match, it is possible to call it again, with addi-
- tional subject characters, and have it continue with the same match.
- The PCRE_DFA_RESTART option requests this action; when it is set, the
- workspace and wscount options must reference the same vector as before
- because data about the match so far is left in them after a partial
- match. There is more discussion of this facility in the pcrepartial
+ When pcre_dfa_exec() is called with the PCRE_PARTIAL option, and
+ returns a partial match, it is possible to call it again, with addi-
+ tional subject characters, and have it continue with the same match.
+ The PCRE_DFA_RESTART option requests this action; when it is set, the
+ workspace and wscount options must reference the same vector as before
+ because data about the match so far is left in them after a partial
+ match. There is more discussion of this facility in the pcrepartial
documentation.
Successful returns from pcre_dfa_exec()
- When pcre_dfa_exec() succeeds, it may have matched more than one sub-
+ When pcre_dfa_exec() succeeds, it may have matched more than one sub-
string in the subject. Note, however, that all the matches from one run
- of the function start at the same point in the subject. The shorter
- matches are all initial substrings of the longer matches. For example,
+ of the function start at the same point in the subject. The shorter
+ matches are all initial substrings of the longer matches. For example,
if the pattern
<.*>
@@ -2350,62 +2413,62 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
<something> <something else>
<something> <something else> <something further>
- On success, the yield of the function is a number greater than zero,
- which is the number of matched substrings. The substrings themselves
- are returned in ovector. Each string uses two elements; the first is
- the offset to the start, and the second is the offset to the end. In
- fact, all the strings have the same start offset. (Space could have
- been saved by giving this only once, but it was decided to retain some
- compatibility with the way pcre_exec() returns data, even though the
+ On success, the yield of the function is a number greater than zero,
+ which is the number of matched substrings. The substrings themselves
+ are returned in ovector. Each string uses two elements; the first is
+ the offset to the start, and the second is the offset to the end. In
+ fact, all the strings have the same start offset. (Space could have
+ been saved by giving this only once, but it was decided to retain some
+ compatibility with the way pcre_exec() returns data, even though the
meaning of the strings is different.)
The strings are returned in reverse order of length; that is, the long-
- est matching string is given first. If there were too many matches to
- fit into ovector, the yield of the function is zero, and the vector is
+ est matching string is given first. If there were too many matches to
+ fit into ovector, the yield of the function is zero, and the vector is
filled with the longest matches.
Error returns from pcre_dfa_exec()
- The pcre_dfa_exec() function returns a negative number when it fails.
- Many of the errors are the same as for pcre_exec(), and these are
- described above. There are in addition the following errors that are
+ The pcre_dfa_exec() function returns a negative number when it fails.
+ Many of the errors are the same as for pcre_exec(), and these are
+ described above. There are in addition the following errors that are
specific to pcre_dfa_exec():
PCRE_ERROR_DFA_UITEM (-16)
- This return is given if pcre_dfa_exec() encounters an item in the pat-
- tern that it does not support, for instance, the use of \C or a back
+ This return is given if pcre_dfa_exec() encounters an item in the pat-
+ tern that it does not support, for instance, the use of \C or a back
reference.
PCRE_ERROR_DFA_UCOND (-17)
- This return is given if pcre_dfa_exec() encounters a condition item
- that uses a back reference for the condition, or a test for recursion
+ This return is given if pcre_dfa_exec() encounters a condition item
+ that uses a back reference for the condition, or a test for recursion
in a specific group. These are not supported.
PCRE_ERROR_DFA_UMLIMIT (-18)
- This return is given if pcre_dfa_exec() is called with an extra block
+ This return is given if pcre_dfa_exec() is called with an extra block
that contains a setting of the match_limit field. This is not supported
(it is meaningless).
PCRE_ERROR_DFA_WSSIZE (-19)
- This return is given if pcre_dfa_exec() runs out of space in the
+ This return is given if pcre_dfa_exec() runs out of space in the
workspace vector.
PCRE_ERROR_DFA_RECURSE (-20)
- When a recursive subpattern is processed, the matching function calls
- itself recursively, using private vectors for ovector and workspace.
- This error is given if the output vector is not large enough. This
+ When a recursive subpattern is processed, the matching function calls
+ itself recursively, using private vectors for ovector and workspace.
+ This error is given if the output vector is not large enough. This
should be extremely rare, as a vector of size 1000 is used.
SEE ALSO
- pcrebuild(3), pcrecallout(3), pcrecpp(3)(3), pcrematching(3), pcrepar-
- tial(3), pcreposix(3), pcreprecompile(3), pcresample(3), pcrestack(3).
+ pcrebuild(3), pcrecallout(3), pcrecpp(3)(3), pcrematching(3), pcrepar-
+ tial(3), pcreposix(3), pcreprecompile(3), pcresample(3), pcrestack(3).
AUTHOR
@@ -2417,7 +2480,7 @@ AUTHOR
REVISION
- Last updated: 13 June 2007
+ Last updated: 21 August 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -2670,7 +2733,13 @@ DIFFERENCES BETWEEN PCRE AND PERL
matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2
unset, but in PCRE it is set to "b".
- 11. PCRE provides some extensions to the Perl regular expression facil-
+ 11. PCRE does support Perl 5.10's backtracking verbs (*ACCEPT),
+ (*FAIL), (*F), (*COMMIT), (*PRUNE), (*SKIP), and (*THEN), but only in
+ the forms without an argument. PCRE does not support (*MARK). If
+ (*ACCEPT) is within capturing parentheses, PCRE does not set that cap-
+ ture group; this is different to Perl.
+
+ 12. PCRE provides some extensions to the Perl regular expression facil-
ities. Perl 5.10 will include new features that are not in earlier
versions, some of which (such as named parentheses) have been in PCRE
for some time. This list is with respect to Perl 5.10:
@@ -2716,7 +2785,7 @@ AUTHOR
REVISION
- Last updated: 13 June 2007
+ Last updated: 08 August 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
@@ -2730,12 +2799,14 @@ NAME
PCRE REGULAR EXPRESSION DETAILS
- The syntax and semantics of the regular expressions supported by PCRE
- are described below. Regular expressions are also described in the Perl
- documentation and in a number of books, some of which have copious
- examples. Jeffrey Friedl's "Mastering Regular Expressions", published
- by O'Reilly, covers regular expressions in great detail. This descrip-
- tion of PCRE's regular expressions is intended as reference material.
+ The syntax and semantics of the regular expressions that are supported
+ by PCRE are described in detail below. There is a quick-reference syn-
+ tax summary in the pcresyntax page. Perl's regular expressions are
+ described in its own documentation, and regular expressions in general
+ are covered in a number of books, some of which have copious examples.
+ Jeffrey Friedl's "Mastering Regular Expressions", published by
+ O'Reilly, covers regular expressions in great detail. This description
+ of PCRE's regular expressions is intended as reference material.
The original operation of PCRE was on strings of one-byte characters.
However, there is now also support for UTF-8 character strings. To use
@@ -2755,33 +2826,63 @@ PCRE REGULAR EXPRESSION DETAILS
discussed in the pcrematching page.
+NEWLINE CONVENTIONS
+
+ PCRE supports five different conventions for indicating line breaks in
+ strings: a single CR (carriage return) character, a single LF (line-
+ feed) character, the two-character sequence CRLF, any of the three pre-
+ ceding, or any Unicode newline sequence. The pcreapi page has further
+ discussion about newlines, and shows how to set the newline convention
+ in the options arguments for the compiling and matching functions.
+
+ It is also possible to specify a newline convention by starting a pat-
+ tern string with one of the following five sequences:
+
+ (*CR) carriage return
+ (*LF) linefeed
+ (*CRLF) carriage return, followed by linefeed
+ (*ANYCRLF) any of the three above
+ (*ANY) all Unicode newline sequences
+
+ These override the default and the options given to pcre_compile(). For
+ example, on a Unix system where LF is the default newline sequence, the
+ pattern
+
+ (*CR)a.b
+
+ changes the convention to CR. That pattern matches "a\nb" because LF is
+ no longer a newline. Note that these special settings, which are not
+ Perl-compatible, are recognized only at the very start of a pattern,
+ and that they must be in upper case.
+
+
CHARACTERS AND METACHARACTERS
- A regular expression is a pattern that is matched against a subject
- string from left to right. Most characters stand for themselves in a
- pattern, and match the corresponding characters in the subject. As a
+ A regular expression is a pattern that is matched against a subject
+ string from left to right. Most characters stand for themselves in a
+ pattern, and match the corresponding characters in the subject. As a
trivial example, the pattern
The quick brown fox
matches a portion of a subject string that is identical to itself. When
- caseless matching is specified (the PCRE_CASELESS option), letters are
- matched independently of case. In UTF-8 mode, PCRE always understands
- the concept of case for characters whose values are less than 128, so
- caseless matching is always possible. For characters with higher val-
- ues, the concept of case is supported if PCRE is compiled with Unicode
- property support, but not otherwise. If you want to use caseless
- matching for characters 128 and above, you must ensure that PCRE is
+ caseless matching is specified (the PCRE_CASELESS option), letters are
+ matched independently of case. In UTF-8 mode, PCRE always understands
+ the concept of case for characters whose values are less than 128, so
+ caseless matching is always possible. For characters with higher val-
+ ues, the concept of case is supported if PCRE is compiled with Unicode
+ property support, but not otherwise. If you want to use caseless
+ matching for characters 128 and above, you must ensure that PCRE is
compiled with Unicode property support as well as with UTF-8 support.
- The power of regular expressions comes from the ability to include
- alternatives and repetitions in the pattern. These are encoded in the
+ The power of regular expressions comes from the ability to include
+ alternatives and repetitions in the pattern. These are encoded in the
pattern by the use of metacharacters, which do not stand for themselves
but instead are interpreted in some special way.
- There are two different sets of metacharacters: those that are recog-
- nized anywhere in the pattern except within square brackets, and those
- that are recognized within square brackets. Outside square brackets,
+ There are two different sets of metacharacters: those that are recog-
+ nized anywhere in the pattern except within square brackets, and those
+ that are recognized within square brackets. Outside square brackets,
the metacharacters are as follows:
\ general escape character with several uses
@@ -2800,7 +2901,7 @@ CHARACTERS AND METACHARACTERS
also "possessive quantifier"
{ start min/max quantifier
- Part of a pattern that is in square brackets is called a "character
+ Part of a pattern that is in square brackets is called a "character
class". In a character class the only metacharacters are:
\ general escape character
@@ -2810,33 +2911,33 @@ CHARACTERS AND METACHARACTERS
syntax)
] terminates the character class
- The following sections describe the use of each of the metacharacters.
+ The following sections describe the use of each of the metacharacters.
BACKSLASH
The backslash character has several uses. Firstly, if it is followed by
- a non-alphanumeric character, it takes away any special meaning that
- character may have. This use of backslash as an escape character
+ a non-alphanumeric character, it takes away any special meaning that
+ character may have. This use of backslash as an escape character
applies both inside and outside character classes.
- For example, if you want to match a * character, you write \* in the
- pattern. This escaping action applies whether or not the following
- character would otherwise be interpreted as a metacharacter, so it is
- always safe to precede a non-alphanumeric with backslash to specify
- that it stands for itself. In particular, if you want to match a back-
+ For example, if you want to match a * character, you write \* in the
+ pattern. This escaping action applies whether or not the following
+ character would otherwise be interpreted as a metacharacter, so it is
+ always safe to precede a non-alphanumeric with backslash to specify
+ that it stands for itself. In particular, if you want to match a back-
slash, you write \\.
- If a pattern is compiled with the PCRE_EXTENDED option, whitespace in
- the pattern (other than in a character class) and characters between a
+ If a pattern is compiled with the PCRE_EXTENDED option, whitespace in
+ the pattern (other than in a character class) and characters between a
# outside a character class and the next newline are ignored. An escap-
- ing backslash can be used to include a whitespace or # character as
+ ing backslash can be used to include a whitespace or # character as
part of the pattern.
- If you want to remove the special meaning from a sequence of charac-
- ters, you can do so by putting them between \Q and \E. This is differ-
- ent from Perl in that $ and @ are handled as literals in \Q...\E
- sequences in PCRE, whereas in Perl, $ and @ cause variable interpola-
+ If you want to remove the special meaning from a sequence of charac-
+ ters, you can do so by putting them between \Q and \E. This is differ-
+ ent from Perl in that $ and @ are handled as literals in \Q...\E
+ sequences in PCRE, whereas in Perl, $ and @ cause variable interpola-
tion. Note the following examples:
Pattern PCRE matches Perl matches
@@ -2846,43 +2947,46 @@ BACKSLASH
\Qabc\$xyz\E abc\$xyz abc\$xyz
\Qabc\E\$\Qxyz\E abc$xyz abc$xyz
- The \Q...\E sequence is recognized both inside and outside character
+ The \Q...\E sequence is recognized both inside and outside character
classes.
Non-printing characters
A second use of backslash provides a way of encoding non-printing char-
- acters in patterns in a visible manner. There is no restriction on the
- appearance of non-printing characters, apart from the binary zero that
- terminates a pattern, but when a pattern is being prepared by text
- editing, it is usually easier to use one of the following escape
+ acters in patterns in a visible manner. There is no restriction on the
+ appearance of non-printing characters, apart from the binary zero that
+ terminates a pattern, but when a pattern is being prepared by text
+ editing, it is usually easier to use one of the following escape
sequences than the binary character it represents:
\a alarm, that is, the BEL character (hex 07)
\cx "control-x", where x is any character
\e escape (hex 1B)
\f formfeed (hex 0C)
- \n newline (hex 0A)
+ \n linefeed (hex 0A)
\r carriage return (hex 0D)
\t tab (hex 09)
\ddd character with octal code ddd, or backreference
\xhh character with hex code hh
\x{hhh..} character with hex code hhh..
- The precise effect of \cx is as follows: if x is a lower case letter,
- it is converted to upper case. Then bit 6 of the character (hex 40) is
- inverted. Thus \cz becomes hex 1A, but \c{ becomes hex 3B, while \c;
+ The precise effect of \cx is as follows: if x is a lower case letter,
+ it is converted to upper case. Then bit 6 of the character (hex 40) is
+ inverted. Thus \cz becomes hex 1A, but \c{ becomes hex 3B, while \c;
becomes hex 7B.
- After \x, from zero to two hexadecimal digits are read (letters can be
- in upper or lower case). Any number of hexadecimal digits may appear
- between \x{ and }, but the value of the character code must be less
- than 256 in non-UTF-8 mode, and less than 2**31 in UTF-8 mode (that is,
- the maximum hexadecimal value is 7FFFFFFF). If characters other than
- hexadecimal digits appear between \x{ and }, or if there is no termi-
- nating }, this form of escape is not recognized. Instead, the initial
- \x will be interpreted as a basic hexadecimal escape, with no following
- digits, giving a character whose value is zero.
+ After \x, from zero to two hexadecimal digits are read (letters can be
+ in upper or lower case). Any number of hexadecimal digits may appear
+ between \x{ and }, but the value of the character code must be less
+ than 256 in non-UTF-8 mode, and less than 2**31 in UTF-8 mode. That is,
+ the maximum value in hexadecimal is 7FFFFFFF. Note that this is bigger
+ than the largest Unicode code point, which is 10FFFF.
+
+ If characters other than hexadecimal digits appear between \x{ and },
+ or if there is no terminating }, this form of escape is not recognized.
+ Instead, the initial \x will be interpreted as a basic hexadecimal
+ escape, with no following digits, giving a character whose value is
+ zero.
Characters whose value is less than 256 can be defined by either of the
two syntaxes for \x. There is no difference in the way they are han-
@@ -2937,10 +3041,10 @@ BACKSLASH
Absolute and relative back references
- The sequence \g followed by a positive or negative number, optionally
- enclosed in braces, is an absolute or relative back reference. A named
- back reference can be coded as \g{name}. Back references are discussed
- later, following the discussion of parenthesized subpatterns.
+ The sequence \g followed by an unsigned or a negative number, option-
+ ally enclosed in braces, is an absolute or relative back reference. A
+ named back reference can be coded as \g{name}. Back references are dis-
+ cussed later, following the discussion of parenthesized subpatterns.
Generic character types
@@ -3145,6 +3249,12 @@ BACKSLASH
has the Lu, Ll, or Lt property, in other words, a letter that is not
classified as a modifier or "other".
+ The Cs (Surrogate) property applies only to characters in the range
+ U+D800 to U+DFFF. Such characters are not valid in UTF-8 strings (see
+ RFC 3629) and so cannot be tested by PCRE, unless UTF-8 validity check-
+ ing has been turned off (see the discussion of PCRE_NO_UTF8_CHECK in
+ the pcreapi page).
+
The long synonyms for these properties that Perl supports (such as
\p{Letter}) are not supported by PCRE, nor is it permitted to prefix
any of these properties with "Is".
@@ -3876,121 +3986,126 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
\d++foo
- Possessive quantifiers are always greedy; the setting of the
+ Note that a possessive quantifier can be used with an entire group, for
+ example:
+
+ (abc|xyz){2,3}+
+
+ Possessive quantifiers are always greedy; the setting of the
PCRE_UNGREEDY option is ignored. They are a convenient notation for the
- simpler forms of atomic group. However, there is no difference in the
- meaning of a possessive quantifier and the equivalent atomic group,
- though there may be a performance difference; possessive quantifiers
+ simpler forms of atomic group. However, there is no difference in the
+ meaning of a possessive quantifier and the equivalent atomic group,
+ though there may be a performance difference; possessive quantifiers
should be slightly faster.
- The possessive quantifier syntax is an extension to the Perl 5.8 syn-
- tax. Jeffrey Friedl originated the idea (and the name) in the first
+ The possessive quantifier syntax is an extension to the Perl 5.8 syn-
+ tax. Jeffrey Friedl originated the idea (and the name) in the first
edition of his book. Mike McCloskey liked it, so implemented it when he
- built Sun's Java package, and PCRE copied it from there. It ultimately
+ built Sun's Java package, and PCRE copied it from there. It ultimately
found its way into Perl at release 5.10.
PCRE has an optimization that automatically "possessifies" certain sim-
- ple pattern constructs. For example, the sequence A+B is treated as
- A++B because there is no point in backtracking into a sequence of A's
+ ple pattern constructs. For example, the sequence A+B is treated as
+ A++B because there is no point in backtracking into a sequence of A's
when B must follow.
- When a pattern contains an unlimited repeat inside a subpattern that
- can itself be repeated an unlimited number of times, the use of an
- atomic group is the only way to avoid some failing matches taking a
+ When a pattern contains an unlimited repeat inside a subpattern that
+ can itself be repeated an unlimited number of times, the use of an
+ atomic group is the only way to avoid some failing matches taking a
very long time indeed. The pattern
(\D+|<\d+>)*[!?]
- matches an unlimited number of substrings that either consist of non-
- digits, or digits enclosed in <>, followed by either ! or ?. When it
+ matches an unlimited number of substrings that either consist of non-
+ digits, or digits enclosed in <>, followed by either ! or ?. When it
matches, it runs quickly. However, if it is applied to
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- it takes a long time before reporting failure. This is because the
- string can be divided between the internal \D+ repeat and the external
- * repeat in a large number of ways, and all have to be tried. (The
- example uses [!?] rather than a single character at the end, because
- both PCRE and Perl have an optimization that allows for fast failure
- when a single character is used. They remember the last single charac-
- ter that is required for a match, and fail early if it is not present
- in the string.) If the pattern is changed so that it uses an atomic
+ it takes a long time before reporting failure. This is because the
+ string can be divided between the internal \D+ repeat and the external
+ * repeat in a large number of ways, and all have to be tried. (The
+ example uses [!?] rather than a single character at the end, because
+ both PCRE and Perl have an optimization that allows for fast failure
+ when a single character is used. They remember the last single charac-
+ ter that is required for a match, and fail early if it is not present
+ in the string.) If the pattern is changed so that it uses an atomic
group, like this:
((?>\D+)|<\d+>)*[!?]
- sequences of non-digits cannot be broken, and failure happens quickly.
+ sequences of non-digits cannot be broken, and failure happens quickly.
BACK REFERENCES
Outside a character class, a backslash followed by a digit greater than
0 (and possibly further digits) is a back reference to a capturing sub-
- pattern earlier (that is, to its left) in the pattern, provided there
+ pattern earlier (that is, to its left) in the pattern, provided there
have been that many previous capturing left parentheses.
However, if the decimal number following the backslash is less than 10,
- it is always taken as a back reference, and causes an error only if
- there are not that many capturing left parentheses in the entire pat-
- tern. In other words, the parentheses that are referenced need not be
- to the left of the reference for numbers less than 10. A "forward back
- reference" of this type can make sense when a repetition is involved
- and the subpattern to the right has participated in an earlier itera-
+ it is always taken as a back reference, and causes an error only if
+ there are not that many capturing left parentheses in the entire pat-
+ tern. In other words, the parentheses that are referenced need not be
+ to the left of the reference for numbers less than 10. A "forward back
+ reference" of this type can make sense when a repetition is involved
+ and the subpattern to the right has participated in an earlier itera-
tion.
- It is not possible to have a numerical "forward back reference" to a
- subpattern whose number is 10 or more using this syntax because a
- sequence such as \50 is interpreted as a character defined in octal.
+ It is not possible to have a numerical "forward back reference" to a
+ subpattern whose number is 10 or more using this syntax because a
+ sequence such as \50 is interpreted as a character defined in octal.
See the subsection entitled "Non-printing characters" above for further
- details of the handling of digits following a backslash. There is no
- such problem when named parentheses are used. A back reference to any
+ details of the handling of digits following a backslash. There is no
+ such problem when named parentheses are used. A back reference to any
subpattern is possible using named parentheses (see below).
- Another way of avoiding the ambiguity inherent in the use of digits
+ Another way of avoiding the ambiguity inherent in the use of digits
following a backslash is to use the \g escape sequence, which is a fea-
- ture introduced in Perl 5.10. This escape must be followed by a posi-
- tive or a negative number, optionally enclosed in braces. These exam-
- ples are all identical:
+ ture introduced in Perl 5.10. This escape must be followed by an
+ unsigned number or a negative number, optionally enclosed in braces.
+ These examples are all identical:
(ring), \1
(ring), \g1
(ring), \g{1}
- A positive number specifies an absolute reference without the ambiguity
- that is present in the older syntax. It is also useful when literal
+ An unsigned number specifies an absolute reference without the ambigu-
+ ity that is present in the older syntax. It is also useful when literal
digits follow the reference. A negative number is a relative reference.
Consider this example:
(abc(def)ghi)\g{-1}
The sequence \g{-1} is a reference to the most recently started captur-
- ing subpattern before \g, that is, is it equivalent to \2. Similarly,
+ ing subpattern before \g, that is, is it equivalent to \2. Similarly,
\g{-2} would be equivalent to \1. The use of relative references can be
- helpful in long patterns, and also in patterns that are created by
+ helpful in long patterns, and also in patterns that are created by
joining together fragments that contain references within themselves.
- A back reference matches whatever actually matched the capturing sub-
- pattern in the current subject string, rather than anything matching
+ A back reference matches whatever actually matched the capturing sub-
+ pattern in the current subject string, rather than anything matching
the subpattern itself (see "Subpatterns as subroutines" below for a way
of doing that). So the pattern
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
- not "sense and responsibility". If caseful matching is in force at the
- time of the back reference, the case of letters is relevant. For exam-
+ matches "sense and sensibility" and "response and responsibility", but
+ not "sense and responsibility". If caseful matching is in force at the
+ time of the back reference, the case of letters is relevant. For exam-
ple,
((?i)rah)\s+\1
- matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
+ matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
original capturing subpattern is matched caselessly.
- There are several different ways of writing back references to named
- subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or
- \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's
+ There are several different ways of writing back references to named
+ subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or
+ \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's
unified back reference syntax, in which \g can be used for both numeric
- and named references, is also supported. We could rewrite the above
+ and named references, is also supported. We could rewrite the above
example in any of the following ways:
(?<p1>(?i)rah)\s+\k<p1>
@@ -3998,57 +4113,57 @@ BACK REFERENCES
(?P<p1>(?i)rah)\s+(?P=p1)
(?<p1>(?i)rah)\s+\g{p1}
- A subpattern that is referenced by name may appear in the pattern
+ A subpattern that is referenced by name may appear in the pattern
before or after the reference.
- There may be more than one back reference to the same subpattern. If a
- subpattern has not actually been used in a particular match, any back
+ There may be more than one back reference to the same subpattern. If a
+ subpattern has not actually been used in a particular match, any back
references to it always fail. For example, the pattern
(a|(bc))\2
- always fails if it starts to match "a" rather than "bc". Because there
- may be many capturing parentheses in a pattern, all digits following
- the backslash are taken as part of a potential back reference number.
+ always fails if it starts to match "a" rather than "bc". Because there
+ may be many capturing parentheses in a pattern, all digits following
+ the backslash are taken as part of a potential back reference number.
If the pattern continues with a digit character, some delimiter must be
- used to terminate the back reference. If the PCRE_EXTENDED option is
- set, this can be whitespace. Otherwise an empty comment (see "Com-
+ used to terminate the back reference. If the PCRE_EXTENDED option is
+ set, this can be whitespace. Otherwise an empty comment (see "Com-
ments" below) can be used.
- A back reference that occurs inside the parentheses to which it refers
- fails when the subpattern is first used, so, for example, (a\1) never
- matches. However, such references can be useful inside repeated sub-
+ A back reference that occurs inside the parentheses to which it refers
+ fails when the subpattern is first used, so, for example, (a\1) never
+ matches. However, such references can be useful inside repeated sub-
patterns. For example, the pattern
(a|b\1)+
matches any number of "a"s and also "aba", "ababbaa" etc. At each iter-
- ation of the subpattern, the back reference matches the character
- string corresponding to the previous iteration. In order for this to
- work, the pattern must be such that the first iteration does not need
- to match the back reference. This can be done using alternation, as in
+ ation of the subpattern, the back reference matches the character
+ string corresponding to the previous iteration. In order for this to
+ work, the pattern must be such that the first iteration does not need
+ to match the back reference. This can be done using alternation, as in
the example above, or by a quantifier with a minimum of zero.
ASSERTIONS
- An assertion is a test on the characters following or preceding the
- current matching point that does not actually consume any characters.
- The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
+ An assertion is a test on the characters following or preceding the
+ current matching point that does not actually consume any characters.
+ The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
described above.
- More complicated assertions are coded as subpatterns. There are two
- kinds: those that look ahead of the current position in the subject
- string, and those that look behind it. An assertion subpattern is
- matched in the normal way, except that it does not cause the current
+ More complicated assertions are coded as subpatterns. There are two
+ kinds: those that look ahead of the current position in the subject
+ string, and those that look behind it. An assertion subpattern is
+ matched in the normal way, except that it does not cause the current
matching position to be changed.
- Assertion subpatterns are not capturing subpatterns, and may not be
- repeated, because it makes no sense to assert the same thing several
- times. If any kind of assertion contains capturing subpatterns within
- it, these are counted for the purposes of numbering the capturing sub-
+ Assertion subpatterns are not capturing subpatterns, and may not be
+ repeated, because it makes no sense to assert the same thing several
+ times. If any kind of assertion contains capturing subpatterns within
+ it, these are counted for the purposes of numbering the capturing sub-
patterns in the whole pattern. However, substring capturing is carried
- out only for positive assertions, because it does not make sense for
+ out only for positive assertions, because it does not make sense for
negative assertions.
Lookahead assertions
@@ -4058,37 +4173,37 @@ ASSERTIONS
\w+(?=;)
- matches a word followed by a semicolon, but does not include the semi-
+ matches a word followed by a semicolon, but does not include the semi-
colon in the match, and
foo(?!bar)
- matches any occurrence of "foo" that is not followed by "bar". Note
+ matches any occurrence of "foo" that is not followed by "bar". Note
that the apparently similar pattern
(?!foo)bar
- does not find an occurrence of "bar" that is preceded by something
- other than "foo"; it finds any occurrence of "bar" whatsoever, because
+ does not find an occurrence of "bar" that is preceded by something
+ other than "foo"; it finds any occurrence of "bar" whatsoever, because
the assertion (?!foo) is always true when the next three characters are
"bar". A lookbehind assertion is needed to achieve the other effect.
If you want to force a matching failure at some point in a pattern, the
- most convenient way to do it is with (?!) because an empty string
- always matches, so an assertion that requires there not to be an empty
+ most convenient way to do it is with (?!) because an empty string
+ always matches, so an assertion that requires there not to be an empty
string must always fail.
Lookbehind assertions
- Lookbehind assertions start with (?<= for positive assertions and (?<!
+ Lookbehind assertions start with (?<= for positive assertions and (?<!
for negative assertions. For example,
(?<!foo)bar
- does find an occurrence of "bar" that is not preceded by "foo". The
- contents of a lookbehind assertion are restricted such that all the
+ does find an occurrence of "bar" that is not preceded by "foo". The
+ contents of a lookbehind assertion are restricted such that all the
strings it matches must have a fixed length. However, if there are sev-
- eral top-level alternatives, they do not all have to have the same
+ eral top-level alternatives, they do not all have to have the same
fixed length. Thus
(?<=bullock|donkey)
@@ -4097,59 +4212,59 @@ ASSERTIONS
(?<!dogs?|cats?)
- causes an error at compile time. Branches that match different length
- strings are permitted only at the top level of a lookbehind assertion.
- This is an extension compared with Perl (at least for 5.8), which
- requires all branches to match the same length of string. An assertion
+ causes an error at compile time. Branches that match different length
+ strings are permitted only at the top level of a lookbehind assertion.
+ This is an extension compared with Perl (at least for 5.8), which
+ requires all branches to match the same length of string. An assertion
such as
(?<=ab(c|de))
- is not permitted, because its single top-level branch can match two
- different lengths, but it is acceptable if rewritten to use two top-
+ is not permitted, because its single top-level branch can match two
+ different lengths, but it is acceptable if rewritten to use two top-
level branches:
(?<=abc|abde)
In some cases, the Perl 5.10 escape sequence \K (see above) can be used
- instead of a lookbehind assertion; this is not restricted to a fixed-
+ instead of a lookbehind assertion; this is not restricted to a fixed-
length.
- The implementation of lookbehind assertions is, for each alternative,
- to temporarily move the current position back by the fixed length and
+ The implementation of lookbehind assertions is, for each alternative,
+ to temporarily move the current position back by the fixed length and
then try to match. If there are insufficient characters before the cur-
rent position, the assertion fails.
PCRE does not allow the \C escape (which matches a single byte in UTF-8
- mode) to appear in lookbehind assertions, because it makes it impossi-
- ble to calculate the length of the lookbehind. The \X and \R escapes,
+ mode) to appear in lookbehind assertions, because it makes it impossi-
+ ble to calculate the length of the lookbehind. The \X and \R escapes,
which can match different numbers of bytes, are also not permitted.
- Possessive quantifiers can be used in conjunction with lookbehind
- assertions to specify efficient matching at the end of the subject
+ Possessive quantifiers can be used in conjunction with lookbehind
+ assertions to specify efficient matching at the end of the subject
string. Consider a simple pattern such as
abcd$
- when applied to a long string that does not match. Because matching
+ when applied to a long string that does not match. Because matching
proceeds from left to right, PCRE will look for each "a" in the subject
- and then see if what follows matches the rest of the pattern. If the
+ and then see if what follows matches the rest of the pattern. If the
pattern is specified as
^.*abcd$
- the initial .* matches the entire string at first, but when this fails
+ the initial .* matches the entire string at first, but when this fails
(because there is no following "a"), it backtracks to match all but the
- last character, then all but the last two characters, and so on. Once
- again the search for "a" covers the entire string, from right to left,
+ last character, then all but the last two characters, and so on. Once
+ again the search for "a" covers the entire string, from right to left,
so we are no better off. However, if the pattern is written as
^.*+(?<=abcd)
- there can be no backtracking for the .*+ item; it can match only the
- entire string. The subsequent lookbehind assertion does a single test
- on the last four characters. If it fails, the match fails immediately.
- For long strings, this approach makes a significant difference to the
+ there can be no backtracking for the .*+ item; it can match only the
+ entire string. The subsequent lookbehind assertion does a single test
+ on the last four characters. If it fails, the match fails immediately.
+ For long strings, this approach makes a significant difference to the
processing time.
Using multiple assertions
@@ -4158,18 +4273,18 @@ ASSERTIONS
(?<=\d{3})(?<!999)foo
- matches "foo" preceded by three digits that are not "999". Notice that
- each of the assertions is applied independently at the same point in
- the subject string. First there is a check that the previous three
- characters are all digits, and then there is a check that the same
+ matches "foo" preceded by three digits that are not "999". Notice that
+ each of the assertions is applied independently at the same point in
+ the subject string. First there is a check that the previous three
+ characters are all digits, and then there is a check that the same
three characters are not "999". This pattern does not match "foo" pre-
- ceded by six characters, the first of which are digits and the last
- three of which are not "999". For example, it doesn't match "123abc-
+ ceded by six characters, the first of which are digits and the last
+ three of which are not "999". For example, it doesn't match "123abc-
foo". A pattern to do that is
(?<=\d{3}...)(?<!999)foo
- This time the first assertion looks at the preceding six characters,
+ This time the first assertion looks at the preceding six characters,
checking that the first three are digits, and then the second assertion
checks that the preceding three characters are not "999".
@@ -4177,79 +4292,79 @@ ASSERTIONS
(?<=(?<!foo)bar)baz
- matches an occurrence of "baz" that is preceded by "bar" which in turn
+ matches an occurrence of "baz" that is preceded by "bar" which in turn
is not preceded by "foo", while
(?<=\d{3}(?!999)...)foo
- is another pattern that matches "foo" preceded by three digits and any
+ is another pattern that matches "foo" preceded by three digits and any
three characters that are not "999".
CONDITIONAL SUBPATTERNS
- It is possible to cause the matching process to obey a subpattern con-
- ditionally or to choose between two alternative subpatterns, depending
- on the result of an assertion, or whether a previous capturing subpat-
- tern matched or not. The two possible forms of conditional subpattern
+ It is possible to cause the matching process to obey a subpattern con-
+ ditionally or to choose between two alternative subpatterns, depending
+ on the result of an assertion, or whether a previous capturing subpat-
+ tern matched or not. The two possible forms of conditional subpattern
are
(?(condition)yes-pattern)
(?(condition)yes-pattern|no-pattern)
- If the condition is satisfied, the yes-pattern is used; otherwise the
- no-pattern (if present) is used. If there are more than two alterna-
+ If the condition is satisfied, the yes-pattern is used; otherwise the
+ no-pattern (if present) is used. If there are more than two alterna-
tives in the subpattern, a compile-time error occurs.
- There are four kinds of condition: references to subpatterns, refer-
+ There are four kinds of condition: references to subpatterns, refer-
ences to recursion, a pseudo-condition called DEFINE, and assertions.
Checking for a used subpattern by number
- If the text between the parentheses consists of a sequence of digits,
- the condition is true if the capturing subpattern of that number has
- previously matched. An alternative notation is to precede the digits
+ If the text between the parentheses consists of a sequence of digits,
+ the condition is true if the capturing subpattern of that number has
+ previously matched. An alternative notation is to precede the digits
with a plus or minus sign. In this case, the subpattern number is rela-
tive rather than absolute. The most recently opened parentheses can be
- referenced by (?(-1), the next most recent by (?(-2), and so on. In
+ referenced by (?(-1), the next most recent by (?(-2), and so on. In
looping constructs it can also make sense to refer to subsequent groups
with constructs such as (?(+2).
- Consider the following pattern, which contains non-significant white
+ Consider the following pattern, which contains non-significant white
space to make it more readable (assume the PCRE_EXTENDED option) and to
divide it into three parts for ease of discussion:
( \( )? [^()]+ (?(1) \) )
- The first part matches an optional opening parenthesis, and if that
+ The first part matches an optional opening parenthesis, and if that
character is present, sets it as the first captured substring. The sec-
- ond part matches one or more characters that are not parentheses. The
+ ond part matches one or more characters that are not parentheses. The
third part is a conditional subpattern that tests whether the first set
of parentheses matched or not. If they did, that is, if subject started
with an opening parenthesis, the condition is true, and so the yes-pat-
- tern is executed and a closing parenthesis is required. Otherwise,
- since no-pattern is not present, the subpattern matches nothing. In
- other words, this pattern matches a sequence of non-parentheses,
+ tern is executed and a closing parenthesis is required. Otherwise,
+ since no-pattern is not present, the subpattern matches nothing. In
+ other words, this pattern matches a sequence of non-parentheses,
optionally enclosed in parentheses.
- If you were embedding this pattern in a larger one, you could use a
+ If you were embedding this pattern in a larger one, you could use a
relative reference:
...other stuff... ( \( )? [^()]+ (?(-1) \) ) ...
- This makes the fragment independent of the parentheses in the larger
+ This makes the fragment independent of the parentheses in the larger
pattern.
Checking for a used subpattern by name
- Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
- used subpattern by name. For compatibility with earlier versions of
- PCRE, which had this facility before Perl, the syntax (?(name)...) is
- also recognized. However, there is a possible ambiguity with this syn-
- tax, because subpattern names may consist entirely of digits. PCRE
- looks first for a named subpattern; if it cannot find one and the name
- consists entirely of digits, PCRE looks for a subpattern of that num-
- ber, which must be greater than zero. Using subpattern names that con-
+ Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
+ used subpattern by name. For compatibility with earlier versions of
+ PCRE, which had this facility before Perl, the syntax (?(name)...) is
+ also recognized. However, there is a possible ambiguity with this syn-
+ tax, because subpattern names may consist entirely of digits. PCRE
+ looks first for a named subpattern; if it cannot find one and the name
+ consists entirely of digits, PCRE looks for a subpattern of that num-
+ ber, which must be greater than zero. Using subpattern names that con-
sist entirely of digits is not recommended.
Rewriting the above example to use a named subpattern gives this:
@@ -4260,85 +4375,85 @@ CONDITIONAL SUBPATTERNS
Checking for pattern recursion
If the condition is the string (R), and there is no subpattern with the
- name R, the condition is true if a recursive call to the whole pattern
+ name R, the condition is true if a recursive call to the whole pattern
or any subpattern has been made. If digits or a name preceded by amper-
sand follow the letter R, for example:
(?(R3)...) or (?(R&name)...)
- the condition is true if the most recent recursion is into the subpat-
- tern whose number or name is given. This condition does not check the
+ the condition is true if the most recent recursion is into the subpat-
+ tern whose number or name is given. This condition does not check the
entire recursion stack.
- At "top level", all these recursion test conditions are false. Recur-
+ At "top level", all these recursion test conditions are false. Recur-
sive patterns are described below.
Defining subpatterns for use by reference only
- If the condition is the string (DEFINE), and there is no subpattern
- with the name DEFINE, the condition is always false. In this case,
- there may be only one alternative in the subpattern. It is always
- skipped if control reaches this point in the pattern; the idea of
- DEFINE is that it can be used to define "subroutines" that can be ref-
- erenced from elsewhere. (The use of "subroutines" is described below.)
- For example, a pattern to match an IPv4 address could be written like
+ If the condition is the string (DEFINE), and there is no subpattern
+ with the name DEFINE, the condition is always false. In this case,
+ there may be only one alternative in the subpattern. It is always
+ skipped if control reaches this point in the pattern; the idea of
+ DEFINE is that it can be used to define "subroutines" that can be ref-
+ erenced from elsewhere. (The use of "subroutines" is described below.)
+ For example, a pattern to match an IPv4 address could be written like
this (ignore whitespace and line breaks):
(?(DEFINE) (?<byte> 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
\b (?&byte) (\.(?&byte)){3} \b
- The first part of the pattern is a DEFINE group inside which a another
- group named "byte" is defined. This matches an individual component of
- an IPv4 address (a number less than 256). When matching takes place,
- this part of the pattern is skipped because DEFINE acts like a false
+ The first part of the pattern is a DEFINE group inside which a another
+ group named "byte" is defined. This matches an individual component of
+ an IPv4 address (a number less than 256). When matching takes place,
+ this part of the pattern is skipped because DEFINE acts like a false
condition.
The rest of the pattern uses references to the named group to match the
- four dot-separated components of an IPv4 address, insisting on a word
+ four dot-separated components of an IPv4 address, insisting on a word
boundary at each end.
Assertion conditions
- If the condition is not in any of the above formats, it must be an
- assertion. This may be a positive or negative lookahead or lookbehind
- assertion. Consider this pattern, again containing non-significant
+ If the condition is not in any of the above formats, it must be an
+ assertion. This may be a positive or negative lookahead or lookbehind
+ assertion. Consider this pattern, again containing non-significant
white space, and with the two alternatives on the second line:
(?(?=[^a-z]*[a-z])
\d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
- The condition is a positive lookahead assertion that matches an
- optional sequence of non-letters followed by a letter. In other words,
- it tests for the presence of at least one letter in the subject. If a
- letter is found, the subject is matched against the first alternative;
- otherwise it is matched against the second. This pattern matches
- strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
+ The condition is a positive lookahead assertion that matches an
+ optional sequence of non-letters followed by a letter. In other words,
+ it tests for the presence of at least one letter in the subject. If a
+ letter is found, the subject is matched against the first alternative;
+ otherwise it is matched against the second. This pattern matches
+ strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
letters and dd are digits.
COMMENTS
- The sequence (?# marks the start of a comment that continues up to the
- next closing parenthesis. Nested parentheses are not permitted. The
- characters that make up a comment play no part in the pattern matching
+ The sequence (?# marks the start of a comment that continues up to the
+ next closing parenthesis. Nested parentheses are not permitted. The
+ characters that make up a comment play no part in the pattern matching
at all.
- If the PCRE_EXTENDED option is set, an unescaped # character outside a
- character class introduces a comment that continues to immediately
+ If the PCRE_EXTENDED option is set, an unescaped # character outside a
+ character class introduces a comment that continues to immediately
after the next newline in the pattern.
RECURSIVE PATTERNS
- Consider the problem of matching a string in parentheses, allowing for
- unlimited nested parentheses. Without the use of recursion, the best
- that can be done is to use a pattern that matches up to some fixed
- depth of nesting. It is not possible to handle an arbitrary nesting
+ Consider the problem of matching a string in parentheses, allowing for
+ unlimited nested parentheses. Without the use of recursion, the best
+ that can be done is to use a pattern that matches up to some fixed
+ depth of nesting. It is not possible to handle an arbitrary nesting
depth.
For some time, Perl has provided a facility that allows regular expres-
- sions to recurse (amongst other things). It does this by interpolating
- Perl code in the expression at run time, and the code can refer to the
+ sions to recurse (amongst other things). It does this by interpolating
+ Perl code in the expression at run time, and the code can refer to the
expression itself. A Perl pattern using code interpolation to solve the
parentheses problem can be created like this:
@@ -4348,117 +4463,117 @@ RECURSIVE PATTERNS
refers recursively to the pattern in which it appears.
Obviously, PCRE cannot support the interpolation of Perl code. Instead,
- it supports special syntax for recursion of the entire pattern, and
- also for individual subpattern recursion. After its introduction in
- PCRE and Python, this kind of recursion was introduced into Perl at
+ it supports special syntax for recursion of the entire pattern, and
+ also for individual subpattern recursion. After its introduction in
+ PCRE and Python, this kind of recursion was introduced into Perl at
release 5.10.
- A special item that consists of (? followed by a number greater than
+ A special item that consists of (? followed by a number greater than
zero and a closing parenthesis is a recursive call of the subpattern of
- the given number, provided that it occurs inside that subpattern. (If
- not, it is a "subroutine" call, which is described in the next sec-
- tion.) The special item (?R) or (?0) is a recursive call of the entire
+ the given number, provided that it occurs inside that subpattern. (If
+ not, it is a "subroutine" call, which is described in the next sec-
+ tion.) The special item (?R) or (?0) is a recursive call of the entire
regular expression.
- In PCRE (like Python, but unlike Perl), a recursive subpattern call is
+ In PCRE (like Python, but unlike Perl), a recursive subpattern call is
always treated as an atomic group. That is, once it has matched some of
the subject string, it is never re-entered, even if it contains untried
alternatives and there is a subsequent matching failure.
- This PCRE pattern solves the nested parentheses problem (assume the
+ This PCRE pattern solves the nested parentheses problem (assume the
PCRE_EXTENDED option is set so that white space is ignored):
\( ( (?>[^()]+) | (?R) )* \)
- First it matches an opening parenthesis. Then it matches any number of
- substrings which can either be a sequence of non-parentheses, or a
- recursive match of the pattern itself (that is, a correctly parenthe-
+ First it matches an opening parenthesis. Then it matches any number of
+ substrings which can either be a sequence of non-parentheses, or a
+ recursive match of the pattern itself (that is, a correctly parenthe-
sized substring). Finally there is a closing parenthesis.
- If this were part of a larger pattern, you would not want to recurse
+ If this were part of a larger pattern, you would not want to recurse
the entire pattern, so instead you could use this:
( \( ( (?>[^()]+) | (?1) )* \) )
- We have put the pattern into parentheses, and caused the recursion to
+ We have put the pattern into parentheses, and caused the recursion to
refer to them instead of the whole pattern.
- In a larger pattern, keeping track of parenthesis numbers can be
- tricky. This is made easier by the use of relative references. (A Perl
- 5.10 feature.) Instead of (?1) in the pattern above you can write
+ In a larger pattern, keeping track of parenthesis numbers can be
+ tricky. This is made easier by the use of relative references. (A Perl
+ 5.10 feature.) Instead of (?1) in the pattern above you can write
(?-2) to refer to the second most recently opened parentheses preceding
- the recursion. In other words, a negative number counts capturing
+ the recursion. In other words, a negative number counts capturing
parentheses leftwards from the point at which it is encountered.
- It is also possible to refer to subsequently opened parentheses, by
- writing references such as (?+2). However, these cannot be recursive
- because the reference is not inside the parentheses that are refer-
- enced. They are always "subroutine" calls, as described in the next
+ It is also possible to refer to subsequently opened parentheses, by
+ writing references such as (?+2). However, these cannot be recursive
+ because the reference is not inside the parentheses that are refer-
+ enced. They are always "subroutine" calls, as described in the next
section.
- An alternative approach is to use named parentheses instead. The Perl
- syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
+ An alternative approach is to use named parentheses instead. The Perl
+ syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
supported. We could rewrite the above example as follows:
(?<pn> \( ( (?>[^()]+) | (?&pn) )* \) )
- If there is more than one subpattern with the same name, the earliest
+ If there is more than one subpattern with the same name, the earliest
one is used.
- This particular example pattern that we have been looking at contains
- nested unlimited repeats, and so the use of atomic grouping for match-
- ing strings of non-parentheses is important when applying the pattern
+ This particular example pattern that we have been looking at contains
+ nested unlimited repeats, and so the use of atomic grouping for match-
+ ing strings of non-parentheses is important when applying the pattern
to strings that do not match. For example, when this pattern is applied
to
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
- it yields "no match" quickly. However, if atomic grouping is not used,
- the match runs for a very long time indeed because there are so many
- different ways the + and * repeats can carve up the subject, and all
+ it yields "no match" quickly. However, if atomic grouping is not used,
+ the match runs for a very long time indeed because there are so many
+ different ways the + and * repeats can carve up the subject, and all
have to be tested before failure can be reported.
At the end of a match, the values set for any capturing subpatterns are
those from the outermost level of the recursion at which the subpattern
- value is set. If you want to obtain intermediate values, a callout
- function can be used (see below and the pcrecallout documentation). If
+ value is set. If you want to obtain intermediate values, a callout
+ function can be used (see below and the pcrecallout documentation). If
the pattern above is matched against
(ab(cd)ef)
- the value for the capturing parentheses is "ef", which is the last
- value taken on at the top level. If additional parentheses are added,
+ the value for the capturing parentheses is "ef", which is the last
+ value taken on at the top level. If additional parentheses are added,
giving
\( ( ( (?>[^()]+) | (?R) )* ) \)
^ ^
^ ^
- the string they capture is "ab(cd)ef", the contents of the top level
- parentheses. If there are more than 15 capturing parentheses in a pat-
+ the string they capture is "ab(cd)ef", the contents of the top level
+ parentheses. If there are more than 15 capturing parentheses in a pat-
tern, PCRE has to obtain extra memory to store data during a recursion,
- which it does by using pcre_malloc, freeing it via pcre_free after-
- wards. If no memory can be obtained, the match fails with the
+ which it does by using pcre_malloc, freeing it via pcre_free after-
+ wards. If no memory can be obtained, the match fails with the
PCRE_ERROR_NOMEMORY error.
- Do not confuse the (?R) item with the condition (R), which tests for
- recursion. Consider this pattern, which matches text in angle brack-
- ets, allowing for arbitrary nesting. Only digits are allowed in nested
- brackets (that is, when recursing), whereas any characters are permit-
+ Do not confuse the (?R) item with the condition (R), which tests for
+ recursion. Consider this pattern, which matches text in angle brack-
+ ets, allowing for arbitrary nesting. Only digits are allowed in nested
+ brackets (that is, when recursing), whereas any characters are permit-
ted at the outer level.
< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >
- In this pattern, (?(R) is the start of a conditional subpattern, with
- two different alternatives for the recursive and non-recursive cases.
+ In this pattern, (?(R) is the start of a conditional subpattern, with
+ two different alternatives for the recursive and non-recursive cases.
The (?R) item is the actual recursive call.
SUBPATTERNS AS SUBROUTINES
If the syntax for a recursive subpattern reference (either by number or
- by name) is used outside the parentheses to which it refers, it oper-
- ates like a subroutine in a programming language. The "called" subpat-
+ by name) is used outside the parentheses to which it refers, it oper-
+ ates like a subroutine in a programming language. The "called" subpat-
tern may be defined before or after the reference. A numbered reference
can be absolute or relative, as in these examples:
@@ -4470,65 +4585,182 @@ SUBPATTERNS AS SUBROUTINES
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
+ matches "sense and sensibility" and "response and responsibility", but
not "sense and responsibility". If instead the pattern
(sens|respons)e and (?1)ibility
- is used, it does match "sense and responsibility" as well as the other
- two strings. Another example is given in the discussion of DEFINE
+ is used, it does match "sense and responsibility" as well as the other
+ two strings. Another example is given in the discussion of DEFINE
above.
Like recursive subpatterns, a "subroutine" call is always treated as an
- atomic group. That is, once it has matched some of the subject string,
- it is never re-entered, even if it contains untried alternatives and
+ atomic group. That is, once it has matched some of the subject string,
+ it is never re-entered, even if it contains untried alternatives and
there is a subsequent matching failure.
- When a subpattern is used as a subroutine, processing options such as
+ When a subpattern is used as a subroutine, processing options such as
case-independence are fixed when the subpattern is defined. They cannot
be changed for different calls. For example, consider this pattern:
(abc)(?i:(?-1))
- It matches "abcabc". It does not match "abcABC" because the change of
+ It matches "abcabc". It does not match "abcABC" because the change of
processing option does not affect the called subpattern.
CALLOUTS
Perl has a feature whereby using the sequence (?{...}) causes arbitrary
- Perl code to be obeyed in the middle of matching a regular expression.
+ Perl code to be obeyed in the middle of matching a regular expression.
This makes it possible, amongst other things, to extract different sub-
strings that match the same pair of parentheses when there is a repeti-
tion.
PCRE provides a similar feature, but of course it cannot obey arbitrary
Perl code. The feature is called "callout". The caller of PCRE provides
- an external function by putting its entry point in the global variable
- pcre_callout. By default, this variable contains NULL, which disables
+ an external function by putting its entry point in the global variable
+ pcre_callout. By default, this variable contains NULL, which disables
all calling out.
- Within a regular expression, (?C) indicates the points at which the
- external function is to be called. If you want to identify different
- callout points, you can put a number less than 256 after the letter C.
- The default value is zero. For example, this pattern has two callout
+ Within a regular expression, (?C) indicates the points at which the
+ external function is to be called. If you want to identify different
+ callout points, you can put a number less than 256 after the letter C.
+ The default value is zero. For example, this pattern has two callout
points:
(?C1)abc(?C2)def
If the PCRE_AUTO_CALLOUT flag is passed to pcre_compile(), callouts are
- automatically installed before each item in the pattern. They are all
+ automatically installed before each item in the pattern. They are all
numbered 255.
During matching, when PCRE reaches a callout point (and pcre_callout is
- set), the external function is called. It is provided with the number
- of the callout, the position in the pattern, and, optionally, one item
- of data originally supplied by the caller of pcre_exec(). The callout
- function may cause matching to proceed, to backtrack, or to fail alto-
+ set), the external function is called. It is provided with the number
+ of the callout, the position in the pattern, and, optionally, one item
+ of data originally supplied by the caller of pcre_exec(). The callout
+ function may cause matching to proceed, to backtrack, or to fail alto-
gether. A complete description of the interface to the callout function
is given in the pcrecallout documentation.
+BACTRACKING CONTROL
+
+ Perl 5.10 introduced a number of "Special Backtracking Control Verbs",
+ which are described in the Perl documentation as "experimental and sub-
+ ject to change or removal in a future version of Perl". It goes on to
+ say: "Their usage in production code should be noted to avoid problems
+ during upgrades." The same remarks apply to the PCRE features described
+ in this section.
+
+ Since these verbs are specifically related to backtracking, they can be
+ used only when the pattern is to be matched using pcre_exec(), which
+ uses a backtracking algorithm. They cause an error if encountered by
+ pcre_dfa_exec().
+
+ The new verbs make use of what was previously invalid syntax: an open-
+ ing parenthesis followed by an asterisk. In Perl, they are generally of
+ the form (*VERB:ARG) but PCRE does not support the use of arguments, so
+ its general form is just (*VERB). Any number of these verbs may occur
+ in a pattern. There are two kinds:
+
+ Verbs that act immediately
+
+ The following verbs act as soon as they are encountered:
+
+ (*ACCEPT)
+
+ This verb causes the match to end successfully, skipping the remainder
+ of the pattern. When inside a recursion, only the innermost pattern is
+ ended immediately. PCRE differs from Perl in what happens if the
+ (*ACCEPT) is inside capturing parentheses. In Perl, the data so far is
+ captured: in PCRE no data is captured. For example:
+
+ A(A|B(*ACCEPT)|C)D
+
+ This matches "AB", "AAD", or "ACD", but when it matches "AB", no data
+ is captured.
+
+ (*FAIL) or (*F)
+
+ This verb causes the match to fail, forcing backtracking to occur. It
+ is equivalent to (?!) but easier to read. The Perl documentation notes
+ that it is probably useful only when combined with (?{}) or (??{}).
+ Those are, of course, Perl features that are not present in PCRE. The
+ nearest equivalent is the callout feature, as for example in this pat-
+ tern:
+
+ a+(?C)(*FAIL)
+
+ A match with the string "aaaa" always fails, but the callout is taken
+ before each backtrack happens (in this example, 10 times).
+
+ Verbs that act after backtracking
+
+ The following verbs do nothing when they are encountered. Matching con-
+ tinues with what follows, but if there is no subsequent match, a fail-
+ ure is forced. The verbs differ in exactly what kind of failure
+ occurs.
+
+ (*COMMIT)
+
+ This verb causes the whole match to fail outright if the rest of the
+ pattern does not match. Even if the pattern is unanchored, no further
+ attempts to find a match by advancing the start point take place. Once
+ (*COMMIT) has been passed, pcre_exec() is committed to finding a match
+ at the current starting point, or not at all. For example:
+
+ a+(*COMMIT)b
+
+ This matches "xxaab" but not "aacaab". It can be thought of as a kind
+ of dynamic anchor, or "I've started, so I must finish."
+
+ (*PRUNE)
+
+ This verb causes the match to fail at the current position if the rest
+ of the pattern does not match. If the pattern is unanchored, the normal
+ "bumpalong" advance to the next starting character then happens. Back-
+ tracking can occur as usual to the left of (*PRUNE), or when matching
+ to the right of (*PRUNE), but if there is no match to the right, back-
+ tracking cannot cross (*PRUNE). In simple cases, the use of (*PRUNE)
+ is just an alternative to an atomic group or possessive quantifier, but
+ there are some uses of (*PRUNE) that cannot be expressed in any other
+ way.
+
+ (*SKIP)
+
+ This verb is like (*PRUNE), except that if the pattern is unanchored,
+ the "bumpalong" advance is not to the next character, but to the posi-
+ tion in the subject where (*SKIP) was encountered. (*SKIP) signifies
+ that whatever text was matched leading up to it cannot be part of a
+ successful match. Consider:
+
+ a+(*SKIP)b
+
+ If the subject is "aaaac...", after the first match attempt fails
+ (starting at the first character in the string), the starting point
+ skips on to start the next attempt at "c". Note that a possessive quan-
+ tifer does not have the same effect in this example; although it would
+ suppress backtracking during the first match attempt, the second
+ attempt would start at the second character instead of skipping on to
+ "c".
+
+ (*THEN)
+
+ This verb causes a skip to the next alternation if the rest of the pat-
+ tern does not match. That is, it cancels pending backtracking, but only
+ within the current alternation. Its name comes from the observation
+ that it can be used for a pattern-based if-then-else block:
+
+ ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
+
+ If the COND1 pattern matches, FOO is tried (and possibly further items
+ after the end of the group if FOO succeeds); on failure the matcher
+ skips to the second alternative and tries COND2, without backtracking
+ into COND1. If (*THEN) is used outside of any alternation, it acts
+ exactly like (*PRUNE).
+
+
SEE ALSO
pcreapi(3), pcrecallout(3), pcrematching(3), pcre(3).
@@ -4543,7 +4775,335 @@ AUTHOR
REVISION
- Last updated: 19 June 2007
+ Last updated: 21 August 2007
+ Copyright (c) 1997-2007 University of Cambridge.
+------------------------------------------------------------------------------
+
+
+PCRESYNTAX(3) PCRESYNTAX(3)
+
+
+NAME
+ PCRE - Perl-compatible regular expressions
+
+
+PCRE REGULAR EXPRESSION SYNTAX SUMMARY
+
+ The full syntax and semantics of the regular expressions that are sup-
+ ported by PCRE are described in the pcrepattern documentation. This
+ document contains just a quick-reference summary of the syntax.
+
+
+QUOTING
+
+ \x where x is non-alphanumeric is a literal x
+ \Q...\E treat enclosed characters as literal
+
+
+CHARACTERS
+
+ \a alarm, that is, the BEL character (hex 07)
+ \cx "control-x", where x is any character
+ \e escape (hex 1B)
+ \f formfeed (hex 0C)
+ \n newline (hex 0A)
+ \r carriage return (hex 0D)
+ \t tab (hex 09)
+ \ddd character with octal code ddd, or backreference
+ \xhh character with hex code hh
+ \x{hhh..} character with hex code hhh..
+
+
+CHARACTER TYPES
+
+ . any character except newline;
+ in dotall mode, any character whatsoever
+ \C one byte, even in UTF-8 mode (best avoided)
+ \d a decimal digit
+ \D a character that is not a decimal digit
+ \h a horizontal whitespace character
+ \H a character that is not a horizontal whitespace character
+ \p{xx} a character with the xx property
+ \P{xx} a character without the xx property
+ \R a newline sequence
+ \s a whitespace character
+ \S a character that is not a whitespace character
+ \v a vertical whitespace character
+ \V a character that is not a vertical whitespace character
+ \w a "word" character
+ \W a "non-word" character
+ \X an extended Unicode sequence
+
+ In PCRE, \d, \D, \s, \S, \w, and \W recognize only ASCII characters.
+
+
+GENERAL CATEGORY PROPERTY CODES FOR \p and \P
+
+ C Other
+ Cc Control
+ Cf Format
+ Cn Unassigned
+ Co Private use
+ Cs Surrogate
+
+ L Letter
+ Ll Lower case letter
+ Lm Modifier letter
+ Lo Other letter
+ Lt Title case letter
+ Lu Upper case letter
+ L& Ll, Lu, or Lt
+
+ M Mark
+ Mc Spacing mark
+ Me Enclosing mark
+ Mn Non-spacing mark
+
+ N Number
+ Nd Decimal number
+ Nl Letter number
+ No Other number
+
+ P Punctuation
+ Pc Connector punctuation
+ Pd Dash punctuation
+ Pe Close punctuation
+ Pf Final punctuation
+ Pi Initial punctuation
+ Po Other punctuation
+ Ps Open punctuation
+
+ S Symbol
+ Sc Currency symbol
+ Sk Modifier symbol
+ Sm Mathematical symbol
+ So Other symbol
+
+ Z Separator
+ Zl Line separator
+ Zp Paragraph separator
+ Zs Space separator
+
+
+SCRIPT NAMES FOR \p AND \P
+
+ Arabic, Armenian, Balinese, Bengali, Bopomofo, Braille, Buginese,
+ Buhid, Canadian_Aboriginal, Cherokee, Common, Coptic, Cuneiform,
+ Cypriot, Cyrillic, Deseret, Devanagari, Ethiopic, Georgian, Glagolitic,
+ Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira-
+ gana, Inherited, Kannada, Katakana, Kharoshthi, Khmer, Lao, Latin,
+ Limbu, Linear_B, Malayalam, Mongolian, Myanmar, New_Tai_Lue, Nko,
+ Ogham, Old_Italic, Old_Persian, Oriya, Osmanya, Phags_Pa, Phoenician,
+ Runic, Shavian, Sinhala, Syloti_Nagri, Syriac, Tagalog, Tagbanwa,
+ Tai_Le, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Yi.
+
+
+CHARACTER CLASSES
+
+ [...] positive character class
+ [^...] negative character class
+ [x-y] range (can be used for hex characters)
+ [[:xxx:]] positive POSIX named set
+ [[^:xxx:]] negative POSIX named set
+
+ alnum alphanumeric
+ alpha alphabetic
+ ascii 0-127
+ blank space or tab
+ cntrl control character
+ digit decimal digit
+ graph printing, excluding space
+ lower lower case letter
+ print printing, including space
+ punct printing, excluding alphanumeric
+ space whitespace
+ upper upper case letter
+ word same as \w
+ xdigit hexadecimal digit
+
+ In PCRE, POSIX character set names recognize only ASCII characters. You
+ can use \Q...\E inside a character class.
+
+
+QUANTIFIERS
+
+ ? 0 or 1, greedy
+ ?+ 0 or 1, possessive
+ ?? 0 or 1, lazy
+ * 0 or more, greedy
+ *+ 0 or more, possessive
+ *? 0 or more, lazy
+ + 1 or more, greedy
+ ++ 1 or more, possessive
+ +? 1 or more, lazy
+ {n} exactly n
+ {n,m} at least n, no more than m, greedy
+ {n,m}+ at least n, no more than m, possessive
+ {n,m}? at least n, no more than m, lazy
+ {n,} n or more, greedy
+ {n,}+ n or more, possessive
+ {n,}? n or more, lazy
+
+
+ANCHORS AND SIMPLE ASSERTIONS
+
+ \b word boundary
+ \B not a word boundary
+ ^ start of subject
+ also after internal newline in multiline mode
+ \A start of subject
+ $ end of subject
+ also before newline at end of subject
+ also before internal newline in multiline mode
+ \Z end of subject
+ also before newline at end of subject
+ \z end of subject
+ \G first matching position in subject
+
+
+MATCH POINT RESET
+
+ \K reset start of match
+
+
+ALTERNATION
+
+ expr|expr|expr...
+
+
+CAPTURING
+
+ (...) capturing group
+ (?<name>...) named capturing group (Perl)
+ (?'name'...) named capturing group (Perl)
+ (?P<name>...) named capturing group (Python)
+ (?:...) non-capturing group
+ (?|...) non-capturing group; reset group numbers for
+ capturing groups in each alternative
+
+
+ATOMIC GROUPS
+
+ (?>...) atomic, non-capturing group
+
+
+COMMENT
+
+ (?#....) comment (not nestable)
+
+
+OPTION SETTING
+
+ (?i) caseless
+ (?J) allow duplicate names
+ (?m) multiline
+ (?s) single line (dotall)
+ (?U) default ungreedy (lazy)
+ (?x) extended (ignore white space)
+ (?-...) unset option(s)
+
+
+LOOKAHEAD AND LOOKBEHIND ASSERTIONS
+
+ (?=...) positive look ahead
+ (?!...) negative look ahead
+ (?<=...) positive look behind
+ (?<!...) negative look behind
+
+ Each top-level branch of a look behind must be of a fixed length.
+
+
+BACKREFERENCES
+
+ \n reference by number (can be ambiguous)
+ \gn reference by number
+ \g{n} reference by number
+ \g{-n} relative reference by number
+ \k<name> reference by name (Perl)
+ \k'name' reference by name (Perl)
+ \g{name} reference by name (Perl)
+ \k{name} reference by name (.NET)
+ (?P=name) reference by name (Python)
+
+
+SUBROUTINE REFERENCES (POSSIBLY RECURSIVE)
+
+ (?R) recurse whole pattern
+ (?n) call subpattern by absolute number
+ (?+n) call subpattern by relative number
+ (?-n) call subpattern by relative number
+ (?&name) call subpattern by name (Perl)
+ (?P>name) call subpattern by name (Python)
+
+
+CONDITIONAL PATTERNS
+
+ (?(condition)yes-pattern)
+ (?(condition)yes-pattern|no-pattern)
+
+ (?(n)... absolute reference condition
+ (?(+n)... relative reference condition
+ (?(-n)... relative reference condition
+ (?(<name>)... named reference condition (Perl)
+ (?('name')... named reference condition (Perl)
+ (?(name)... named reference condition (PCRE)
+ (?(R)... overall recursion condition
+ (?(Rn)... specific group recursion condition
+ (?(R&name)... specific recursion condition
+ (?(DEFINE)... define subpattern for reference
+ (?(assert)... assertion condition
+
+
+BACKTRACKING CONTROL
+
+ The following act immediately they are reached:
+
+ (*ACCEPT) force successful match
+ (*FAIL) force backtrack; synonym (*F)
+
+ The following act only when a subsequent match failure causes a back-
+ track to reach them. They all force a match failure, but they differ in
+ what happens afterwards. Those that advance the start-of-match point do
+ so only if the pattern is not anchored.
+
+ (*COMMIT) overall failure, no advance of starting point
+ (*PRUNE) advance to next starting character
+ (*SKIP) advance start to current matching position
+ (*THEN) local failure, backtrack to next alternation
+
+
+NEWLINE CONVENTIONS
+
+ These are recognized only at the very start of a pattern.
+
+ (*CR)
+ (*LF)
+ (*CRLF)
+ (*ANYCRLF)
+ (*ANY)
+
+
+CALLOUTS
+
+ (?C) callout
+ (?Cn) callout with data n
+
+
+SEE ALSO
+
+ pcrepattern(3), pcreapi(3), pcrecallout(3), pcrematching(3), pcre(3).
+
+
+AUTHOR
+
+ Philip Hazel
+ University Computing Service
+ Cambridge CB2 3QH, England.
+
+
+REVISION
+
+ Last updated: 21 August 2007
Copyright (c) 1997-2007 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/ext/pcre/pcrelib/pcre.h b/ext/pcre/pcrelib/pcre.h
index 739989629..a002bbd5a 100644
--- a/ext/pcre/pcrelib/pcre.h
+++ b/ext/pcre/pcrelib/pcre.h
@@ -42,19 +42,25 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE_MAJOR 7
-#define PCRE_MINOR 2
+#define PCRE_MINOR 3
#define PCRE_PRERELEASE
-#define PCRE_DATE 2007-06-19
+#define PCRE_DATE 2007-08-28
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE, the appropriate
export setting is defined in pcre_internal.h, which includes this file. So we
-don't change an existing definition of PCRE_EXP_DECL. */
+don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
-#ifndef PCRE_EXP_DECL
-# ifdef _WIN32
-# ifndef PCRE_STATIC
-# define PCRE_EXP_DECL extern __declspec(dllimport)
+#if defined(_WIN32) && !defined(PCRE_STATIC)
+# ifndef PCRE_EXP_DECL
+# define PCRE_EXP_DECL extern __declspec(dllimport)
+# endif
+# ifdef __cplusplus
+# ifndef PCRECPP_EXP_DECL
+# define PCRECPP_EXP_DECL extern __declspec(dllimport)
+# endif
+# ifndef PCRECPP_EXP_DEFN
+# define PCRECPP_EXP_DEFN __declspec(dllimport)
# endif
# endif
#endif
@@ -63,9 +69,18 @@ don't change an existing definition of PCRE_EXP_DECL. */
#ifndef PCRE_EXP_DECL
# ifdef __cplusplus
-# define PCRE_EXP_DECL extern "C"
+# define PCRE_EXP_DECL extern "C"
# else
-# define PCRE_EXP_DECL extern
+# define PCRE_EXP_DECL extern
+# endif
+#endif
+
+#ifdef __cplusplus
+# ifndef PCRECPP_EXP_DECL
+# define PCRECPP_EXP_DECL extern
+# endif
+# ifndef PCRECPP_EXP_DEFN
+# define PCRECPP_EXP_DEFN
# endif
#endif
@@ -132,7 +147,7 @@ extern "C" {
#define PCRE_ERROR_DFA_WSSIZE (-19)
#define PCRE_ERROR_DFA_RECURSE (-20)
#define PCRE_ERROR_RECURSIONLIMIT (-21)
-#define PCRE_ERROR_NULLWSLIMIT (-22)
+#define PCRE_ERROR_NOTUSED (-22)
#define PCRE_ERROR_BADNEWLINE (-23)
/* Request types for pcre_fullinfo() */
@@ -152,6 +167,7 @@ extern "C" {
#define PCRE_INFO_DEFAULT_TABLES 11
#define PCRE_INFO_OKPARTIAL 12
#define PCRE_INFO_JCHANGED 13
+#define PCRE_INFO_HASCRORLF 14
/* Request types for pcre_config(). Do not re-arrange, in order to remain
compatible. */
diff --git a/ext/pcre/pcrelib/pcre_chartables.c b/ext/pcre/pcrelib/pcre_chartables.c
index 6494d8e98..bec2d0c04 100644
--- a/ext/pcre/pcrelib/pcre_chartables.c
+++ b/ext/pcre/pcrelib/pcre_chartables.c
@@ -14,12 +14,14 @@ example ISO-8859-1. When dftables is run, it creates these tables in the
current locale. If PCRE is configured with --enable-rebuild-chartables, this
happens automatically.
-The following #include is present because without it gcc 4.x may remove the
+The following #includes are present because without the gcc 4.x may remove the
array definition from the final binary if PCRE is built into a static library
and dead code stripping is activated. This leads to link errors. Pulling in the
header ensures that the array gets flagged as "someone outside this compilation
unit might reference this" and so it will always be supplied to the linker. */
+#include <config.h>
+
#include "pcre_internal.h"
const unsigned char _pcre_default_tables[] = {
diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c
index c191539c8..77ec51cac 100644
--- a/ext/pcre/pcrelib/pcre_compile.c
+++ b/ext/pcre/pcrelib/pcre_compile.c
@@ -42,11 +42,12 @@ POSSIBILITY OF SUCH DAMAGE.
supporting internal functions that are not used by other modules. */
+#include <config.h>
+
#define NLBLOCK cd /* Block containing newline information */
#define PSSTART start_pattern /* Field containing processed string start */
#define PSEND end_pattern /* Field containing processed string end */
-
#include "pcre_internal.h"
@@ -62,6 +63,13 @@ used by pcretest. DEBUG is not defined when building a production library. */
#define SETBIT(a,b) a[b/8] |= (1 << (b%8))
+/* Maximum length value to check against when making sure that the integer that
+holds the compiled pattern length does not overflow. We make it a bit less than
+INT_MAX to allow for adding in group terminating bytes, so that we don't have
+to check them every time. */
+
+#define OFLOW_MAX (INT_MAX - 20)
+
/*************************************************
* Code parameters and static tables *
@@ -120,7 +128,7 @@ static const short int escapes[] = {
/* B8 */ 0, 0, 0, 0, 0, ']', '=', '-',
/* C0 */ '{',-ESC_A, -ESC_B, -ESC_C, -ESC_D,-ESC_E, 0, -ESC_G,
/* C8 */-ESC_H, 0, 0, 0, 0, 0, 0, 0,
-/* D0 */ '}', 0, 0, 0, 0, 0, 0, -ESC_P,
+/* D0 */ '}', 0, -ESC_K, 0, 0, 0, 0, -ESC_P,
/* D8 */-ESC_Q,-ESC_R, 0, 0, 0, 0, 0, 0,
/* E0 */ '\\', 0, -ESC_S, 0, 0,-ESC_V, -ESC_W, -ESC_X,
/* E8 */ 0,-ESC_Z, 0, 0, 0, 0, 0, 0,
@@ -130,6 +138,27 @@ static const short int escapes[] = {
#endif
+/* Table of special "verbs" like (*PRUNE) */
+
+typedef struct verbitem {
+ const char *name;
+ int len;
+ int op;
+} verbitem;
+
+static verbitem verbs[] = {
+ { "ACCEPT", 6, OP_ACCEPT },
+ { "COMMIT", 6, OP_COMMIT },
+ { "F", 1, OP_FAIL },
+ { "FAIL", 4, OP_FAIL },
+ { "PRUNE", 5, OP_PRUNE },
+ { "SKIP", 4, OP_SKIP },
+ { "THEN", 4, OP_THEN }
+};
+
+static int verbcount = sizeof(verbs)/sizeof(verbitem);
+
+
/* Tables of names of POSIX character classes and their lengths. The list is
terminated by a zero length entry. The first three must be alpha, lower, upper,
as this is assumed for handling case independence. */
@@ -203,7 +232,7 @@ static const char *error_texts[] = {
"missing ) after comment",
"parentheses nested too deeply", /** DEAD **/
/* 20 */
- "regular expression too large",
+ "regular expression is too large",
"failed to get memory",
"unmatched parentheses",
"internal error: code overflow",
@@ -239,7 +268,7 @@ static const char *error_texts[] = {
"subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)",
"too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")",
/* 50 */
- "repeated subpattern is too long",
+ "repeated subpattern is too long", /** DEAD **/
"octal value is greater than \\377 (not in UTF-8 mode)",
"internal error: overran compiling workspace",
"internal error: previously-checked referenced subpattern not found",
@@ -248,7 +277,11 @@ static const char *error_texts[] = {
"repeating a DEFINE group is not allowed",
"inconsistent NEWLINE options",
"\\g is not followed by a braced name or an optionally braced non-zero number",
- "(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number"
+ "(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number",
+ "(*VERB) with an argument is not supported",
+ /* 60 */
+ "(*VERB) not recognized",
+ "number is too big"
};
@@ -405,7 +438,7 @@ Arguments:
Returns: zero or positive => a data character
negative => a special escape sequence
- on error, errorptr is set
+ on error, errorcodeptr is set
*/
static int
@@ -490,10 +523,16 @@ else
while ((digitab[ptr[1]] & ctype_digit) != 0)
c = c * 10 + *(++ptr) - '0';
+ if (c < 0)
+ {
+ *errorcodeptr = ERR61;
+ break;
+ }
+
if (c == 0 || (braced && *(++ptr) != '}'))
{
*errorcodeptr = ERR57;
- return 0;
+ break;
}
if (negated)
@@ -501,7 +540,7 @@ else
if (c > bracount)
{
*errorcodeptr = ERR15;
- return 0;
+ break;
}
c = bracount - (c - 1);
}
@@ -530,6 +569,11 @@ else
c -= '0';
while ((digitab[ptr[1]] & ctype_digit) != 0)
c = c * 10 + *(++ptr) - '0';
+ if (c < 0)
+ {
+ *errorcodeptr = ERR61;
+ break;
+ }
if (c < 10 || c <= bracount)
{
c = -(ESC_REF + c);
@@ -625,7 +669,7 @@ else
if (c == 0)
{
*errorcodeptr = ERR2;
- return 0;
+ break;
}
#ifndef EBCDIC /* ASCII coding */
@@ -701,7 +745,7 @@ if (c == '{')
*negptr = TRUE;
ptr++;
}
- for (i = 0; i < sizeof(name) - 1; i++)
+ for (i = 0; i < (int)sizeof(name) - 1; i++)
{
c = *(++ptr);
if (c == 0) goto ERROR_RETURN;
@@ -904,6 +948,7 @@ for (; *ptr != 0; ptr++)
{
while (*(++ptr) != ']')
{
+ if (*ptr == 0) return -1;
if (*ptr == '\\')
{
if (*(++ptr) == 0) return -1;
@@ -931,7 +976,7 @@ for (; *ptr != 0; ptr++)
/* An opening parens must now be a real metacharacter */
if (*ptr != '(') continue;
- if (ptr[1] != '?')
+ if (ptr[1] != '?' && ptr[1] != '*')
{
count++;
if (name == NULL && count == lorn) return count;
@@ -1059,7 +1104,6 @@ for (;;)
{
int d;
register int op = *cc;
-
switch (op)
{
case OP_CBRA:
@@ -1148,6 +1192,7 @@ for (;;)
case OP_TYPEEXACT:
branchlength += GET2(cc,1);
+ if (cc[3] == OP_PROP || cc[3] == OP_NOTPROP) cc += 2;
cc += 4;
break;
@@ -1256,13 +1301,42 @@ for (;;)
code += _pcre_OP_lengths[c];
}
- /* In UTF-8 mode, opcodes that are followed by a character may be followed by
- a multi-byte character. The length in the table is a minimum, so we have to
- arrange to skip the extra bytes. */
+ /* Otherwise, we can get the item's length from the table, except that for
+ repeated character types, we have to test for \p and \P, which have an extra
+ two bytes of parameters. */
else
{
+ switch(c)
+ {
+ case OP_TYPESTAR:
+ case OP_TYPEMINSTAR:
+ case OP_TYPEPLUS:
+ case OP_TYPEMINPLUS:
+ case OP_TYPEQUERY:
+ case OP_TYPEMINQUERY:
+ case OP_TYPEPOSSTAR:
+ case OP_TYPEPOSPLUS:
+ case OP_TYPEPOSQUERY:
+ if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+ break;
+
+ case OP_TYPEUPTO:
+ case OP_TYPEMINUPTO:
+ case OP_TYPEEXACT:
+ case OP_TYPEPOSUPTO:
+ if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2;
+ break;
+ }
+
+ /* Add in the fixed length from the table */
+
code += _pcre_OP_lengths[c];
+
+ /* In UTF-8 mode, opcodes that are followed by a character may be followed by
+ a multi-byte character. The length in the table is a minimum, so we have to
+ arrange to skip the extra bytes. */
+
#ifdef SUPPORT_UTF8
if (utf8) switch(c)
{
@@ -1320,14 +1394,42 @@ for (;;)
if (c == OP_XCLASS) code += GET(code, 1);
- /* Otherwise, we get the item's length from the table. In UTF-8 mode, opcodes
- that are followed by a character may be followed by a multi-byte character.
- The length in the table is a minimum, so we have to arrange to skip the extra
- bytes. */
+ /* Otherwise, we can get the item's length from the table, except that for
+ repeated character types, we have to test for \p and \P, which have an extra
+ two bytes of parameters. */
else
{
+ switch(c)
+ {
+ case OP_TYPESTAR:
+ case OP_TYPEMINSTAR:
+ case OP_TYPEPLUS:
+ case OP_TYPEMINPLUS:
+ case OP_TYPEQUERY:
+ case OP_TYPEMINQUERY:
+ case OP_TYPEPOSSTAR:
+ case OP_TYPEPOSPLUS:
+ case OP_TYPEPOSQUERY:
+ if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+ break;
+
+ case OP_TYPEPOSUPTO:
+ case OP_TYPEUPTO:
+ case OP_TYPEMINUPTO:
+ case OP_TYPEEXACT:
+ if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2;
+ break;
+ }
+
+ /* Add in the fixed length from the table */
+
code += _pcre_OP_lengths[c];
+
+ /* In UTF-8 mode, opcodes that are followed by a character may be followed
+ by a multi-byte character. The length in the table is a minimum, so we have
+ to arrange to skip the extra bytes. */
+
#ifdef SUPPORT_UTF8
if (utf8) switch(c)
{
@@ -1399,7 +1501,7 @@ for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE
/* For other groups, scan the branches. */
- if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE)
+ if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE || c == OP_COND)
{
BOOL empty_branch;
if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */
@@ -1423,11 +1525,15 @@ for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE
switch (c)
{
- /* Check for quantifiers after a class */
+ /* Check for quantifiers after a class. XCLASS is used for classes that
+ cannot be represented just by a bit map. This includes negated single
+ high-valued characters. The length in _pcre_OP_lengths[] is zero; the
+ actual length is stored in the compiled code, so we must update "code"
+ here. */
#ifdef SUPPORT_UTF8
case OP_XCLASS:
- ccode = code + GET(code, 1);
+ ccode = code += GET(code, 1);
goto CHECK_CLASS_REPEAT;
#endif
@@ -1489,6 +1595,26 @@ for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE
case OP_TYPEEXACT:
return FALSE;
+ /* These are going to continue, as they may be empty, but we have to
+ fudge the length for the \p and \P cases. */
+
+ case OP_TYPESTAR:
+ case OP_TYPEMINSTAR:
+ case OP_TYPEPOSSTAR:
+ case OP_TYPEQUERY:
+ case OP_TYPEMINQUERY:
+ case OP_TYPEPOSQUERY:
+ if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+ break;
+
+ /* Same for these */
+
+ case OP_TYPEUPTO:
+ case OP_TYPEMINUPTO:
+ case OP_TYPEPOSUPTO:
+ if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2;
+ break;
+
/* End of branch */
case OP_KET:
@@ -1651,6 +1777,7 @@ adjust_recurse(uschar *group, int adjust, BOOL utf8, compile_data *cd,
uschar *save_hwm)
{
uschar *ptr = group;
+
while ((ptr = (uschar *)find_recurse(ptr, utf8)) != NULL)
{
int offset;
@@ -2255,6 +2382,15 @@ for (;; ptr++)
*/
if (code < last_code) code = last_code;
+
+ /* Paranoid check for integer overflow */
+
+ if (OFLOW_MAX - *lengthptr < code - last_code)
+ {
+ *errorcodeptr = ERR20;
+ goto FAILED;
+ }
+
*lengthptr += code - last_code;
DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));
@@ -2367,6 +2503,11 @@ for (;; ptr++)
*ptrptr = ptr;
if (lengthptr != NULL)
{
+ if (OFLOW_MAX - *lengthptr < code - last_code)
+ {
+ *errorcodeptr = ERR20;
+ goto FAILED;
+ }
*lengthptr += code - last_code; /* To include callout length */
DPRINTF((">> end branch\n"));
}
@@ -2429,16 +2570,23 @@ for (;; ptr++)
goto FAILED;
}
- /* If the first character is '^', set the negation flag and skip it. */
+ /* If the first character is '^', set the negation flag and skip it. Also,
+ if the first few characters (either before or after ^) are \Q\E or \E we
+ skip them too. This makes for compatibility with Perl. */
- if ((c = *(++ptr)) == '^')
+ negate_class = FALSE;
+ for (;;)
{
- negate_class = TRUE;
c = *(++ptr);
- }
- else
- {
- negate_class = FALSE;
+ if (c == '\\')
+ {
+ if (ptr[1] == 'E') ptr++;
+ else if (strncmp((const char *)ptr+1, "Q\\E", 3) == 0) ptr += 3;
+ else break;
+ }
+ else if (!negate_class && c == '^')
+ negate_class = TRUE;
+ else break;
}
/* Keep a count of chars with values < 256 so that we can optimize the case
@@ -2579,7 +2727,7 @@ for (;; ptr++)
of the specials, which just set a flag. The sequence \b is a special
case. Inside a class (and only there) it is treated as backspace.
Elsewhere it marks a word boundary. Other escapes have preset maps ready
- to or into the one we are building. We assume they have more than one
+ to 'or' into the one we are building. We assume they have more than one
character in them, so set class_charcount bigger than one. */
if (c == '\\')
@@ -2599,6 +2747,7 @@ for (;; ptr++)
else inescq = TRUE;
continue;
}
+ else if (-c == ESC_E) continue; /* Ignore orphan \E */
if (c < 0)
{
@@ -3045,12 +3194,26 @@ for (;; ptr++)
goto FAILED;
}
+ /* Remember whether \r or \n are in this class */
+
+ if (negate_class)
+ {
+ if ((classbits[1] & 0x24) != 0x24) cd->external_options |= PCRE_HASCRORLF;
+ }
+ else
+ {
+ if ((classbits[1] & 0x24) != 0) cd->external_options |= PCRE_HASCRORLF;
+ }
+
/* If class_charcount is 1, we saw precisely one character whose value is
- less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we
- can optimize the negative case only if there were no characters >= 128
- because OP_NOT and the related opcodes like OP_NOTSTAR operate on
- single-bytes only. This is an historical hangover. Maybe one day we can
- tidy these opcodes to handle multi-byte characters.
+ less than 256. As long as there were no characters >= 128 and there was no
+ use of \p or \P, in other words, no use of any XCLASS features, we can
+ optimize.
+
+ In UTF-8 mode, we can optimize the negative case only if there were no
+ characters >= 128 because OP_NOT and the related opcodes like OP_NOTSTAR
+ operate on single-bytes only. This is an historical hangover. Maybe one day
+ we can tidy these opcodes to handle multi-byte characters.
The optimization throws away the bit map. We turn the item into a
1-character OP_CHAR[NC] if it's positive, or OP_NOT if it's negative. Note
@@ -3060,10 +3223,8 @@ for (;; ptr++)
reqbyte, save the previous value for reinstating. */
#ifdef SUPPORT_UTF8
- if (class_charcount == 1 &&
- (!utf8 ||
- (!class_utf8 && (!negate_class || class_lastchar < 128))))
-
+ if (class_charcount == 1 && !class_utf8 &&
+ (!utf8 || !negate_class || class_lastchar < 128))
#else
if (class_charcount == 1)
#endif
@@ -3521,14 +3682,6 @@ for (;; ptr++)
goto FAILED;
}
- /* This is a paranoid check to stop integer overflow later on */
-
- if (len > MAX_DUPLENGTH)
- {
- *errorcodeptr = ERR50;
- goto FAILED;
- }
-
/* If the maximum repeat count is unlimited, find the end of the bracket
by scanning through from the start, and compute the offset back to it
from the current code pointer. There may be an OP_OPT setting following
@@ -3617,10 +3770,21 @@ for (;; ptr++)
if (repeat_min > 1)
{
/* In the pre-compile phase, we don't actually do the replication. We
- just adjust the length as if we had. */
+ just adjust the length as if we had. Do some paranoid checks for
+ potential integer overflow. */
if (lengthptr != NULL)
- *lengthptr += (repeat_min - 1)*length_prevgroup;
+ {
+ int delta = (repeat_min - 1)*length_prevgroup;
+ if ((double)(repeat_min - 1)*(double)length_prevgroup >
+ (double)INT_MAX ||
+ OFLOW_MAX - *lengthptr < delta)
+ {
+ *errorcodeptr = ERR20;
+ goto FAILED;
+ }
+ *lengthptr += delta;
+ }
/* This is compiling for real */
@@ -3658,11 +3822,23 @@ for (;; ptr++)
/* In the pre-compile phase, we don't actually do the replication. We
just adjust the length as if we had. For each repetition we must add 1
to the length for BRAZERO and for all but the last repetition we must
- add 2 + 2*LINKSIZE to allow for the nesting that occurs. */
+ add 2 + 2*LINKSIZE to allow for the nesting that occurs. Do some
+ paranoid checks to avoid integer overflow. */
if (lengthptr != NULL && repeat_max > 0)
- *lengthptr += repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) -
- 2 - 2*LINK_SIZE; /* Last one doesn't nest */
+ {
+ int delta = repeat_max * (length_prevgroup + 1 + 2 + 2*LINK_SIZE) -
+ 2 - 2*LINK_SIZE; /* Last one doesn't nest */
+ if ((double)repeat_max *
+ (double)(length_prevgroup + 1 + 2 + 2*LINK_SIZE)
+ > (double)INT_MAX ||
+ OFLOW_MAX - *lengthptr < delta)
+ {
+ *errorcodeptr = ERR20;
+ goto FAILED;
+ }
+ *lengthptr += delta;
+ }
/* This is compiling for real */
@@ -3814,9 +3990,7 @@ for (;; ptr++)
/* ===================================================================*/
/* Start of nested parenthesized sub-expression, or comment or lookahead or
lookbehind or option setting or condition or all the other extended
- parenthesis forms. First deal with the specials; all are introduced by ?,
- and the appearance of any of them means that this is not a capturing
- group. */
+ parenthesis forms. */
case '(':
newoptions = options;
@@ -3825,7 +3999,44 @@ for (;; ptr++)
save_hwm = cd->hwm;
reset_bracount = FALSE;
- if (*(++ptr) == '?')
+ /* First deal with various "verbs" that can be introduced by '*'. */
+
+ if (*(++ptr) == '*' && (cd->ctypes[ptr[1]] & ctype_letter) != 0)
+ {
+ int i, namelen;
+ const uschar *name = ++ptr;
+ previous = NULL;
+ while ((cd->ctypes[*++ptr] & ctype_letter) != 0);
+ if (*ptr == ':')
+ {
+ *errorcodeptr = ERR59; /* Not supported */
+ goto FAILED;
+ }
+ if (*ptr != ')')
+ {
+ *errorcodeptr = ERR60;
+ goto FAILED;
+ }
+ namelen = ptr - name;
+ for (i = 0; i < verbcount; i++)
+ {
+ if (namelen == verbs[i].len &&
+ strncmp((char *)name, verbs[i].name, namelen) == 0)
+ {
+ *code = verbs[i].op;
+ if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;
+ break;
+ }
+ }
+ if (i < verbcount) continue;
+ *errorcodeptr = ERR60;
+ goto FAILED;
+ }
+
+ /* Deal with the extended parentheses; all are introduced by '?', and the
+ appearance of any of them means that this is not a capturing group. */
+
+ else if (*ptr == '?')
{
int i, set, unset, namelen;
int *optset;
@@ -4067,8 +4278,14 @@ for (;; ptr++)
/* ------------------------------------------------------------ */
case '!': /* Negative lookahead */
- bravalue = OP_ASSERT_NOT;
ptr++;
+ if (*ptr == ')') /* Optimize (?!) */
+ {
+ *code++ = OP_FAIL;
+ previous = NULL;
+ continue;
+ }
+ bravalue = OP_ASSERT_NOT;
break;
@@ -4617,23 +4834,29 @@ for (;; ptr++)
goto FAILED;
}
- /* In the pre-compile phase, update the length by the length of the nested
- group, less the brackets at either end. Then reduce the compiled code to
- just the brackets so that it doesn't use much memory if it is duplicated by
- a quantifier. */
+ /* In the pre-compile phase, update the length by the length of the group,
+ less the brackets at either end. Then reduce the compiled code to just a
+ set of non-capturing brackets so that it doesn't use much memory if it is
+ duplicated by a quantifier.*/
if (lengthptr != NULL)
{
+ if (OFLOW_MAX - *lengthptr < length_prevgroup - 2 - 2*LINK_SIZE)
+ {
+ *errorcodeptr = ERR20;
+ goto FAILED;
+ }
*lengthptr += length_prevgroup - 2 - 2*LINK_SIZE;
- code++;
+ *code++ = OP_BRA;
PUTINC(code, 0, 1 + LINK_SIZE);
*code++ = OP_KET;
PUTINC(code, 0, 1 + LINK_SIZE);
+ break; /* No need to waste time with special character handling */
}
/* Otherwise update the main code pointer to the end of the group. */
- else code = tempcode;
+ code = tempcode;
/* For a DEFINE group, required and first character settings are not
relevant. */
@@ -4837,6 +5060,11 @@ for (;; ptr++)
*code++ = ((options & PCRE_CASELESS) != 0)? OP_CHARNC : OP_CHAR;
for (c = 0; c < mclength; c++) *code++ = mcbuffer[c];
+ /* Remember if \r or \n were seen */
+
+ if (mcbuffer[0] == '\r' || mcbuffer[0] == '\n')
+ cd->external_options |= PCRE_HASCRORLF;
+
/* Set the first and required bytes appropriately. If no previous first
byte, set it from this character, but revert to none on a zero repeat.
Otherwise, leave the firstbyte value alone, and don't change it on a zero
@@ -5119,7 +5347,15 @@ for (;;)
*ptrptr = ptr;
*firstbyteptr = firstbyte;
*reqbyteptr = reqbyte;
- if (lengthptr != NULL) *lengthptr += length;
+ if (lengthptr != NULL)
+ {
+ if (OFLOW_MAX - *lengthptr < length)
+ {
+ *errorcodeptr = ERR20;
+ return FALSE;
+ }
+ *lengthptr += length;
+ }
return TRUE;
}
@@ -5428,6 +5664,7 @@ real_pcre *re;
int length = 1; /* For final END opcode */
int firstbyte, reqbyte, newline;
int errorcode = 0;
+int skipatstart = 0;
#ifdef SUPPORT_UTF8
BOOL utf8;
#endif
@@ -5506,13 +5743,33 @@ cd->fcc = tables + fcc_offset;
cd->cbits = tables + cbits_offset;
cd->ctypes = tables + ctypes_offset;
+/* Check for newline settings at the start of the pattern, and remember the
+offset for later. */
+
+if (ptr[0] == '(' && ptr[1] == '*')
+ {
+ int newnl = 0;
+ if (strncmp((char *)(ptr+2), "CR)", 3) == 0)
+ { skipatstart = 5; newnl = PCRE_NEWLINE_CR; }
+ else if (strncmp((char *)(ptr+2), "LF)", 3) == 0)
+ { skipatstart = 5; newnl = PCRE_NEWLINE_LF; }
+ else if (strncmp((char *)(ptr+2), "CRLF)", 5) == 0)
+ { skipatstart = 7; newnl = PCRE_NEWLINE_CR + PCRE_NEWLINE_LF; }
+ else if (strncmp((char *)(ptr+2), "ANY)", 4) == 0)
+ { skipatstart = 6; newnl = PCRE_NEWLINE_ANY; }
+ else if (strncmp((char *)(ptr+2), "ANYCRLF)", 8) == 0)
+ { skipatstart = 10; newnl = PCRE_NEWLINE_ANYCRLF; }
+ if (skipatstart > 0)
+ options = (options & ~PCRE_NEWLINE_BITS) | newnl;
+ }
+
/* Handle different types of newline. The three bits give seven cases. The
current code allows for fixed one- or two-byte sequences, plus "any" and
"anycrlf". */
-switch (options & (PCRE_NEWLINE_CRLF | PCRE_NEWLINE_ANY))
+switch (options & PCRE_NEWLINE_BITS)
{
- case 0: newline = NEWLINE; break; /* Compile-time default */
+ case 0: newline = NEWLINE; break; /* Build-time default */
case PCRE_NEWLINE_CR: newline = '\r'; break;
case PCRE_NEWLINE_LF: newline = '\n'; break;
case PCRE_NEWLINE_CR+
@@ -5584,6 +5841,7 @@ been put into the cd block so that they can be changed if an option setting is
found within the regex right at the beginning. Bringing initial option settings
outside can help speed up starting point checks. */
+ptr += skipatstart;
code = cworkspace;
*code = OP_BRA;
(void)compile_regex(cd->external_options, cd->external_options & PCRE_IMS,
@@ -5647,12 +5905,13 @@ cd->start_code = codestart;
cd->hwm = cworkspace;
cd->req_varyopt = 0;
cd->nopartial = FALSE;
+cd->had_accept = FALSE;
/* Set up a starting, non-extracting bracket, then compile the expression. On
error, errorcode will be set non-zero, so we don't need to look at the result
of the function here. */
-ptr = (const uschar *)pattern;
+ptr = (const uschar *)pattern + skipatstart;
code = (uschar *)codestart;
*code = OP_BRA;
(void)compile_regex(re->options, re->options & PCRE_IMS, &code, &ptr,
@@ -5661,6 +5920,7 @@ re->top_bracket = cd->bracount;
re->top_backref = cd->top_backref;
if (cd->nopartial) re->options |= PCRE_NOPARTIAL;
+if (cd->had_accept) reqbyte = -1; /* Must disable after (*ACCEPT) */
/* If not reached end of pattern on success, there's an excess bracket. */
@@ -5759,19 +6019,7 @@ case when building a production library. */
printf("Length = %d top_bracket = %d top_backref = %d\n",
length, re->top_bracket, re->top_backref);
-if (re->options != 0)
- {
- printf("%s%s%s%s%s%s%s%s%s\n",
- ((re->options & PCRE_NOPARTIAL) != 0)? "nopartial " : "",
- ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",
- ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",
- ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",
- ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",
- ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",
- ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "",
- ((re->options & PCRE_EXTRA) != 0)? "extra " : "",
- ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : "");
- }
+printf("Options=%08x\n", re->options);
if ((re->options & PCRE_FIRSTSET) != 0)
{
diff --git a/ext/pcre/pcrelib/pcre_config.c b/ext/pcre/pcrelib/pcre_config.c
index 52d259466..700a5d291 100644
--- a/ext/pcre/pcrelib/pcre_config.c
+++ b/ext/pcre/pcrelib/pcre_config.c
@@ -41,6 +41,8 @@ POSSIBILITY OF SUCH DAMAGE.
/* This module contains the external function pcre_config(). */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c
index a749a216e..1c570a03b 100644
--- a/ext/pcre/pcrelib/pcre_exec.c
+++ b/ext/pcre/pcrelib/pcre_exec.c
@@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
pattern matching using an NFA algorithm, trying to mimic Perl as closely as
possible. There are also some static supporting functions. */
+#include <config.h>
+
#define NLBLOCK md /* Block containing newline information */
#define PSSTART start_subject /* Field containing processed string start */
#define PSEND end_subject /* Field containing processed string end */
@@ -53,16 +55,10 @@ possible. There are also some static supporting functions. */
#undef min
#undef max
-/* The chain of eptrblocks for tail recursions uses memory in stack workspace,
-obtained at top level, the size of which is defined by EPTR_WORK_SIZE. */
-
-#define EPTR_WORK_SIZE (1000)
-
/* Flag bits for the match() function */
#define match_condassert 0x01 /* Called to check a condition assertion */
#define match_cbegroup 0x02 /* Could-be-empty unlimited repeat group */
-#define match_tail_recursed 0x04 /* Tail recursive call */
/* Non-error returns from the match() function. Error returns are externally
defined PCRE_ERROR_xxx codes, which are all negative. */
@@ -70,6 +66,14 @@ defined PCRE_ERROR_xxx codes, which are all negative. */
#define MATCH_MATCH 1
#define MATCH_NOMATCH 0
+/* Special internal returns from the match() function. Make them sufficiently
+negative to avoid the external error codes. */
+
+#define MATCH_COMMIT (-999)
+#define MATCH_PRUNE (-998)
+#define MATCH_SKIP (-997)
+#define MATCH_THEN (-996)
+
/* Maximum number of ints of offset to save on the stack for recursive calls.
If the offset vector is bigger, malloc is used. This should be a multiple of 3,
because the offset vector is always a multiple of 3 long. */
@@ -205,15 +209,15 @@ variable instead of being passed in the frame.
****************************************************************************
***************************************************************************/
-
-/* Numbers for RMATCH calls */
+/* Numbers for RMATCH calls. When this list is changed, the code at HEAP_RETURN
+below must be updated in sync. */
enum { RM1=1, RM2, RM3, RM4, RM5, RM6, RM7, RM8, RM9, RM10,
RM11, RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20,
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
- RM41, RM42, RM43, RM44, RM45, RM46, RM47 };
-
+ RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
+ RM51, RM52, RM53, RM54 };
/* These versions of the macros use the stack, as normal. There are debugging
versions and production versions. Note that the "rw" argument of RMATCH isn't
@@ -384,7 +388,6 @@ Arguments:
match_condassert - this is an assertion condition
match_cbegroup - this is the start of an unlimited repeat
group that can match an empty string
- match_tail_recursed - this is a tail_recursed group
rdepth the recursion depth
Returns: MATCH_MATCH if matched ) these values are >= 0
@@ -586,22 +589,16 @@ original_ims = ims; /* Save for resetting on ')' */
string, the match_cbegroup flag is set. When this is the case, add the current
subject pointer to the chain of such remembered pointers, to be checked when we
hit the closing ket, in order to break infinite loops that match no characters.
-When match() is called in other circumstances, don't add to the chain. If this
-is a tail recursion, use a block from the workspace, as the one on the stack is
-already used. */
+When match() is called in other circumstances, don't add to the chain. The
+match_cbegroup flag must NOT be used with tail recursion, because the memory
+block that is used is on the stack, so a new one may be required for each
+match(). */
if ((flags & match_cbegroup) != 0)
{
- eptrblock *p;
- if ((flags & match_tail_recursed) != 0)
- {
- if (md->eptrn >= EPTR_WORK_SIZE) RRETURN(PCRE_ERROR_NULLWSLIMIT);
- p = md->eptrchain + md->eptrn++;
- }
- else p = &newptrb;
- p->epb_saved_eptr = eptr;
- p->epb_prev = eptrb;
- eptrb = p;
+ newptrb.epb_saved_eptr = eptr;
+ newptrb.epb_prev = eptrb;
+ eptrb = &newptrb;
}
/* Now start processing the opcodes. */
@@ -621,6 +618,34 @@ for (;;)
switch(op)
{
+ case OP_FAIL:
+ RRETURN(MATCH_NOMATCH);
+
+ case OP_PRUNE:
+ RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+ ims, eptrb, flags, RM51);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ RRETURN(MATCH_PRUNE);
+
+ case OP_COMMIT:
+ RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+ ims, eptrb, flags, RM52);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ RRETURN(MATCH_COMMIT);
+
+ case OP_SKIP:
+ RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+ ims, eptrb, flags, RM53);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ md->start_match_ptr = eptr; /* Pass back current position */
+ RRETURN(MATCH_SKIP);
+
+ case OP_THEN:
+ RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
+ ims, eptrb, flags, RM54);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ RRETURN(MATCH_THEN);
+
/* Handle a capturing bracket. If there is space in the offset vector, save
the current subject position in the working slot at the top of the vector.
We mustn't change the current values of the data slot, because they may be
@@ -662,7 +687,7 @@ for (;;)
{
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
ims, eptrb, flags, RM1);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
md->capture_last = save_capture_last;
ecode += GET(ecode, 1);
}
@@ -677,15 +702,22 @@ for (;;)
RRETURN(MATCH_NOMATCH);
}
- /* Insufficient room for saving captured contents. Treat as a non-capturing
- bracket. */
+ /* FALL THROUGH ... Insufficient room for saving captured contents. Treat
+ as a non-capturing bracket. */
+
+ /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+ /* VVVVVVVVVVVVVVVVVVVVVVVVV */
DPRINTF(("insufficient capture room: treat as non-capturing\n"));
+ /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+ /* VVVVVVVVVVVVVVVVVVVVVVVVV */
+
/* Non-capturing bracket. Loop for all the alternatives. When we get to the
final alternative within the brackets, we would return the result of a
recursive call to match() whatever happened. We can reduce stack usage by
- turning this into a tail recursion. */
+ turning this into a tail recursion, except in the case when match_cbegroup
+ is set.*/
case OP_BRA:
case OP_SBRA:
@@ -693,12 +725,20 @@ for (;;)
flags = (op >= OP_SBRA)? match_cbegroup : 0;
for (;;)
{
- if (ecode[GET(ecode, 1)] != OP_ALT)
+ if (ecode[GET(ecode, 1)] != OP_ALT) /* Final alternative */
{
- ecode += _pcre_OP_lengths[*ecode];
- flags |= match_tail_recursed;
- DPRINTF(("bracket 0 tail recursion\n"));
- goto TAIL_RECURSE;
+ if (flags == 0) /* Not a possibly empty group */
+ {
+ ecode += _pcre_OP_lengths[*ecode];
+ DPRINTF(("bracket 0 tail recursion\n"));
+ goto TAIL_RECURSE;
+ }
+
+ /* Possibly empty group; can't use tail recursion. */
+
+ RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
+ eptrb, flags, RM48);
+ RRETURN(rrc);
}
/* For non-final alternatives, continue the loop for a NOMATCH result;
@@ -706,7 +746,7 @@ for (;;)
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
eptrb, flags, RM2);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
ecode += GET(ecode, 1);
}
/* Control never reaches here. */
@@ -754,7 +794,7 @@ for (;;)
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2);
while (*ecode == OP_ALT) ecode += GET(ecode, 1);
}
- else if (rrc != MATCH_NOMATCH)
+ else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
{
RRETURN(rrc); /* Need braces because of following else */
}
@@ -766,25 +806,36 @@ for (;;)
}
/* We are now at the branch that is to be obeyed. As there is only one,
- we can use tail recursion to avoid using another stack frame. If the second
- alternative doesn't exist, we can just plough on. */
+ we can use tail recursion to avoid using another stack frame, except when
+ match_cbegroup is required for an unlimited repeat of a possibly empty
+ group. If the second alternative doesn't exist, we can just plough on. */
if (condition || *ecode == OP_ALT)
{
ecode += 1 + LINK_SIZE;
- flags = match_tail_recursed | ((op == OP_SCOND)? match_cbegroup : 0);
- goto TAIL_RECURSE;
+ if (op == OP_SCOND) /* Possibly empty group */
+ {
+ RMATCH(eptr, ecode, offset_top, md, ims, eptrb, match_cbegroup, RM49);
+ RRETURN(rrc);
+ }
+ else /* Group must match something */
+ {
+ flags = 0;
+ goto TAIL_RECURSE;
+ }
}
- else
+ else /* Condition false & no 2nd alternative */
{
ecode += 1 + LINK_SIZE;
}
break;
- /* End of the pattern. If we are in a top-level recursion, we should
- restore the offsets appropriately and continue from after the call. */
+ /* End of the pattern, either real or forced. If we are in a top-level
+ recursion, we should restore the offsets appropriately and continue from
+ after the call. */
+ case OP_ACCEPT:
case OP_END:
if (md->recursive != NULL && md->recursive->group_num == 0)
{
@@ -805,7 +856,7 @@ for (;;)
if (md->notempty && eptr == mstart) RRETURN(MATCH_NOMATCH);
md->end_match_ptr = eptr; /* Record where we ended */
md->end_offset_top = offset_top; /* and how many extracts were taken */
- md->start_match_ptr = mstart; /* and the start (\K can modify) */
+ md->start_match_ptr = mstart; /* and the start (\K can modify) */
RRETURN(MATCH_MATCH);
/* Change option settings */
@@ -829,7 +880,7 @@ for (;;)
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
RM4);
if (rrc == MATCH_MATCH) break;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
ecode += GET(ecode, 1);
}
while (*ecode == OP_ALT);
@@ -856,7 +907,7 @@ for (;;)
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
RM5);
if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
ecode += GET(ecode,1);
}
while (*ecode == OP_ALT);
@@ -880,7 +931,7 @@ for (;;)
{
eptr--;
if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
- BACKCHAR(eptr)
+ BACKCHAR(eptr);
}
}
else
@@ -993,7 +1044,7 @@ for (;;)
(pcre_free)(new_recursive.offset_save);
RRETURN(MATCH_MATCH);
}
- else if (rrc != MATCH_NOMATCH)
+ else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
{
DPRINTF(("Recursion gave error %d\n", rrc));
RRETURN(rrc);
@@ -1027,10 +1078,9 @@ for (;;)
do
{
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,
- eptrb, 0, RM7);
+ RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM7);
if (rrc == MATCH_MATCH) break;
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
ecode += GET(ecode,1);
}
while (*ecode == OP_ALT);
@@ -1073,11 +1123,10 @@ for (;;)
if (*ecode == OP_KETRMIN)
{
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0,
- RM8);
+ RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM8);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode = prev;
- flags = match_tail_recursed;
+ flags = 0;
goto TAIL_RECURSE;
}
else /* OP_KETRMAX */
@@ -1085,7 +1134,7 @@ for (;;)
RMATCH(eptr, prev, offset_top, md, ims, eptrb, match_cbegroup, RM9);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += 1 + LINK_SIZE;
- flags = match_tail_recursed;
+ flags = 0;
goto TAIL_RECURSE;
}
/* Control never gets here */
@@ -1216,17 +1265,21 @@ for (;;)
/* The repeating kets try the rest of the pattern or restart from the
preceding bracket, in the appropriate order. In the second case, we can use
- tail recursion to avoid using another stack frame. */
+ tail recursion to avoid using another stack frame, unless we have an
+ unlimited repeat of a group that can match an empty string. */
flags = (*prev >= OP_SBRA)? match_cbegroup : 0;
if (*ecode == OP_KETRMIN)
{
- RMATCH(eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0,
- RM12);
+ RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0, RM12);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ if (flags != 0) /* Could match an empty string */
+ {
+ RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM50);
+ RRETURN(rrc);
+ }
ecode = prev;
- flags |= match_tail_recursed;
goto TAIL_RECURSE;
}
else /* OP_KETRMAX */
@@ -1234,7 +1287,7 @@ for (;;)
RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM13);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
ecode += 1 + LINK_SIZE;
- flags = match_tail_recursed;
+ flags = 0;
goto TAIL_RECURSE;
}
/* Control never gets here */
@@ -2033,7 +2086,7 @@ for (;;)
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
if (eptr-- == pp) break; /* Stop if tried at original pos */
- BACKCHAR(eptr)
+ if (utf8) BACKCHAR(eptr);
}
RRETURN(MATCH_NOMATCH);
}
@@ -3038,9 +3091,9 @@ for (;;)
for (i = 1; i <= min; i++)
{
if (eptr >= md->end_subject ||
- (*eptr < 128 && (md->ctypes[*eptr++] & ctype_space) != 0))
+ (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0))
RRETURN(MATCH_NOMATCH);
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+ while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
}
break;
@@ -3058,9 +3111,9 @@ for (;;)
for (i = 1; i <= min; i++)
{
if (eptr >= md->end_subject ||
- (*eptr < 128 && (md->ctypes[*eptr++] & ctype_word) != 0))
+ (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0))
RRETURN(MATCH_NOMATCH);
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+ while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
}
break;
@@ -3702,7 +3755,7 @@ for (;;)
RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM44);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
if (eptr-- == pp) break; /* Stop if tried at original pos */
- BACKCHAR(eptr);
+ if (utf8) BACKCHAR(eptr);
}
}
@@ -3741,9 +3794,9 @@ for (;;)
for (;;) /* Move back over one extended */
{
int len = 1;
- BACKCHAR(eptr);
if (!utf8) c = *eptr; else
{
+ BACKCHAR(eptr);
GETCHARLEN(c, eptr, len);
}
prop_category = _pcre_ucp_findprop(c, &prop_chartype, &prop_script);
@@ -3764,11 +3817,6 @@ for (;;)
switch(ctype)
{
case OP_ANY:
-
- /* Special code is required for UTF8, but when the maximum is
- unlimited we don't need it, so we repeat the non-UTF8 code. This is
- probably worth it, because .* is quite a common idiom. */
-
if (max < INT_MAX)
{
if ((ims & PCRE_DOTALL) == 0)
@@ -3801,15 +3849,12 @@ for (;;)
{
if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
eptr++;
+ while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
}
- break;
}
else
{
- c = max - min;
- if (c > (unsigned int)(md->end_subject - eptr))
- c = md->end_subject - eptr;
- eptr += c;
+ eptr = md->end_subject;
}
}
break;
@@ -3990,7 +4035,7 @@ for (;;)
}
}
else
-#endif
+#endif /* SUPPORT_UTF8 */
/* Not UTF-8 mode */
{
@@ -4181,7 +4226,8 @@ switch (frame->Xwhere)
LBL(17) LBL(18) LBL(19) LBL(20) LBL(21) LBL(22) LBL(23) LBL(24)
LBL(25) LBL(26) LBL(27) LBL(28) LBL(29) LBL(30) LBL(31) LBL(32)
LBL(33) LBL(34) LBL(35) LBL(36) LBL(37) LBL(38) LBL(39) LBL(40)
- LBL(41) LBL(42) LBL(43) LBL(44) LBL(45) LBL(46) LBL(47)
+ LBL(41) LBL(42) LBL(43) LBL(44) LBL(45) LBL(46) LBL(47) LBL(48)
+ LBL(49) LBL(50) LBL(51) LBL(52) LBL(53) LBL(54)
default:
DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));
return PCRE_ERROR_INTERNAL;
@@ -4298,7 +4344,6 @@ const uschar *start_bits = NULL;
USPTR start_match = (USPTR)subject + start_offset;
USPTR end_subject;
USPTR req_byte_ptr = start_match - 1;
-eptrblock eptrchain[EPTR_WORK_SIZE];
pcre_study_data internal_study;
const pcre_study_data *study;
@@ -4384,7 +4429,6 @@ md->partial = (options & PCRE_PARTIAL) != 0;
md->hitend = FALSE;
md->recursive = NULL; /* No recursion at top level */
-md->eptrchain = eptrchain; /* Make workspace generally available */
md->lcc = tables + lcc_offset;
md->ctypes = tables + ctypes_offset;
@@ -4540,6 +4584,7 @@ the loop runs just once. */
for(;;)
{
USPTR save_end_subject = end_subject;
+ USPTR new_start_match;
/* Reset the maximum number of extractions we might see. */
@@ -4680,15 +4725,48 @@ for(;;)
/* OK, we can now run the match. */
- md->start_match_ptr = start_match; /* Insurance */
+ md->start_match_ptr = start_match;
md->match_call_count = 0;
- md->eptrn = 0; /* Next free eptrchain slot */
- rc = match(start_match, md->start_code, start_match, 2, md,
- ims, NULL, 0, 0);
+ rc = match(start_match, md->start_code, start_match, 2, md, ims, NULL, 0, 0);
- /* Any return other than MATCH_NOMATCH breaks the loop. */
+ switch(rc)
+ {
+ /* NOMATCH and PRUNE advance by one character. THEN at this level acts
+ exactly like PRUNE. */
- if (rc != MATCH_NOMATCH) break;
+ case MATCH_NOMATCH:
+ case MATCH_PRUNE:
+ case MATCH_THEN:
+ new_start_match = start_match + 1;
+#ifdef SUPPORT_UTF8
+ if (utf8)
+ while(new_start_match < end_subject && (*new_start_match & 0xc0) == 0x80)
+ new_start_match++;
+#endif
+ break;
+
+ /* SKIP passes back the next starting point explicitly. */
+
+ case MATCH_SKIP:
+ new_start_match = md->start_match_ptr;
+ break;
+
+ /* COMMIT disables the bumpalong, but otherwise behaves as NOMATCH. */
+
+ case MATCH_COMMIT:
+ rc = MATCH_NOMATCH;
+ goto ENDLOOP;
+
+ /* Any other return is some kind of error. */
+
+ default:
+ goto ENDLOOP;
+ }
+
+ /* Control reaches here for the various types of "no match at this point"
+ result. Reset the code to MATCH_NOMATCH for subsequent checking. */
+
+ rc = MATCH_NOMATCH;
/* If PCRE_FIRSTLINE is set, the match must happen before or at the first
newline in the subject (though it may continue over the newline). Therefore,
@@ -4696,30 +4774,26 @@ for(;;)
if (firstline && IS_NEWLINE(start_match)) break;
- /* Advance the match position by one character. */
+ /* Advance to new matching position */
- start_match++;
-#ifdef SUPPORT_UTF8
- if (utf8)
- while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
- start_match++;
-#endif
+ start_match = new_start_match;
/* Break the loop if the pattern is anchored or if we have passed the end of
the subject. */
if (anchored || start_match > end_subject) break;
- /* If we have just passed a CR and the newline option is CRLF or ANY or
- ANYCRLF, and we are now at a LF, advance the match position by one more
- character. */
+ /* If we have just passed a CR and we are now at a LF, and the pattern does
+ not contain any explicit matches for \r or \n, and the newline option is CRLF
+ or ANY or ANYCRLF, advance the match position by one more character. */
if (start_match[-1] == '\r' &&
- (md->nltype == NLTYPE_ANY ||
- md->nltype == NLTYPE_ANYCRLF ||
- md->nllen == 2) &&
- start_match < end_subject &&
- *start_match == '\n')
+ start_match < end_subject &&
+ *start_match == '\n' &&
+ (re->options & PCRE_HASCRORLF) == 0 &&
+ (md->nltype == NLTYPE_ANY ||
+ md->nltype == NLTYPE_ANYCRLF ||
+ md->nllen == 2))
start_match++;
} /* End of for(;;) "bumpalong" loop */
@@ -4729,7 +4803,7 @@ for(;;)
/* We reach here when rc is not MATCH_NOMATCH, or if one of the stopping
conditions is true:
-(1) The pattern is anchored;
+(1) The pattern is anchored or the match was failed by (*COMMIT);
(2) We are past the end of the subject;
@@ -4744,6 +4818,8 @@ processing, copy those that we can. In this case there need not be overflow if
certain parts of the pattern were not used, even though there are more
capturing parentheses than vector slots. */
+ENDLOOP:
+
if (rc == MATCH_MATCH)
{
if (using_temporary_offsets)
diff --git a/ext/pcre/pcrelib/pcre_fullinfo.c b/ext/pcre/pcrelib/pcre_fullinfo.c
index 797eddecf..1554292e6 100644
--- a/ext/pcre/pcrelib/pcre_fullinfo.c
+++ b/ext/pcre/pcrelib/pcre_fullinfo.c
@@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
information about a compiled pattern. */
+#include <config.h>
+
#include "pcre_internal.h"
@@ -148,6 +150,10 @@ switch (what)
*((int *)where) = (re->options & PCRE_JCHANGED) != 0;
break;
+ case PCRE_INFO_HASCRORLF:
+ *((int *)where) = (re->options & PCRE_HASCRORLF) != 0;
+ break;
+
default: return PCRE_ERROR_BADOPTION;
}
diff --git a/ext/pcre/pcrelib/pcre_get.c b/ext/pcre/pcrelib/pcre_get.c
index ba0c8cb21..898f051e8 100644
--- a/ext/pcre/pcrelib/pcre_get.c
+++ b/ext/pcre/pcrelib/pcre_get.c
@@ -43,6 +43,8 @@ from the subject string after a regex match has succeeded. The original idea
for these functions came from Scott Wimer. */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_globals.c b/ext/pcre/pcrelib/pcre_globals.c
index dbde57e02..a56f13aa2 100644
--- a/ext/pcre/pcrelib/pcre_globals.c
+++ b/ext/pcre/pcrelib/pcre_globals.c
@@ -46,6 +46,8 @@ indirection. These values can be changed by the caller, but are shared between
all threads. However, when compiling for Virtual Pascal, things are done
differently, and global variables are not used (see pcre.in). */
+#include <config.h>
+
#include "pcre_internal.h"
#ifndef VPCOMPAT
diff --git a/ext/pcre/pcrelib/pcre_info.c b/ext/pcre/pcrelib/pcre_info.c
index 52ac23f70..6970e7953 100644
--- a/ext/pcre/pcrelib/pcre_info.c
+++ b/ext/pcre/pcrelib/pcre_info.c
@@ -43,6 +43,8 @@ information about a compiled pattern. However, use of this function is now
deprecated, as it has been superseded by pcre_fullinfo(). */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_internal.h b/ext/pcre/pcrelib/pcre_internal.h
index d87b95cb2..a2409f942 100644
--- a/ext/pcre/pcrelib/pcre_internal.h
+++ b/ext/pcre/pcrelib/pcre_internal.h
@@ -67,10 +67,6 @@ be absolutely sure we get our version. */
#endif
-/* Get the definitions provided by running "configure" */
-
-#include "config.h"
-
/* Standard C headers plus the external interface definition. The only time
setjmp and stdarg are used is when NO_RECURSE is set. */
@@ -112,7 +108,7 @@ PCRE_EXP_DATA_DEFN only if they are not already set. */
#ifndef PCRE_EXP_DECL
# ifdef _WIN32
-# ifdef DLL_EXPORT
+# ifndef PCRE_STATIC
# define PCRE_EXP_DECL extern __declspec(dllexport)
# define PCRE_EXP_DEFN __declspec(dllexport)
# define PCRE_EXP_DATA_DEFN __declspec(dllexport)
@@ -121,7 +117,6 @@ PCRE_EXP_DATA_DEFN only if they are not already set. */
# define PCRE_EXP_DEFN
# define PCRE_EXP_DATA_DEFN
# endif
-#
# else
# ifdef __cplusplus
# define PCRE_EXP_DECL extern "C"
@@ -234,7 +229,7 @@ must begin with PCRE_. */
/* Include the public PCRE header and the definitions of UCP character property
values. */
-#include <pcre.h>
+#include "pcre.h"
#include "ucp.h"
/* When compiling for use with the Virtual Pascal compiler, these functions
@@ -363,7 +358,9 @@ capturing parenthesis numbers in back references. */
/* When UTF-8 encoding is being used, a character is no longer just a single
byte. The macros for character handling generate simple sequences when used in
-byte-mode, and more complicated ones for UTF-8 characters. */
+byte-mode, and more complicated ones for UTF-8 characters. BACKCHAR should
+never be called in byte mode. To make sure it can never even appear when UTF-8
+support is omitted, we don't even define it. */
#ifndef SUPPORT_UTF8
#define GETCHAR(c, eptr) c = *eptr;
@@ -371,7 +368,7 @@ byte-mode, and more complicated ones for UTF-8 characters. */
#define GETCHARINC(c, eptr) c = *eptr++;
#define GETCHARINCTEST(c, eptr) c = *eptr++;
#define GETCHARLEN(c, eptr, len) c = *eptr;
-#define BACKCHAR(eptr)
+/* #define BACKCHAR(eptr) */
#else /* SUPPORT_UTF8 */
@@ -464,9 +461,10 @@ if there are extra bytes. This is called when we know we are in UTF-8 mode. */
}
/* If the pointer is not at the start of a character, move it back until
-it is. Called only in UTF-8 mode. */
+it is. This is called only in UTF-8 mode - we don't put a test within the macro
+because almost all calls are already within a block of UTF-8 only code. */
-#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
+#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--
#endif
@@ -494,6 +492,7 @@ bits. */
#define PCRE_REQCHSET 0x20000000 /* req_byte is set */
#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */
#define PCRE_JCHANGED 0x08000000 /* j option changes within regex */
+#define PCRE_HASCRORLF 0x04000000 /* explicit \r or \n in pattern */
/* Options for the "extra" block produced by pcre_study(). */
@@ -610,14 +609,9 @@ enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_k, ESC_REF };
-/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
-that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
+/* Opcode table: Starting from 1 (i.e. after OP_END), the values up to
OP_EOD must correspond in order to the list of escapes immediately above.
-To keep stored, compiled patterns compatible, new opcodes should be added
-immediately before OP_BRA, where (since release 7.0) a gap is left for this
-purpose.
-
*** NOTE NOTE NOTE *** Whenever this list is updated, the two macro definitions
that follow must also be updated to match. There is also a table called
"coptable" in pcre_dfa_exec.c that must be updated. */
@@ -744,7 +738,7 @@ enum {
as there's a test for >= ONCE for a subpattern that isn't an assertion. */
OP_ONCE, /* 92 Atomic group */
- OP_BRA, /* 83 Start of non-capturing bracket */
+ OP_BRA, /* 93 Start of non-capturing bracket */
OP_CBRA, /* 94 Start of capturing bracket */
OP_COND, /* 95 Conditional group */
@@ -760,7 +754,19 @@ enum {
OP_DEF, /* 101 The DEFINE condition */
OP_BRAZERO, /* 102 These two must remain together and in this */
- OP_BRAMINZERO /* 103 order. */
+ OP_BRAMINZERO, /* 103 order. */
+
+ /* These are backtracking control verbs */
+
+ OP_PRUNE, /* 104 */
+ OP_SKIP, /* 105 */
+ OP_THEN, /* 106 */
+ OP_COMMIT, /* 107 */
+
+ /* These are forced failure and success verbs */
+
+ OP_FAIL, /* 108 */
+ OP_ACCEPT /* 109 */
};
@@ -783,8 +789,9 @@ for debugging. The macro is referenced only in pcre_printint.c. */
"class", "nclass", "xclass", "Ref", "Recurse", "Callout", \
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \
"AssertB", "AssertB not", "Reverse", \
- "Once", "Bra 0", "Bra", "Cond", "SBra 0", "SBra", "SCond", \
- "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero"
+ "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond", \
+ "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero", \
+ "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT"
/* This macro defines the length of fixed length operations in the compiled
@@ -848,6 +855,8 @@ in UTF-8 mode. The code that uses this table must know about such things. */
3, /* RREF */ \
1, /* DEF */ \
1, 1, /* BRAZERO, BRAMINZERO */ \
+ 1, 1, 1, 1, /* PRUNE, SKIP, THEN, COMMIT, */ \
+ 1, 1 /* FAIL, ACCEPT */
/* A magic value for OP_RREF to indicate the "any recursion" condition. */
@@ -862,7 +871,8 @@ enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,
ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
- ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58 };
+ ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
+ ERR60, ERR61 };
/* The real format of the start of the pcre block; the index of names and the
code vector run on as long as necessary after the end. We store an explicit
@@ -931,6 +941,7 @@ typedef struct compile_data {
int external_options; /* External (initial) options */
int req_varyopt; /* "After variable item" flag for reqbyte */
BOOL nopartial; /* Set TRUE if partial won't work */
+ BOOL had_accept; /* (*ACCEPT) encountered */
int nltype; /* Newline type */
int nllen; /* Newline string length */
uschar nl[4]; /* Newline string when fixed length */
diff --git a/ext/pcre/pcrelib/pcre_maketables.c b/ext/pcre/pcrelib/pcre_maketables.c
index 9963e13fb..cba42260c 100644
--- a/ext/pcre/pcrelib/pcre_maketables.c
+++ b/ext/pcre/pcrelib/pcre_maketables.c
@@ -45,7 +45,8 @@ compilation of dftables.c, in which case the macro DFTABLES is defined. */
#ifndef DFTABLES
-#include "pcre_internal.h"
+# include <config.h>
+# include "pcre_internal.h"
#endif
diff --git a/ext/pcre/pcrelib/pcre_newline.c b/ext/pcre/pcrelib/pcre_newline.c
index ae66c730f..9725c723d 100644
--- a/ext/pcre/pcrelib/pcre_newline.c
+++ b/ext/pcre/pcrelib/pcre_newline.c
@@ -47,6 +47,8 @@ and NLTYPE_ANY. The full list of Unicode newline characters is taken from
http://unicode.org/unicode/reports/tr18/. */
+#include <config.h>
+
#include "pcre_internal.h"
@@ -124,12 +126,16 @@ _pcre_was_newline(const uschar *ptr, int type, const uschar *startptr,
{
int c;
ptr--;
+#ifdef SUPPORT_UTF8
if (utf8)
{
BACKCHAR(ptr);
GETCHAR(c, ptr);
}
else c = *ptr;
+#else /* no UTF-8 support */
+c = *ptr;
+#endif /* SUPPORT_UTF8 */
if (type == NLTYPE_ANYCRLF) switch(c)
{
diff --git a/ext/pcre/pcrelib/pcre_ord2utf8.c b/ext/pcre/pcrelib/pcre_ord2utf8.c
index a72761285..ebb8a9d48 100644
--- a/ext/pcre/pcrelib/pcre_ord2utf8.c
+++ b/ext/pcre/pcrelib/pcre_ord2utf8.c
@@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
/* This file contains a private PCRE function that converts an ordinal
character value into a UTF8 string. */
+#include <config.h>
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_printint.src b/ext/pcre/pcrelib/pcre_printint.src
index 79299f7e6..90381ed96 100644
--- a/ext/pcre/pcrelib/pcre_printint.src
+++ b/ext/pcre/pcrelib/pcre_printint.src
@@ -122,7 +122,7 @@ get_ucpname(int ptype, int pvalue)
{
#ifdef SUPPORT_UCP
int i;
-for (i = _pcre_utt_size; i >= 0; i--)
+for (i = _pcre_utt_size - 1; i >= 0; i--)
{
if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break;
}
diff --git a/ext/pcre/pcrelib/pcre_refcount.c b/ext/pcre/pcrelib/pcre_refcount.c
index 8339019db..7d3b7981c 100644
--- a/ext/pcre/pcrelib/pcre_refcount.c
+++ b/ext/pcre/pcrelib/pcre_refcount.c
@@ -43,6 +43,9 @@ auxiliary function that can be used to maintain a reference count in a compiled
pattern data block. This might be helpful in applications where the block is
shared by different users. */
+
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_study.c b/ext/pcre/pcrelib/pcre_study.c
index 3cf5b5954..8c82d1ce6 100644
--- a/ext/pcre/pcrelib/pcre_study.c
+++ b/ext/pcre/pcrelib/pcre_study.c
@@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
supporting functions. */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_tables.c b/ext/pcre/pcrelib/pcre_tables.c
index 3e36c931a..95d166975 100644
--- a/ext/pcre/pcrelib/pcre_tables.c
+++ b/ext/pcre/pcrelib/pcre_tables.c
@@ -44,6 +44,8 @@ uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
clashes with the library. */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_try_flipped.c b/ext/pcre/pcrelib/pcre_try_flipped.c
index cd45968a4..cd7d21ecc 100644
--- a/ext/pcre/pcrelib/pcre_try_flipped.c
+++ b/ext/pcre/pcrelib/pcre_try_flipped.c
@@ -43,6 +43,8 @@ see if it was compiled with the opposite endianness. If so, it uses an
auxiliary local function to flip the appropriate bytes. */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c b/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c
index 5ecba6b1f..95d42cf7c 100644
--- a/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c
+++ b/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c
@@ -41,6 +41,8 @@ POSSIBILITY OF SUCH DAMAGE.
/* This module contains code for searching the table of Unicode character
properties. */
+#include <config.h>
+
#include "pcre_internal.h"
#include "ucp.h" /* Category definitions */
diff --git a/ext/pcre/pcrelib/pcre_valid_utf8.c b/ext/pcre/pcrelib/pcre_valid_utf8.c
index 9a35a202e..223e74085 100644
--- a/ext/pcre/pcrelib/pcre_valid_utf8.c
+++ b/ext/pcre/pcrelib/pcre_valid_utf8.c
@@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
strings. */
+#include <config.h>
+
#include "pcre_internal.h"
@@ -55,6 +57,13 @@ that subsequent code can assume it is dealing with a valid string. The check
can be turned off for maximum performance, but the consequences of supplying
an invalid string are then undefined.
+Originally, this function checked according to RFC 2279, allowing for values in
+the range 0 to 0x7fffffff, up to 6 bytes long, but ensuring that they were in
+the canonical format. Once somebody had pointed out RFC 3629 to me (it
+obsoletes 2279), additional restrictions were applies. The values are now
+limited to be between 0 and 0x0010ffff, no more than 4 bytes long, and the
+subrange 0xd000 to 0xdfff is excluded.
+
Arguments:
string points to the string
length length of string, or -1 if the string is zero-terminated
@@ -81,31 +90,48 @@ for (p = string; length-- > 0; p++)
register int c = *p;
if (c < 128) continue;
if (c < 0xc0) return p - string;
- ab = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */
- if (length < ab) return p - string;
+ ab = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */
+ if (length < ab || ab > 3) return p - string;
length -= ab;
/* Check top bits in the second byte */
if ((*(++p) & 0xc0) != 0x80) return p - string;
- /* Check for overlong sequences for each different length */
+ /* Check for overlong sequences for each different length, and for the
+ excluded range 0xd000 to 0xdfff. */
+
switch (ab)
{
- /* Check for xx00 000x */
+ /* Check for xx00 000x (overlong sequence) */
+
case 1:
if ((c & 0x3e) == 0) return p - string;
continue; /* We know there aren't any more bytes to check */
- /* Check for 1110 0000, xx0x xxxx */
+ /* Check for 1110 0000, xx0x xxxx (overlong sequence) or
+ 1110 1101, 1010 xxxx (0xd000 - 0xdfff) */
+
case 2:
- if (c == 0xe0 && (*p & 0x20) == 0) return p - string;
+ if ((c == 0xe0 && (*p & 0x20) == 0) ||
+ (c == 0xed && *p >= 0xa0))
+ return p - string;
break;
- /* Check for 1111 0000, xx00 xxxx */
+ /* Check for 1111 0000, xx00 xxxx (overlong sequence) or
+ greater than 0x0010ffff (f4 8f bf bf) */
+
case 3:
- if (c == 0xf0 && (*p & 0x30) == 0) return p - string;
+ if ((c == 0xf0 && (*p & 0x30) == 0) ||
+ (c > 0xf4 ) ||
+ (c == 0xf4 && *p > 0x8f))
+ return p - string;
break;
+#if 0
+ /* These cases can no longer occur, as we restrict to a maximum of four
+ bytes nowadays. Leave the code here in case we ever want to add an option
+ for longer sequences. */
+
/* Check for 1111 1000, xx00 0xxx */
case 4:
if (c == 0xf8 && (*p & 0x38) == 0) return p - string;
@@ -116,6 +142,8 @@ for (p = string; length-- > 0; p++)
if (c == 0xfe || c == 0xff ||
(c == 0xfc && (*p & 0x3c) == 0)) return p - string;
break;
+#endif
+
}
/* Check for valid bytes after the 2nd, if any; all must start 10 */
diff --git a/ext/pcre/pcrelib/pcre_version.c b/ext/pcre/pcrelib/pcre_version.c
index 1a9ecb2c5..865453d9b 100644
--- a/ext/pcre/pcrelib/pcre_version.c
+++ b/ext/pcre/pcrelib/pcre_version.c
@@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
string that identifies the PCRE version that is in use. */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcre_xclass.c b/ext/pcre/pcrelib/pcre_xclass.c
index 0b333515f..db5331b63 100644
--- a/ext/pcre/pcrelib/pcre_xclass.c
+++ b/ext/pcre/pcrelib/pcre_xclass.c
@@ -43,6 +43,8 @@ class (one that contains characters whose values are > 255). It is used by both
pcre_exec() and pcre_def_exec(). */
+#include <config.h>
+
#include "pcre_internal.h"
diff --git a/ext/pcre/pcrelib/pcredemo.c b/ext/pcre/pcrelib/pcredemo.c
index 80aba0e19..4068e3e04 100644
--- a/ext/pcre/pcrelib/pcredemo.c
+++ b/ext/pcre/pcrelib/pcredemo.c
@@ -11,15 +11,12 @@ Compile thuswise:
-R/usr/local/lib -lpcre
Replace "/usr/local/include" and "/usr/local/lib" with wherever the include and
-library files for PCRE are installed on your system. Only some operating
+library files for PCRE are installed on your system. You don't need -I and -L
+if PCRE is installed in the standard system libraries. Only some operating
systems (e.g. Solaris) use the -R option.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <stdio.h>
#include <string.h>
#include <pcre.h>
diff --git a/ext/pcre/pcrelib/pcregrep.c b/ext/pcre/pcrelib/pcregrep.c
index f14c973cb..29338d159 100644
--- a/ext/pcre/pcrelib/pcregrep.c
+++ b/ext/pcre/pcrelib/pcregrep.c
@@ -37,9 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <ctype.h>
#include <locale.h>
@@ -50,8 +48,9 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sys/types.h>
#include <sys/stat.h>
+
#ifdef HAVE_UNISTD_H
-# include <unistd.h>
+#include <unistd.h>
#endif
#include <pcre.h>
@@ -855,7 +854,7 @@ while (ptr < endptr)
t = end_of_line(t, endptr, &endlinelength);
linelength = t - ptr - endlinelength;
- length = multiline? endptr - ptr : linelength;
+ length = multiline? (size_t)(endptr - ptr) : linelength;
/* Extra processing for Jeffrey Friedl's debugging. */
@@ -1063,18 +1062,23 @@ while (ptr < endptr)
/* In multiline mode, we want to print to the end of the line in which
the end of the matched string is found, so we adjust linelength and the
- line number appropriately. Because the PCRE_FIRSTLINE option is set, the
- start of the match will always be before the first newline sequence. */
+ line number appropriately, but only when there actually was a match
+ (invert not set). Because the PCRE_FIRSTLINE option is set, the start of
+ the match will always be before the first newline sequence. */
if (multiline)
{
int ellength;
- char *endmatch = ptr + offsets[1];
- t = ptr;
- while (t < endmatch)
+ char *endmatch = ptr;
+ if (!invert)
{
- t = end_of_line(t, endptr, &ellength);
- if (t <= endmatch) linenumber++; else break;
+ endmatch += offsets[1];
+ t = ptr;
+ while (t < endmatch)
+ {
+ t = end_of_line(t, endptr, &ellength);
+ if (t <= endmatch) linenumber++; else break;
+ }
}
endmatch = end_of_line(endmatch, endptr, &ellength);
linelength = endmatch - ptr - ellength;
@@ -1123,6 +1127,24 @@ while (ptr < endptr)
lastmatchnumber = linenumber + 1;
}
+ /* For a match in multiline inverted mode (which of course did not cause
+ anything to be printed), we have to move on to the end of the match before
+ proceeding. */
+
+ if (multiline && invert && match)
+ {
+ int ellength;
+ char *endmatch = ptr + offsets[1];
+ t = ptr;
+ while (t < endmatch)
+ {
+ t = end_of_line(t, endptr, &ellength);
+ if (t <= endmatch) linenumber++; else break;
+ }
+ endmatch = end_of_line(endmatch, endptr, &ellength);
+ linelength = endmatch - ptr - ellength;
+ }
+
/* Advance to after the newline and increment the line number. */
ptr += linelength + endlinelength;
@@ -1625,7 +1647,7 @@ for (i = 1; i < argc; i++)
else /* Special case xxx=data */
{
int oplen = equals - op->long_name;
- int arglen = (argequals == NULL)? strlen(arg) : argequals - arg;
+ int arglen = (argequals == NULL)? (int)strlen(arg) : argequals - arg;
if (oplen == arglen && strncmp(arg, op->long_name, oplen) == 0)
{
option_data = arg + arglen;
diff --git a/ext/pcre/pcrelib/pcreposix.c b/ext/pcre/pcrelib/pcreposix.c
index 8582fba09..9c0adebb9 100644
--- a/ext/pcre/pcrelib/pcreposix.c
+++ b/ext/pcre/pcrelib/pcreposix.c
@@ -42,9 +42,22 @@ POSSIBILITY OF SUCH DAMAGE.
functions. */
+#include <config.h>
+
+
+/* Ensure that the PCREPOSIX_EXP_xxx macros are set appropriately for
+compiling these functions. This must come before including pcreposix.h, where
+they are set for an application (using these functions) if they have not
+previously been set. */
+
+#if defined(_WIN32) && !defined(PCRE_STATIC)
+# define PCREPOSIX_EXP_DECL extern __declspec(dllexport)
+# define PCREPOSIX_EXP_DEFN __declspec(dllexport)
+#endif
+
+#include <pcre.h>
#include "pcre_internal.h"
#include "pcreposix.h"
-#include "stdlib.h"
@@ -109,7 +122,8 @@ static const int eint[] = {
REG_BADPAT, /* repeating a DEFINE group is not allowed */
REG_INVARG, /* inconsistent NEWLINE options */
REG_BADPAT, /* \g is not followed followed by an (optionally braced) non-zero number */
- REG_BADPAT /* (?+ or (?- must be followed by a non-zero number */
+ REG_BADPAT, /* (?+ or (?- must be followed by a non-zero number */
+ REG_BADPAT /* number is too big */
};
/* Table of texts corresponding to POSIX error codes */
diff --git a/ext/pcre/pcrelib/pcreposix.h b/ext/pcre/pcrelib/pcreposix.h
index cca559b3b..875e1ff18 100644
--- a/ext/pcre/pcrelib/pcreposix.h
+++ b/ext/pcre/pcrelib/pcreposix.h
@@ -107,13 +107,12 @@ typedef struct {
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE, the appropriate
-export settings are needed. */
+export settings are needed, and are set in pcreposix.c before including this
+file. */
-#ifdef _WIN32
-# ifndef PCREPOSIX_STATIC
-# define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
-# define PCREPOSIX_EXP_DEFN __declspec(dllimport)
-# endif
+#if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL)
+# define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
+# define PCREPOSIX_EXP_DEFN __declspec(dllimport)
#endif
/* By default, we use the standard "extern" declarations. */
diff --git a/ext/pcre/pcrelib/testdata/grepoutput b/ext/pcre/pcrelib/testdata/grepoutput
index 2e8cdc7d6..d5506a109 100644
--- a/ext/pcre/pcrelib/testdata/grepoutput
+++ b/ext/pcre/pcrelib/testdata/grepoutput
@@ -383,3 +383,5 @@ AB.VE
AB.VE the turtle
PUT NEW DATA ABOVE THIS LINE.
---------------------------- Test 49 ------------------------------
+---------------------------- Test 50 ------------------------------
+over the lazy dog.
diff --git a/ext/pcre/pcrelib/testdata/testinput1 b/ext/pcre/pcrelib/testdata/testinput1
index 7e8e9f0c4..79c98fa7b 100644
--- a/ext/pcre/pcrelib/testdata/testinput1
+++ b/ext/pcre/pcrelib/testdata/testinput1
@@ -4021,4 +4021,13 @@
/(.*(.)?)*/
abcd
+/( (A | (?(1)0|) )* )/x
+ abcd
+
+/( ( (?(1)0|) )* )/x
+ abcd
+
+/( (?(1)0|)* )/x
+ abcd
+
/ End of testinput1 /
diff --git a/ext/pcre/pcrelib/testdata/testinput10 b/ext/pcre/pcrelib/testdata/testinput10
index 369af4a3d..726a3890a 100644
--- a/ext/pcre/pcrelib/testdata/testinput10
+++ b/ext/pcre/pcrelib/testdata/testinput10
@@ -101,4 +101,24 @@ are all themselves checked in other tests. --/
/[\x{105}-\x{109}]/8iBM
+/( ( (?(1)0|) )* )/xBM
+
+/( (?(1)0|)* )/xBM
+
+/[a]/BM
+
+/[a]/8BM
+
+/[\xaa]/BM
+
+/[\xaa]/8BM
+
+/[^a]/BM
+
+/[^a]/8BM
+
+/[^\xaa]/BM
+
+/[^\xaa]/8BM
+
/ End of testinput10 /
diff --git a/ext/pcre/pcrelib/testdata/testinput2 b/ext/pcre/pcrelib/testdata/testinput2
index 2ce7ad032..c9f1018a9 100644
--- a/ext/pcre/pcrelib/testdata/testinput2
+++ b/ext/pcre/pcrelib/testdata/testinput2
@@ -2326,4 +2326,142 @@ a random value. /Ix
/\V+\v\V+\w/BZ
+/\( (?: [^()]* | (?R) )* \)/x
+(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)
+
+/[\E]AAA/
+
+/[\Q\E]AAA/
+
+/[^\E]AAA/
+
+/[^\Q\E]AAA/
+
+/[\E^]AAA/
+
+/[\Q\E^]AAA/
+
+/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/BZ
+
+/^a+(*FAIL)/
+ aaaaaa
+
+/a+b?c+(*FAIL)/
+ aaabccc
+
+/a+b?(*PRUNE)c+(*FAIL)/
+ aaabccc
+
+/a+b?(*COMMIT)c+(*FAIL)/
+ aaabccc
+
+/a+b?(*SKIP)c+(*FAIL)/
+ aaabcccaaabccc
+
+/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+ aaaxxxxxx
+ aaa++++++
+ bbbxxxxx
+ bbb+++++
+ cccxxxx
+ ccc++++
+ dddddddd
+
+/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+ aaaxxxxxx
+ aaa++++++
+ bbbxxxxx
+ bbb+++++
+ cccxxxx
+ ccc++++
+ dddddddd
+
+/a+b?(*THEN)c+(*FAIL)/
+ aaabccc
+
+/(A (A|B(*ACCEPT)|C) D)(E)/x
+ ABX
+ AADE
+ ACDE
+ ** Failers
+ AD
+
+/^a+(*FAIL)/C
+ aaaaaa
+
+/a+b?c+(*FAIL)/C
+ aaabccc
+
+/a+b?(*PRUNE)c+(*FAIL)/C
+ aaabccc
+
+/a+b?(*COMMIT)c+(*FAIL)/C
+ aaabccc
+
+/a+b?(*SKIP)c+(*FAIL)/C
+ aaabcccaaabccc
+
+/a+b?(*THEN)c+(*FAIL)/C
+ aaabccc
+
+/a(*PRUNE:XXX)b/
+
+/a(*MARK)b/
+
+/(?i:A{1,}\6666666666)/
+
+/\g6666666666/
+
+/[\g6666666666]/
+
+/(?1)\c[/
+
+/.+A/<crlf>
+ \r\nA
+
+/\nA/<crlf>
+ \r\nA
+
+/[\r\n]A/<crlf>
+ \r\nA
+
+/(\r|\n)A/<crlf>
+ \r\nA
+
+/a(*CR)b/
+
+/(*CR)a.b/
+ a\nb
+ ** Failers
+ a\rb
+
+/(*CR)a.b/<lf>
+ a\nb
+ ** Failers
+ a\rb
+
+/(*LF)a.b/<CRLF>
+ a\rb
+ ** Failers
+ a\nb
+
+/(*CRLF)a.b/
+ a\rb
+ a\nb
+ ** Failers
+ a\r\nb
+
+/(*ANYCRLF)a.b/<CR>
+ ** Failers
+ a\rb
+ a\nb
+ a\r\nb
+
+/(*ANY)a.b/<cr>
+ ** Failers
+ a\rb
+ a\nb
+ a\r\nb
+ a\x85b
+
/ End of testinput2 /
diff --git a/ext/pcre/pcrelib/testdata/testinput4 b/ext/pcre/pcrelib/testdata/testinput4
index 0fb850bff..630fb1d53 100644
--- a/ext/pcre/pcrelib/testdata/testinput4
+++ b/ext/pcre/pcrelib/testdata/testinput4
@@ -523,4 +523,16 @@
/a*\x{100}*\w/8
a
+/\S\S/8g
+ A\x{a3}BC
+
+/\S{2}/8g
+ A\x{a3}BC
+
+/\W\W/8g
+ +\x{a3}==
+
+/\W{2}/8g
+ +\x{a3}==
+
/ End of testinput4 /
diff --git a/ext/pcre/pcrelib/testdata/testinput5 b/ext/pcre/pcrelib/testdata/testinput5
index e8e3cf799..aa0123b3e 100644
--- a/ext/pcre/pcrelib/testdata/testinput5
+++ b/ext/pcre/pcrelib/testdata/testinput5
@@ -238,6 +238,10 @@ can't tell the difference.) --/
\xf9\x87\x80\x80\x80
\xfc\x84\x80\x80\x80\x80
\xfd\x83\x80\x80\x80\x80
+ \?\xf8\x88\x80\x80\x80
+ \?\xf9\x87\x80\x80\x80
+ \?\xfc\x84\x80\x80\x80\x80
+ \?\xfd\x83\x80\x80\x80\x80
/\x{100}abc(xyz(?1))/8DZ
@@ -393,4 +397,24 @@ can't tell the difference.) --/
/[\V]/8BZ
+/.*$/8<any>
+ \x{1ec5}
+
+/-- This tests the stricter UTF-8 check according to RFC 3629. --/
+
+/X/8
+ \x{0}\x{d7ff}\x{e000}\x{10ffff}
+ \x{d800}
+ \x{d800}\?
+ \x{da00}
+ \x{da00}\?
+ \x{dfff}
+ \x{dfff}\?
+ \x{110000}
+ \x{110000}\?
+ \x{2000000}
+ \x{2000000}\?
+ \x{7fffffff}
+ \x{7fffffff}\?
+
/ End of testinput5 /
diff --git a/ext/pcre/pcrelib/testdata/testinput6 b/ext/pcre/pcrelib/testdata/testinput6
index 05e8feb02..53d2b328f 100644
--- a/ext/pcre/pcrelib/testdata/testinput6
+++ b/ext/pcre/pcrelib/testdata/testinput6
@@ -61,7 +61,7 @@
\x{09f}
/^\p{Cs}/8
- \x{dfff}
+ \?\x{dfff}
** Failers
\x{09f}
@@ -69,7 +69,7 @@
a
** Failers
Z
- \x{dfff}
+ \x{e000}
/^\p{Lm}/8
\x{2b0}
@@ -778,4 +778,58 @@ was broken in all cases./
123abcdefg
123abc\xc4\xc5zz
+/\X{1,3}\d/
+ \x8aBCD
+
+/\X?\d/
+ \x8aBCD
+
+/\P{L}?\d/
+ \x8aBCD
+
+/[\PPP\x8a]{1,}\x80/
+ A\x80
+
+/(?:[\PPa*]*){8,}/
+
+/[\P{Any}]/BZ
+
+/[\P{Any}\E]/BZ
+
+/(\P{Yi}+\277)/
+
+/(\P{Yi}+\277)?/
+
+/(?<=\P{Yi}{3}A)X/
+
+/\p{Yi}+(\P{Yi}+)(?1)/
+
+/(\P{Yi}{2}\277)?/
+
+/[\P{Yi}A]/
+
+/[\P{Yi}\P{Yi}\P{Yi}A]/
+
+/[^\P{Yi}A]/
+
+/[^\P{Yi}\P{Yi}\P{Yi}A]/
+
+/(\P{Yi}*\277)*/
+
+/(\P{Yi}*?\277)*/
+
+/(\p{Yi}*+\277)*/
+
+/(\P{Yi}?\277)*/
+
+/(\P{Yi}??\277)*/
+
+/(\p{Yi}?+\277)*/
+
+/(\P{Yi}{0,3}\277)*/
+
+/(\P{Yi}{0,3}?\277)*/
+
+/(\p{Yi}{0,3}+\277)*/
+
/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testinput7 b/ext/pcre/pcrelib/testdata/testinput7
index 2722980ad..76524b725 100644
--- a/ext/pcre/pcrelib/testdata/testinput7
+++ b/ext/pcre/pcrelib/testdata/testinput7
@@ -4298,4 +4298,16 @@
>XY\x0aZ\x0aA\x0bNN\x0c
>\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+/.+A/<crlf>
+ \r\nA
+
+/\nA/<crlf>
+ \r\nA
+
+/[\r\n]A/<crlf>
+ \r\nA
+
+/(\r|\n)A/<crlf>
+ \r\nA
+
/ End of testinput7 /
diff --git a/ext/pcre/pcrelib/testdata/testinput9 b/ext/pcre/pcrelib/testdata/testinput9
index 07d9548af..8a606318b 100644
--- a/ext/pcre/pcrelib/testdata/testinput9
+++ b/ext/pcre/pcrelib/testdata/testinput9
@@ -148,7 +148,7 @@
\x{09f}
/^\p{Cs}/8
- \x{dfff}
+ \?\x{dfff}
** Failers
\x{09f}
@@ -156,7 +156,7 @@
a
** Failers
Z
- \x{dfff}
+ \x{e000}
/^\p{Lm}/8
\x{2b0}
diff --git a/ext/pcre/pcrelib/testdata/testoutput1 b/ext/pcre/pcrelib/testdata/testoutput1
index 209b0d3f4..4c0e680d1 100644
--- a/ext/pcre/pcrelib/testdata/testoutput1
+++ b/ext/pcre/pcrelib/testdata/testoutput1
@@ -6576,4 +6576,21 @@ No match
0: abcd
1:
+/( (A | (?(1)0|) )* )/x
+ abcd
+ 0:
+ 1:
+ 2:
+
+/( ( (?(1)0|) )* )/x
+ abcd
+ 0:
+ 1:
+ 2:
+
+/( (?(1)0|)* )/x
+ abcd
+ 0:
+ 1:
+
/ End of testinput1 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput10 b/ext/pcre/pcrelib/testdata/testoutput10
index bfda261bc..dbd59241a 100644
--- a/ext/pcre/pcrelib/testdata/testoutput10
+++ b/ext/pcre/pcrelib/testdata/testoutput10
@@ -6,8 +6,8 @@ are all themselves checked in other tests. --/
/((?i)b)/BM
Memory allocation (code space): 21
------------------------------------------------------------------
- 0 17 Bra 0
- 3 9 Bra 1
+ 0 17 Bra
+ 3 9 CBra 1
8 01 Opt
10 NC b
12 9 Ket
@@ -19,8 +19,8 @@ Memory allocation (code space): 21
/(?s)(.*X|^B)/BM
Memory allocation (code space): 25
------------------------------------------------------------------
- 0 21 Bra 0
- 3 9 Bra 1
+ 0 21 Bra
+ 3 9 CBra 1
8 Any*
10 X
12 6 Alt
@@ -34,8 +34,8 @@ Memory allocation (code space): 25
/(?s:.*X|^B)/BM
Memory allocation (code space): 29
------------------------------------------------------------------
- 0 25 Bra 0
- 3 9 Bra 0
+ 0 25 Bra
+ 3 9 Bra
6 04 Opt
8 Any*
10 X
@@ -52,7 +52,7 @@ Memory allocation (code space): 29
/^[[:alnum:]]/BM
Memory allocation (code space): 41
------------------------------------------------------------------
- 0 37 Bra 0
+ 0 37 Bra
3 ^
4 [0-9A-Za-z]
37 37 Ket
@@ -62,7 +62,7 @@ Memory allocation (code space): 41
/#/IxMD
Memory allocation (code space): 7
------------------------------------------------------------------
- 0 3 Bra 0
+ 0 3 Bra
3 3 Ket
6 End
------------------------------------------------------------------
@@ -74,7 +74,7 @@ No need char
/a#/IxMD
Memory allocation (code space): 9
------------------------------------------------------------------
- 0 5 Bra 0
+ 0 5 Bra
3 a
5 5 Ket
8 End
@@ -87,7 +87,7 @@ No need char
/x?+/BM
Memory allocation (code space): 9
------------------------------------------------------------------
- 0 5 Bra 0
+ 0 5 Bra
3 x?+
5 5 Ket
8 End
@@ -96,7 +96,7 @@ Memory allocation (code space): 9
/x++/BM
Memory allocation (code space): 9
------------------------------------------------------------------
- 0 5 Bra 0
+ 0 5 Bra
3 x++
5 5 Ket
8 End
@@ -105,7 +105,7 @@ Memory allocation (code space): 9
/x{1,3}+/BM
Memory allocation (code space): 19
------------------------------------------------------------------
- 0 15 Bra 0
+ 0 15 Bra
3 9 Once
6 x
8 x{0,2}
@@ -117,10 +117,10 @@ Memory allocation (code space): 19
/(x)*+/BM
Memory allocation (code space): 24
------------------------------------------------------------------
- 0 20 Bra 0
+ 0 20 Bra
3 14 Once
6 Brazero
- 7 7 Bra 1
+ 7 7 CBra 1
12 x
14 7 KetRmax
17 14 Ket
@@ -131,19 +131,19 @@ Memory allocation (code space): 24
/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/BM
Memory allocation (code space): 120
------------------------------------------------------------------
- 0 116 Bra 0
+ 0 116 Bra
3 ^
- 4 109 Bra 1
- 9 7 Bra 2
+ 4 109 CBra 1
+ 9 7 CBra 2
14 a+
16 7 Ket
- 19 39 Bra 3
+ 19 39 CBra 3
24 [ab]+?
58 39 Ket
- 61 39 Bra 4
+ 61 39 CBra 4
66 [bc]+
100 39 Ket
-103 7 Bra 5
+103 7 CBra 5
108 \w*
110 7 Ket
113 109 Ket
@@ -154,7 +154,7 @@ Memory allocation (code space): 120
|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|BM
Memory allocation (code space): 826
------------------------------------------------------------------
- 0 822 Bra 0
+ 0 822 Bra
3 8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
821 \b
822 822 Ket
@@ -164,7 +164,7 @@ Memory allocation (code space): 826
|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|BM
Memory allocation (code space): 816
------------------------------------------------------------------
- 0 812 Bra 0
+ 0 812 Bra
3 $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
811 \b
812 812 Ket
@@ -174,8 +174,8 @@ Memory allocation (code space): 816
/(a(?1)b)/BM
Memory allocation (code space): 28
------------------------------------------------------------------
- 0 24 Bra 0
- 3 18 Bra 1
+ 0 24 Bra
+ 3 18 CBra 1
8 a
10 6 Once
13 3 Recurse
@@ -189,8 +189,8 @@ Memory allocation (code space): 28
/(a(?1)+b)/BM
Memory allocation (code space): 28
------------------------------------------------------------------
- 0 24 Bra 0
- 3 18 Bra 1
+ 0 24 Bra
+ 3 18 CBra 1
8 a
10 6 Once
13 3 Recurse
@@ -204,15 +204,15 @@ Memory allocation (code space): 28
/a(?P<name1>b|c)d(?P<longername2>e)/BM
Memory allocation (code space): 42
------------------------------------------------------------------
- 0 32 Bra 0
+ 0 32 Bra
3 a
- 5 7 Bra 1
+ 5 7 CBra 1
10 b
12 5 Alt
15 c
17 12 Ket
20 d
- 22 7 Bra 2
+ 22 7 CBra 2
27 e
29 7 Ket
32 32 Ket
@@ -222,17 +222,17 @@ Memory allocation (code space): 42
/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/BM
Memory allocation (code space): 54
------------------------------------------------------------------
- 0 41 Bra 0
- 3 25 Bra 0
+ 0 41 Bra
+ 3 25 Bra
6 a
- 8 17 Bra 1
+ 8 17 CBra 1
13 c
- 15 7 Bra 2
+ 15 7 CBra 2
20 d
22 7 Ket
25 17 Ket
28 25 Ket
- 31 7 Bra 3
+ 31 7 CBra 3
36 a
38 7 Ket
41 41 Ket
@@ -242,8 +242,8 @@ Memory allocation (code space): 54
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
Memory allocation (code space): 43
------------------------------------------------------------------
- 0 36 Bra 0
- 3 7 Bra 1
+ 0 36 Bra
+ 3 7 CBra 1
8 a
10 7 Ket
13 Any
@@ -262,7 +262,7 @@ Memory allocation (code space): 43
/abc(?C255)de(?C)f/BM
Memory allocation (code space): 31
------------------------------------------------------------------
- 0 27 Bra 0
+ 0 27 Bra
3 abc
9 Callout 255 10 1
15 de
@@ -275,7 +275,7 @@ Memory allocation (code space): 31
/abcde/CBM
Memory allocation (code space): 53
------------------------------------------------------------------
- 0 49 Bra 0
+ 0 49 Bra
3 Callout 255 0 1
9 a
11 Callout 255 1 1
@@ -294,7 +294,7 @@ Memory allocation (code space): 53
/\x{100}/8BM
Memory allocation (code space): 10
------------------------------------------------------------------
- 0 6 Bra 0
+ 0 6 Bra
3 \x{100}
6 6 Ket
9 End
@@ -303,7 +303,7 @@ Memory allocation (code space): 10
/\x{1000}/8BM
Memory allocation (code space): 11
------------------------------------------------------------------
- 0 7 Bra 0
+ 0 7 Bra
3 \x{1000}
7 7 Ket
10 End
@@ -312,7 +312,7 @@ Memory allocation (code space): 11
/\x{10000}/8BM
Memory allocation (code space): 12
------------------------------------------------------------------
- 0 8 Bra 0
+ 0 8 Bra
3 \x{10000}
8 8 Ket
11 End
@@ -321,7 +321,7 @@ Memory allocation (code space): 12
/\x{100000}/8BM
Memory allocation (code space): 12
------------------------------------------------------------------
- 0 8 Bra 0
+ 0 8 Bra
3 \x{100000}
8 8 Ket
11 End
@@ -330,7 +330,7 @@ Memory allocation (code space): 12
/\x{1000000}/8BM
Memory allocation (code space): 13
------------------------------------------------------------------
- 0 9 Bra 0
+ 0 9 Bra
3 \x{1000000}
9 9 Ket
12 End
@@ -339,7 +339,7 @@ Memory allocation (code space): 13
/\x{4000000}/8BM
Memory allocation (code space): 14
------------------------------------------------------------------
- 0 10 Bra 0
+ 0 10 Bra
3 \x{4000000}
10 10 Ket
13 End
@@ -348,7 +348,7 @@ Memory allocation (code space): 14
/\x{7fffFFFF}/8BM
Memory allocation (code space): 14
------------------------------------------------------------------
- 0 10 Bra 0
+ 0 10 Bra
3 \x{7fffffff}
10 10 Ket
13 End
@@ -357,7 +357,7 @@ Memory allocation (code space): 14
/[\x{ff}]/8BM
Memory allocation (code space): 10
------------------------------------------------------------------
- 0 6 Bra 0
+ 0 6 Bra
3 \x{ff}
6 6 Ket
9 End
@@ -366,7 +366,7 @@ Memory allocation (code space): 10
/[\x{100}]/8BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\x{100}]
11 11 Ket
14 End
@@ -375,7 +375,7 @@ Memory allocation (code space): 15
/\x80/8BM
Memory allocation (code space): 10
------------------------------------------------------------------
- 0 6 Bra 0
+ 0 6 Bra
3 \x{80}
6 6 Ket
9 End
@@ -384,7 +384,7 @@ Memory allocation (code space): 10
/\xff/8BM
Memory allocation (code space): 10
------------------------------------------------------------------
- 0 6 Bra 0
+ 0 6 Bra
3 \x{ff}
6 6 Ket
9 End
@@ -393,7 +393,7 @@ Memory allocation (code space): 10
/\x{0041}\x{2262}\x{0391}\x{002e}/D8M
Memory allocation (code space): 18
------------------------------------------------------------------
- 0 14 Bra 0
+ 0 14 Bra
3 A\x{2262}\x{391}.
14 14 Ket
17 End
@@ -406,7 +406,7 @@ Need char = '.'
/\x{D55c}\x{ad6d}\x{C5B4}/D8M
Memory allocation (code space): 19
------------------------------------------------------------------
- 0 15 Bra 0
+ 0 15 Bra
3 \x{d55c}\x{ad6d}\x{c5b4}
15 15 Ket
18 End
@@ -419,7 +419,7 @@ Need char = 180
/\x{65e5}\x{672c}\x{8a9e}/D8M
Memory allocation (code space): 19
------------------------------------------------------------------
- 0 15 Bra 0
+ 0 15 Bra
3 \x{65e5}\x{672c}\x{8a9e}
15 15 Ket
18 End
@@ -432,7 +432,7 @@ Need char = 158
/[\x{100}]/8BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\x{100}]
11 11 Ket
14 End
@@ -441,7 +441,7 @@ Memory allocation (code space): 15
/[Z\x{100}]/8BM
Memory allocation (code space): 47
------------------------------------------------------------------
- 0 43 Bra 0
+ 0 43 Bra
3 [Z\x{100}]
43 43 Ket
46 End
@@ -450,7 +450,7 @@ Memory allocation (code space): 47
/^[\x{100}\E-\Q\E\x{150}]/B8M
Memory allocation (code space): 18
------------------------------------------------------------------
- 0 14 Bra 0
+ 0 14 Bra
3 ^
4 [\x{100}-\x{150}]
14 14 Ket
@@ -460,7 +460,7 @@ Memory allocation (code space): 18
/^[\QÄ€\E-\QÅ\E]/B8M
Memory allocation (code space): 18
------------------------------------------------------------------
- 0 14 Bra 0
+ 0 14 Bra
3 ^
4 [\x{100}-\x{150}]
14 14 Ket
@@ -473,7 +473,7 @@ Failed: missing terminating ] for character class at offset 15
/[\p{L}]/BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\p{L}]
11 11 Ket
14 End
@@ -482,7 +482,7 @@ Memory allocation (code space): 15
/[\p{^L}]/BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\P{L}]
11 11 Ket
14 End
@@ -491,7 +491,7 @@ Memory allocation (code space): 15
/[\P{L}]/BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\P{L}]
11 11 Ket
14 End
@@ -500,7 +500,7 @@ Memory allocation (code space): 15
/[\P{^L}]/BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\p{L}]
11 11 Ket
14 End
@@ -509,7 +509,7 @@ Memory allocation (code space): 15
/[abc\p{L}\x{0660}]/8BM
Memory allocation (code space): 50
------------------------------------------------------------------
- 0 46 Bra 0
+ 0 46 Bra
3 [a-c\p{L}\x{660}]
46 46 Ket
49 End
@@ -518,7 +518,7 @@ Memory allocation (code space): 50
/[\p{Nd}]/8BM
Memory allocation (code space): 15
------------------------------------------------------------------
- 0 11 Bra 0
+ 0 11 Bra
3 [\p{Nd}]
11 11 Ket
14 End
@@ -527,7 +527,7 @@ Memory allocation (code space): 15
/[\p{Nd}+-]+/8BM
Memory allocation (code space): 48
------------------------------------------------------------------
- 0 44 Bra 0
+ 0 44 Bra
3 [+\-\p{Nd}]+
44 44 Ket
47 End
@@ -536,7 +536,7 @@ Memory allocation (code space): 48
/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iBM
Memory allocation (code space): 25
------------------------------------------------------------------
- 0 21 Bra 0
+ 0 21 Bra
3 NC A\x{391}\x{10427}\x{ff3a}\x{1fb0}
21 21 Ket
24 End
@@ -545,7 +545,7 @@ Memory allocation (code space): 25
/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8BM
Memory allocation (code space): 25
------------------------------------------------------------------
- 0 21 Bra 0
+ 0 21 Bra
3 A\x{391}\x{10427}\x{ff3a}\x{1fb0}
21 21 Ket
24 End
@@ -554,10 +554,116 @@ Memory allocation (code space): 25
/[\x{105}-\x{109}]/8iBM
Memory allocation (code space): 17
------------------------------------------------------------------
- 0 13 Bra 0
+ 0 13 Bra
3 [\x{104}-\x{109}]
13 13 Ket
16 End
------------------------------------------------------------------
+/( ( (?(1)0|) )* )/xBM
+Memory allocation (code space): 38
+------------------------------------------------------------------
+ 0 34 Bra
+ 3 28 CBra 1
+ 8 Brazero
+ 9 19 SCBra 2
+ 14 8 Cond
+ 17 1 Cond ref
+ 20 0
+ 22 3 Alt
+ 25 11 Ket
+ 28 19 KetRmax
+ 31 28 Ket
+ 34 34 Ket
+ 37 End
+------------------------------------------------------------------
+
+/( (?(1)0|)* )/xBM
+Memory allocation (code space): 30
+------------------------------------------------------------------
+ 0 26 Bra
+ 3 20 CBra 1
+ 8 Brazero
+ 9 8 SCond
+ 12 1 Cond ref
+ 15 0
+ 17 3 Alt
+ 20 11 KetRmax
+ 23 20 Ket
+ 26 26 Ket
+ 29 End
+------------------------------------------------------------------
+
+/[a]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+ 0 5 Bra
+ 3 a
+ 5 5 Ket
+ 8 End
+------------------------------------------------------------------
+
+/[a]/8BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+ 0 5 Bra
+ 3 a
+ 5 5 Ket
+ 8 End
+------------------------------------------------------------------
+
+/[\xaa]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+ 0 5 Bra
+ 3 \xaa
+ 5 5 Ket
+ 8 End
+------------------------------------------------------------------
+
+/[\xaa]/8BM
+Memory allocation (code space): 10
+------------------------------------------------------------------
+ 0 6 Bra
+ 3 \x{aa}
+ 6 6 Ket
+ 9 End
+------------------------------------------------------------------
+
+/[^a]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+ 0 5 Bra
+ 3 [^a]
+ 5 5 Ket
+ 8 End
+------------------------------------------------------------------
+
+/[^a]/8BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+ 0 5 Bra
+ 3 [^a]
+ 5 5 Ket
+ 8 End
+------------------------------------------------------------------
+
+/[^\xaa]/BM
+Memory allocation (code space): 9
+------------------------------------------------------------------
+ 0 5 Bra
+ 3 [^\xaa]
+ 5 5 Ket
+ 8 End
+------------------------------------------------------------------
+
+/[^\xaa]/8BM
+Memory allocation (code space): 40
+------------------------------------------------------------------
+ 0 36 Bra
+ 3 [\x00-\xa9\xab-\xff] (neg)
+ 36 36 Ket
+ 39 End
+------------------------------------------------------------------
+
/ End of testinput10 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput2 b/ext/pcre/pcrelib/testdata/testoutput2
index cd8f82eb1..a1c071d8b 100644
--- a/ext/pcre/pcrelib/testdata/testoutput2
+++ b/ext/pcre/pcrelib/testdata/testoutput2
@@ -166,6 +166,7 @@ Starting byte set: a b c d
/(a|[^\dZ])/IS
Capturing subpattern count = 1
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -402,6 +403,7 @@ Failed: missing terminating ] for character class at offset 4
/[^aeiou ]{3,}/I
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -599,8 +601,8 @@ Need char = 'h' (caseless)
/((?i)b)/IDZS
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
01 Opt
NC b
Ket
@@ -703,6 +705,7 @@ Starting byte set: a b
/(?<=foo\n)^bar/Im
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: multiline
No first char
Need char = 'r'
@@ -719,6 +722,7 @@ No match
/^(?<=foo\n)bar/Im
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: multiline
First char at start or follows newline
Need char = 'r'
@@ -1105,13 +1109,14 @@ No need char
)?)?)?)?)?)?)?)?)?otherword/I
Capturing subpattern count = 8
Partial matching not supported
+Contains explicit CR or LF match
No options
First char = 'w'
Need char = 'd'
/.*X/IDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Any*
X
Ket
@@ -1125,7 +1130,7 @@ Need char = 'X'
/.*X/IDZs
------------------------------------------------------------------
- Bra 0
+ Bra
Any*
X
Ket
@@ -1139,8 +1144,8 @@ Need char = 'X'
/(.*X|^B)/IDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
Any*
X
Alt
@@ -1158,8 +1163,8 @@ No need char
/(.*X|^B)/IDZs
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
Any*
X
Alt
@@ -1177,8 +1182,8 @@ No need char
/(?s)(.*X|^B)/IDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
Any*
X
Alt
@@ -1196,8 +1201,8 @@ No need char
/(?s:.*X|^B)/IDZ
------------------------------------------------------------------
- Bra 0
- Bra 0
+ Bra
+ Bra
04 Opt
Any*
X
@@ -1347,6 +1352,7 @@ No need char
/^ab\n/Ig+
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -1356,6 +1362,7 @@ No need char
/^ab\n/Img+
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: multiline
First char at start or follows newline
Need char = 10
@@ -1433,6 +1440,7 @@ Need char = 'a'
/"([^\\"]+|\\.)*"/I
Capturing subpattern count = 1
Partial matching not supported
+Contains explicit CR or LF match
No options
First char = '"'
Need char = '"'
@@ -1708,6 +1716,7 @@ Study returned NULL
/Ix
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1737,6 +1746,7 @@ No match
/\( ( (?>[^()]+) | (?R) )* \) /Ixg
Capturing subpattern count = 1
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1752,6 +1762,7 @@ Need char = ')'
/\( (?: (?>[^()]+) | (?R) ) \) /Ix
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1771,6 +1782,7 @@ No match
/\( (?: (?>[^()]+) | (?R) )? \) /Ix
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1782,6 +1794,7 @@ Need char = ')'
/\( ( (?>[^()]+) | (?R) )* \) /Ix
Capturing subpattern count = 1
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1792,6 +1805,7 @@ Need char = ')'
/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 2
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1803,6 +1817,7 @@ Need char = ')'
/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1820,6 +1835,7 @@ Need char = ')'
/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1837,6 +1853,7 @@ Need char = ')'
/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
Capturing subpattern count = 11
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1857,6 +1874,7 @@ Need char = ')'
/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1869,6 +1887,7 @@ Need char = ')'
/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
Capturing subpattern count = 3
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '('
Need char = ')'
@@ -1885,7 +1904,7 @@ Need char = ')'
/^[[:alnum:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[0-9A-Za-z]
Ket
@@ -1898,20 +1917,21 @@ No need char
/^[[:^alnum:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-/:-@[-`{-\xff]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/^[[:alpha:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[A-Za-z]
Ket
@@ -1924,13 +1944,14 @@ No need char
/^[[:^alpha:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-@[-`{-\xff]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -1945,20 +1966,21 @@ Starting byte set: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
/^[[:ascii:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-\x7f]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/^[[:^ascii:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x80-\xff]
Ket
@@ -1971,7 +1993,7 @@ No need char
/^[[:blank:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x09 ]
Ket
@@ -1984,19 +2006,21 @@ No need char
/^[[:^blank:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-\x08\x0a-\x1f!-\xff]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/[\n\x0b\x0c\x0d[:blank:]]/IS
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -2004,20 +2028,21 @@ Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20
/^[[:cntrl:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-\x1f\x7f]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/^[[:digit:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[0-9]
Ket
@@ -2030,7 +2055,7 @@ No need char
/^[[:graph:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[!-~]
Ket
@@ -2043,7 +2068,7 @@ No need char
/^[[:lower:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[a-z]
Ket
@@ -2056,7 +2081,7 @@ No need char
/^[[:print:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[ -~]
Ket
@@ -2069,7 +2094,7 @@ No need char
/^[[:punct:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[!-/:-@[-`{-~]
Ket
@@ -2082,20 +2107,21 @@ No need char
/^[[:space:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x09-\x0d ]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/^[[:upper:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[A-Z]
Ket
@@ -2108,7 +2134,7 @@ No need char
/^[[:xdigit:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[0-9A-Fa-f]
Ket
@@ -2121,7 +2147,7 @@ No need char
/^[[:word:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[0-9A-Z_a-z]
Ket
@@ -2134,7 +2160,7 @@ No need char
/^[[:^cntrl:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[ -~\x80-\xff]
Ket
@@ -2147,33 +2173,35 @@ No need char
/^[12[:^digit:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-/12:-\xff]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/^[[:^blank:]]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-\x08\x0a-\x1f!-\xff]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
/[01[:alpha:]%]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[%01A-Za-z]
Ket
End
@@ -2694,7 +2722,7 @@ Need char = '-'
/#/IxDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Ket
End
------------------------------------------------------------------
@@ -2705,7 +2733,7 @@ No need char
/a#/IxDZ
------------------------------------------------------------------
- Bra 0
+ Bra
a
Ket
End
@@ -2717,7 +2745,7 @@ No need char
/[\s]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09\x0a\x0c\x0d ]
Ket
End
@@ -2729,7 +2757,7 @@ No need char
/[\S]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x08\x0b\x0e-\x1f!-\xff]
Ket
End
@@ -2741,7 +2769,7 @@ No need char
/a(?i)b/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
a
01 Opt
NC b
@@ -2763,8 +2791,8 @@ No match
/(a(?i)b)/DZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
a
01 Opt
NC b
@@ -2790,7 +2818,7 @@ No match
/ (?i)abc/IxDZ
------------------------------------------------------------------
- Bra 0
+ Bra
NC abc
Ket
End
@@ -2803,7 +2831,7 @@ Need char = 'c' (caseless)
/#this is a comment
(?i)abc/IxDZ
------------------------------------------------------------------
- Bra 0
+ Bra
NC abc
Ket
End
@@ -2815,7 +2843,7 @@ Need char = 'c' (caseless)
/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Ket
End
@@ -2827,7 +2855,7 @@ Need char = '0'
/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Ket
End
@@ -2839,7 +2867,7 @@ Need char = '0'
/\Q\E/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Ket
End
------------------------------------------------------------------
@@ -2852,7 +2880,7 @@ No need char
/\Q\Ex/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
x
Ket
End
@@ -2864,7 +2892,7 @@ No need char
/ \Q\E/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Ket
End
@@ -2876,7 +2904,7 @@ No need char
/a\Q\E/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
a
Ket
End
@@ -2894,7 +2922,7 @@ No need char
/a\Q\Eb/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
ab
Ket
End
@@ -2908,7 +2936,7 @@ Need char = 'b'
/\Q\Eabc/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
abc
Ket
End
@@ -2920,7 +2948,7 @@ Need char = 'c'
/x*+\w/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
x*+
\w
Ket
@@ -2938,7 +2966,7 @@ No match
/x?+/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
x?+
Ket
End
@@ -2950,7 +2978,7 @@ No need char
/x++/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
x++
Ket
End
@@ -2963,7 +2991,7 @@ No need char
/x{1,3}+/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Once
x
x{0,2}
@@ -2979,10 +3007,10 @@ No need char
/(x)*+/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Once
Brazero
- Bra 1
+ CBra 1
x
KetRmax
Ket
@@ -3055,6 +3083,7 @@ Need char = 'b'
/([^()]++|\([^()]*\))+/I
Capturing subpattern count = 1
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -3065,6 +3094,7 @@ No need char
/\(([^()]++|\([^()]+\))+\)/I
Capturing subpattern count = 1
Partial matching not supported
+Contains explicit CR or LF match
No options
First char = '('
Need char = ')'
@@ -3081,18 +3111,18 @@ No match
/(abc){1,3}+/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Once
- Bra 1
+ CBra 1
abc
Ket
Brazero
- Bra 0
- Bra 1
+ Bra
+ CBra 1
abc
Ket
Brazero
- Bra 1
+ CBra 1
abc
Ket
Ket
@@ -3119,7 +3149,7 @@ Failed: nothing to repeat at offset 7
/x(?U)a++b/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
x
a++
b
@@ -3136,7 +3166,7 @@ Need char = 'b'
/(?U)xa++b/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
x
a++
b
@@ -3153,19 +3183,19 @@ Need char = 'b'
/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
- Bra 1
- Bra 2
+ CBra 1
+ CBra 2
a+
Ket
- Bra 3
+ CBra 3
[ab]+?
Ket
- Bra 4
+ CBra 4
[bc]+
Ket
- Bra 5
+ CBra 5
\w*
Ket
Ket
@@ -3180,7 +3210,7 @@ No need char
/^x(?U)a+b/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
x
a++
@@ -3196,10 +3226,10 @@ Need char = 'b'
/^x(?U)(a+)b/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
x
- Bra 1
+ CBra 1
a+?
Ket
b
@@ -3247,7 +3277,7 @@ Failed: missing terminating ] for character class at offset 10
/[\s]/IDZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09\x0a\x0c\x0d ]
Ket
End
@@ -3259,24 +3289,26 @@ No need char
/[[:space:]]/IDZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09-\x0d ]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
No first char
No need char
/[[:space:]abcde]/IDZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09-\x0d a-e]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -3284,6 +3316,7 @@ No need char
/< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '<'
Need char = '>'
@@ -3306,7 +3339,7 @@ No match
|8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDZ
------------------------------------------------------------------
- Bra 0
+ Bra
8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
\b
Ket
@@ -3319,7 +3352,7 @@ Need char = 'X'
|\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|IDZ
------------------------------------------------------------------
- Bra 0
+ Bra
$<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
\b
Ket
@@ -3498,6 +3531,7 @@ Starting byte set: a b
/[^a]/I
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -3957,6 +3991,7 @@ Failed: recursive call could loop indefinitely at offset 16
/^([^()]|\((?1)*\))*$/I
Capturing subpattern count = 1
+Contains explicit CR or LF match
Options: anchored
No first char
No need char
@@ -3976,6 +4011,7 @@ No match
/^>abc>([^()]|\((?1)*\))*<xyz<$/I
Capturing subpattern count = 1
+Contains explicit CR or LF match
Options: anchored
No first char
Need char = '<'
@@ -3991,8 +4027,8 @@ Need char = '<'
/(a(?1)b)/DZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
a
Once
Recurse
@@ -4009,8 +4045,8 @@ Need char = 'b'
/(a(?1)+b)/DZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
a
Once
Recurse
@@ -4103,6 +4139,7 @@ No match
/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/Ix
Capturing subpattern count = 2
Partial matching not supported
+Contains explicit CR or LF match
Options: extended
First char = '<'
Need char = '>'
@@ -4185,15 +4222,15 @@ No need char
/a(?P<name1>b|c)d(?P<longername2>e)/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
a
- Bra 1
+ CBra 1
b
Alt
c
Ket
d
- Bra 2
+ CBra 2
e
Ket
Ket
@@ -4217,17 +4254,17 @@ Need char = 'e'
/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/DZ
------------------------------------------------------------------
- Bra 0
- Bra 0
+ Bra
+ Bra
a
- Bra 1
+ CBra 1
c
- Bra 2
+ CBra 2
d
Ket
Ket
Ket
- Bra 3
+ CBra 3
a
Ket
Ket
@@ -4244,8 +4281,8 @@ Need char = 'a'
/(?P<a>a)...(?P=a)bbb(?P>a)d/DZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
a
Ket
Any
@@ -4407,11 +4444,11 @@ No need char
/(a)(bc)/INDZ
------------------------------------------------------------------
- Bra 0
- Bra 0
+ Bra
+ Bra
a
Ket
- Bra 0
+ Bra
bc
Ket
Ket
@@ -4426,11 +4463,11 @@ Need char = 'c'
/(?P<one>a)(bc)/INDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
a
Ket
- Bra 0
+ Bra
bc
Ket
Ket
@@ -4448,11 +4485,11 @@ Need char = 'c'
/(a)(?P<named>bc)/INDZ
------------------------------------------------------------------
- Bra 0
- Bra 0
+ Bra
+ Bra
a
Ket
- Bra 1
+ CBra 1
bc
Ket
Ket
@@ -4541,10 +4578,10 @@ copy substring three failed -7
/(?P<Tes>)(?P<Test>)/DZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
Ket
- Bra 2
+ CBra 2
Ket
Ket
End
@@ -4559,10 +4596,10 @@ No need char
/(?P<Test>)(?P<Tes>)/DZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
Ket
- Bra 2
+ CBra 2
Ket
Ket
End
@@ -4636,11 +4673,11 @@ Need char = ']'
/(a(b(?2)c))?/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 1
+ CBra 1
a
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -4658,11 +4695,11 @@ No need char
/(a(b(?2)c))*/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 1
+ CBra 1
a
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -4680,12 +4717,12 @@ No need char
/(a(b(?2)c)){0,2}/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 0
- Bra 1
+ Bra
+ CBra 1
a
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -4694,9 +4731,9 @@ No need char
Ket
Ket
Brazero
- Bra 1
+ CBra 1
a
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -4715,7 +4752,7 @@ No need char
/[ab]{1}+/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
Once
[ab]{1,1}
Ket
@@ -4750,7 +4787,7 @@ Study returned NULL
/a*.*b/ISDZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*
Any*
b
@@ -4766,9 +4803,9 @@ Study returned NULL
/(a|b)*.?c/ISDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 1
+ CBra 1
a
Alt
b
@@ -4786,7 +4823,7 @@ Study returned NULL
/abc(?C255)de(?C)f/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
abc
Callout 255 10 1
de
@@ -4802,7 +4839,7 @@ Need char = 'f'
/abcde/ICDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Callout 255 0 1
a
Callout 255 1 1
@@ -4841,7 +4878,7 @@ No match
/a*b/ICDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Callout 255 0 2
a*+
Callout 255 2 1
@@ -4886,7 +4923,7 @@ Need char = 'b'
/a+b/ICDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Callout 255 0 2
a++
Callout 255 2 1
@@ -4926,9 +4963,9 @@ No match
/(abc|def)x/ICDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Callout 255 0 9
- Bra 1
+ CBra 1
Callout 255 1 1
a
Callout 255 2 1
@@ -5080,9 +5117,9 @@ No need char
/([ab]{,4}c|xy)/ICDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Callout 255 0 14
- Bra 1
+ CBra 1
Callout 255 1 4
[ab]
Callout 255 5 1
@@ -5255,9 +5292,9 @@ No match
/([ab]{1,4}c|xy){4,5}?123/ICDZ
------------------------------------------------------------------
- Bra 0
+ Bra
Callout 255 0 21
- Bra 1
+ CBra 1
Callout 255 1 9
[ab]{1,4}
Callout 255 10 1
@@ -5270,7 +5307,7 @@ No match
y
Callout 255 14 0
Ket
- Bra 1
+ CBra 1
Callout 255 1 9
[ab]{1,4}
Callout 255 10 1
@@ -5283,7 +5320,7 @@ No match
y
Callout 255 14 0
Ket
- Bra 1
+ CBra 1
Callout 255 1 9
[ab]{1,4}
Callout 255 10 1
@@ -5296,7 +5333,7 @@ No match
y
Callout 255 14 0
Ket
- Bra 1
+ CBra 1
Callout 255 1 9
[ab]{1,4}
Callout 255 10 1
@@ -5310,7 +5347,7 @@ No match
Callout 255 14 0
Ket
Braminzero
- Bra 1
+ CBra 1
Callout 255 1 9
[ab]{1,4}
Callout 255 10 1
@@ -5631,6 +5668,7 @@ No need char
/line\nbreak/I
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
First char = 'l'
Need char = 'k'
@@ -5641,6 +5679,7 @@ Need char = 'k'
/line\nbreak/If
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: firstline
First char = 'l'
Need char = 'k'
@@ -5653,6 +5692,7 @@ No match
/line\nbreak/Imf
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: multiline firstline
First char = 'l'
Need char = 'k'
@@ -5918,6 +5958,7 @@ Matched, but too many substrings
/[^()]*(?:\((?R)\)[^()]*)*/I
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -5931,6 +5972,7 @@ No need char
/[^()]*(?:\((?>(?R))\)[^()]*)*/I
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -5942,6 +5984,7 @@ No need char
/[^()]*(?:\((?R)\))*[^()]*/I
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -5953,6 +5996,7 @@ No need char
/(?:\((?R)\))*[^()]*/I
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -5966,6 +6010,7 @@ No need char
/(?:\((?R)\))|[^()]*/I
Capturing subpattern count = 0
Partial matching not supported
+Contains explicit CR or LF match
No options
No first char
No need char
@@ -6664,7 +6709,7 @@ Starting byte set: a b c d
/^a*b\d/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
a*+
b
@@ -6680,7 +6725,7 @@ Need char = 'b'
/^a*+b\d/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
a*+
b
@@ -6696,7 +6741,7 @@ Need char = 'b'
/^a*?b\d/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
a*+
b
@@ -6712,7 +6757,7 @@ Need char = 'b'
/^a+A\d/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
a++
A
@@ -6734,7 +6779,7 @@ No match
/^a*A\d/IiDZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
a*
NC A
@@ -6816,7 +6861,7 @@ Matched, but too many substrings
/a*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*+
\d
Ket
@@ -6825,7 +6870,7 @@ Matched, but too many substrings
/a*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*
\D
Ket
@@ -6834,7 +6879,7 @@ Matched, but too many substrings
/0*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
0*
\d
Ket
@@ -6843,7 +6888,7 @@ Matched, but too many substrings
/0*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
0*+
\D
Ket
@@ -6852,7 +6897,7 @@ Matched, but too many substrings
/a*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*+
\s
Ket
@@ -6861,7 +6906,7 @@ Matched, but too many substrings
/a*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*
\S
Ket
@@ -6870,7 +6915,7 @@ Matched, but too many substrings
/ *\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
*
\s
Ket
@@ -6879,7 +6924,7 @@ Matched, but too many substrings
/ *\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
*+
\S
Ket
@@ -6888,7 +6933,7 @@ Matched, but too many substrings
/a*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*
\w
Ket
@@ -6897,7 +6942,7 @@ Matched, but too many substrings
/a*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*+
\W
Ket
@@ -6906,7 +6951,7 @@ Matched, but too many substrings
/=*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
=*+
\w
Ket
@@ -6915,7 +6960,7 @@ Matched, but too many substrings
/=*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
=*
\W
Ket
@@ -6924,7 +6969,7 @@ Matched, but too many substrings
/\d*a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*+
a
Ket
@@ -6933,7 +6978,7 @@ Matched, but too many substrings
/\d*2/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*
2
Ket
@@ -6942,7 +6987,7 @@ Matched, but too many substrings
/\d*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*
\d
Ket
@@ -6951,7 +6996,7 @@ Matched, but too many substrings
/\d*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*+
\D
Ket
@@ -6960,7 +7005,7 @@ Matched, but too many substrings
/\d*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*+
\s
Ket
@@ -6969,7 +7014,7 @@ Matched, but too many substrings
/\d*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*
\S
Ket
@@ -6978,7 +7023,7 @@ Matched, but too many substrings
/\d*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*
\w
Ket
@@ -6987,7 +7032,7 @@ Matched, but too many substrings
/\d*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*+
\W
Ket
@@ -6996,7 +7041,7 @@ Matched, but too many substrings
/\D*a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*
a
Ket
@@ -7005,7 +7050,7 @@ Matched, but too many substrings
/\D*2/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*+
2
Ket
@@ -7014,7 +7059,7 @@ Matched, but too many substrings
/\D*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*+
\d
Ket
@@ -7023,7 +7068,7 @@ Matched, but too many substrings
/\D*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*
\D
Ket
@@ -7032,7 +7077,7 @@ Matched, but too many substrings
/\D*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*
\s
Ket
@@ -7041,7 +7086,7 @@ Matched, but too many substrings
/\D*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*
\S
Ket
@@ -7050,7 +7095,7 @@ Matched, but too many substrings
/\D*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*
\w
Ket
@@ -7059,7 +7104,7 @@ Matched, but too many substrings
/\D*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\D*
\W
Ket
@@ -7068,7 +7113,7 @@ Matched, but too many substrings
/\s*a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*+
a
Ket
@@ -7077,7 +7122,7 @@ Matched, but too many substrings
/\s*2/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*+
2
Ket
@@ -7086,7 +7131,7 @@ Matched, but too many substrings
/\s*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*+
\d
Ket
@@ -7095,7 +7140,7 @@ Matched, but too many substrings
/\s*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*
\D
Ket
@@ -7104,7 +7149,7 @@ Matched, but too many substrings
/\s*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*
\s
Ket
@@ -7113,7 +7158,7 @@ Matched, but too many substrings
/\s*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*+
\S
Ket
@@ -7122,7 +7167,7 @@ Matched, but too many substrings
/\s*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*+
\w
Ket
@@ -7131,7 +7176,7 @@ Matched, but too many substrings
/\s*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\s*
\W
Ket
@@ -7140,7 +7185,7 @@ Matched, but too many substrings
/\S*a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
a
Ket
@@ -7149,7 +7194,7 @@ Matched, but too many substrings
/\S*2/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
2
Ket
@@ -7158,7 +7203,7 @@ Matched, but too many substrings
/\S*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
\d
Ket
@@ -7167,7 +7212,7 @@ Matched, but too many substrings
/\S*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
\D
Ket
@@ -7176,7 +7221,7 @@ Matched, but too many substrings
/\S*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*+
\s
Ket
@@ -7185,7 +7230,7 @@ Matched, but too many substrings
/\S*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
\S
Ket
@@ -7194,7 +7239,7 @@ Matched, but too many substrings
/\S*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
\w
Ket
@@ -7203,7 +7248,7 @@ Matched, but too many substrings
/\S*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\S*
\W
Ket
@@ -7212,7 +7257,7 @@ Matched, but too many substrings
/\w*a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*
a
Ket
@@ -7221,7 +7266,7 @@ Matched, but too many substrings
/\w*2/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*
2
Ket
@@ -7230,7 +7275,7 @@ Matched, but too many substrings
/\w*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*
\d
Ket
@@ -7239,7 +7284,7 @@ Matched, but too many substrings
/\w*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*
\D
Ket
@@ -7248,7 +7293,7 @@ Matched, but too many substrings
/\w*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*+
\s
Ket
@@ -7257,7 +7302,7 @@ Matched, but too many substrings
/\w*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*
\S
Ket
@@ -7266,7 +7311,7 @@ Matched, but too many substrings
/\w*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*
\w
Ket
@@ -7275,7 +7320,7 @@ Matched, but too many substrings
/\w*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w*+
\W
Ket
@@ -7284,7 +7329,7 @@ Matched, but too many substrings
/\W*a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*+
a
Ket
@@ -7293,7 +7338,7 @@ Matched, but too many substrings
/\W*2/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*+
2
Ket
@@ -7302,7 +7347,7 @@ Matched, but too many substrings
/\W*\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*+
\d
Ket
@@ -7311,7 +7356,7 @@ Matched, but too many substrings
/\W*\D/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*
\D
Ket
@@ -7320,7 +7365,7 @@ Matched, but too many substrings
/\W*\s/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*
\s
Ket
@@ -7329,7 +7374,7 @@ Matched, but too many substrings
/\W*\S/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*
\S
Ket
@@ -7338,7 +7383,7 @@ Matched, but too many substrings
/\W*\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*+
\w
Ket
@@ -7347,7 +7392,7 @@ Matched, but too many substrings
/\W*\W/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\W*
\W
Ket
@@ -7356,7 +7401,7 @@ Matched, but too many substrings
/[^a]+a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[^a]++
a
Ket
@@ -7365,7 +7410,7 @@ Matched, but too many substrings
/[^a]+a/BZi
------------------------------------------------------------------
- Bra 0
+ Bra
[^A]++
NC a
Ket
@@ -7374,7 +7419,7 @@ Matched, but too many substrings
/[^a]+A/BZi
------------------------------------------------------------------
- Bra 0
+ Bra
[^A]++
NC A
Ket
@@ -7383,7 +7428,7 @@ Matched, but too many substrings
/[^a]+b/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[^a]+
b
Ket
@@ -7392,7 +7437,7 @@ Matched, but too many substrings
/[^a]+\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[^a]+
\d
Ket
@@ -7401,7 +7446,7 @@ Matched, but too many substrings
/a*[^a]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
a*
[^a]
Ket
@@ -7542,7 +7587,7 @@ No match
/^[\E\Qa\E-\Qz\E]+/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[a-z]+
Ket
@@ -7551,7 +7596,7 @@ No match
/^[a\Q]bc\E]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\]a-c]
Ket
@@ -7560,7 +7605,7 @@ No match
/^[a-\Q\E]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\-a]
Ket
@@ -7569,13 +7614,13 @@ No match
/^(?P>abc)[()](?<abc>)/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
Once
Recurse
Ket
[()]
- Bra 1
+ CBra 1
Ket
Ket
End
@@ -7583,15 +7628,15 @@ No match
/^((?(abc)y)[()](?P<abc>x))+/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
- Bra 1
+ CBra 1
Cond
2 Cond ref
y
Ket
[()]
- Bra 2
+ CBra 2
x
Ket
KetRmax
@@ -7605,13 +7650,13 @@ No match
/^(?P>abc)\Q()\E(?<abc>)/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
Once
Recurse
Ket
()
- Bra 1
+ CBra 1
Ket
Ket
End
@@ -7619,13 +7664,13 @@ No match
/^(?P>abc)[a\Q(]\E(](?<abc>)/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
Once
Recurse
Ket
[(\]a]
- Bra 1
+ CBra 1
Ket
Ket
End
@@ -7634,12 +7679,12 @@ No match
/^(?P>abc) # this is (a comment)
(?<abc>)/BZx
------------------------------------------------------------------
- Bra 0
+ Bra
^
Once
Recurse
Ket
- Bra 1
+ CBra 1
Ket
Ket
End
@@ -8064,16 +8109,16 @@ No match
2: b
/^(a)\g-2/
-Failed: reference to non-existent subpattern at offset 4
+Failed: reference to non-existent subpattern at offset 7
/^(a)\g/
-Failed: \g is not followed by a braced name or an optionally braced non-zero number at offset 4
+Failed: \g is not followed by a braced name or an optionally braced non-zero number at offset 5
/^(a)\g{0}/
-Failed: \g is not followed by a braced name or an optionally braced non-zero number at offset 4
+Failed: \g is not followed by a braced name or an optionally braced non-zero number at offset 7
/^(a)\g{3/
-Failed: \g is not followed by a braced name or an optionally braced non-zero number at offset 4
+Failed: \g is not followed by a braced name or an optionally braced non-zero number at offset 8
/^(a)\g{4a}/
Failed: reference to non-existent subpattern at offset 9
@@ -8172,8 +8217,8 @@ No match
/(ab|c)(?-1)/BZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
ab
Alt
c
@@ -8190,12 +8235,12 @@ No match
/xy(?+1)(abc)/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
xy
Once
Recurse
Ket
- Bra 1
+ CBra 1
abc
Ket
Ket
@@ -8223,10 +8268,10 @@ Failed: reference to non-existent subpattern at offset 5
/^(abc)?(?(-1)X|Y)/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
Brazero
- Bra 1
+ CBra 1
abc
Ket
Cond
@@ -8250,16 +8295,16 @@ No match
/^((?(+1)X|Y)(abc))+/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
- Bra 1
+ CBra 1
Cond
2 Cond ref
X
Alt
Y
Ket
- Bra 2
+ CBra 2
abc
Ket
KetRmax
@@ -8284,8 +8329,8 @@ Failed: reference to non-existent subpattern at offset 6
/((?(-1)a))/BZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
Cond
1 Cond ref
a
@@ -8300,7 +8345,7 @@ Failed: reference to non-existent subpattern at offset 7
/^(?(+1)X|Y)/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
Cond
1 Cond ref
@@ -8359,13 +8404,13 @@ Failed: syntax error in subpattern name (missing terminator) at offset 4
/(?|(abc)|(xyz))/BZ
------------------------------------------------------------------
- Bra 0
- Bra 0
- Bra 1
+ Bra
+ Bra
+ CBra 1
abc
Ket
Alt
- Bra 1
+ CBra 1
xyz
Ket
Ket
@@ -8381,20 +8426,20 @@ Failed: syntax error in subpattern name (missing terminator) at offset 4
/(x)(?|(abc)|(xyz))(x)/BZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
x
Ket
- Bra 0
- Bra 2
+ Bra
+ CBra 2
abc
Ket
Alt
- Bra 2
+ CBra 2
xyz
Ket
Ket
- Bra 3
+ CBra 3
x
Ket
Ket
@@ -8413,23 +8458,23 @@ Failed: syntax error in subpattern name (missing terminator) at offset 4
/(x)(?|(abc)(pqr)|(xyz))(x)/BZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
x
Ket
- Bra 0
- Bra 2
+ Bra
+ CBra 2
abc
Ket
- Bra 3
+ CBra 3
pqr
Ket
Alt
- Bra 2
+ CBra 2
xyz
Ket
Ket
- Bra 4
+ CBra 4
x
Ket
Ket
@@ -8526,7 +8571,7 @@ No match
/[\h]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09 \xa0]
Ket
End
@@ -8536,7 +8581,7 @@ No match
/[\h]+/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09 \xa0]+
Ket
End
@@ -8546,7 +8591,7 @@ No match
/[\v]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x0a-\x0d\x85]
Ket
End
@@ -8554,7 +8599,7 @@ No match
/[\H]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff]
Ket
End
@@ -8562,7 +8607,7 @@ No match
/[^\h]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff] (neg)
Ket
End
@@ -8570,7 +8615,7 @@ No match
/[\V]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x09\x0e-\x84\x86-\xff]
Ket
End
@@ -8578,7 +8623,7 @@ No match
/[\x0a\V]/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x0a\x0e-\x84\x86-\xff]
Ket
End
@@ -8586,7 +8631,7 @@ No match
/\H++X/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\H++
X
Ket
@@ -8599,7 +8644,7 @@ No match
/\H+\hY/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\H++
\h
Y
@@ -8611,7 +8656,7 @@ No match
/\H+ Y/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\H++
Y
Ket
@@ -8620,7 +8665,7 @@ No match
/\h+A/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\h++
A
Ket
@@ -8629,7 +8674,7 @@ No match
/\v*B/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\v*+
B
Ket
@@ -8638,7 +8683,7 @@ No match
/\V+\x0a/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\V++
\x0a
Ket
@@ -8647,7 +8692,7 @@ No match
/A+\h/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
A++
\h
Ket
@@ -8656,7 +8701,7 @@ No match
/ *\H/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
*+
\H
Ket
@@ -8665,7 +8710,7 @@ No match
/A*\v/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
A*+
\v
Ket
@@ -8674,7 +8719,7 @@ No match
/\x0b*\V/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x0b*+
\V
Ket
@@ -8683,7 +8728,7 @@ No match
/\d+\h/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d++
\h
Ket
@@ -8692,7 +8737,7 @@ No match
/\d*\v/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\d*+
\v
Ket
@@ -8701,7 +8746,7 @@ No match
/S+\h\S+\v/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
S++
\h
\S++
@@ -8712,7 +8757,7 @@ No match
/\w{3,}\h\w+\v/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\w{3}
\w*+
\h
@@ -8724,7 +8769,7 @@ No match
/\h+\d\h+\w\h+\S\h+\H/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\h++
\d
\h++
@@ -8739,7 +8784,7 @@ No match
/\v+\d\v+\w\v+\S\v+\V/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\v++
\d
\v++
@@ -8754,7 +8799,7 @@ No match
/\H+\h\H+\d/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\H++
\h
\H+
@@ -8765,7 +8810,7 @@ No match
/\V+\v\V+\w/BZ
------------------------------------------------------------------
- Bra 0
+ Bra
\V++
\v
\V+
@@ -8774,4 +8819,353 @@ No match
End
------------------------------------------------------------------
+/\( (?: [^()]* | (?R) )* \)/x
+(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)
+ 0: (0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)
+
+/[\E]AAA/
+Failed: missing terminating ] for character class at offset 7
+
+/[\Q\E]AAA/
+Failed: missing terminating ] for character class at offset 9
+
+/[^\E]AAA/
+Failed: missing terminating ] for character class at offset 8
+
+/[^\Q\E]AAA/
+Failed: missing terminating ] for character class at offset 10
+
+/[\E^]AAA/
+Failed: missing terminating ] for character class at offset 8
+
+/[\Q\E^]AAA/
+Failed: missing terminating ] for character class at offset 10
+
+/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/BZ
+------------------------------------------------------------------
+ Bra
+ A
+ *PRUNE
+ B
+ *SKIP
+ C
+ *THEN
+ D
+ *COMMIT
+ E
+ *FAIL
+ F
+ *FAIL
+ G
+ *FAIL
+ H
+ *ACCEPT
+ I
+ Ket
+ End
+------------------------------------------------------------------
+
+/^a+(*FAIL)/
+ aaaaaa
+No match
+
+/a+b?c+(*FAIL)/
+ aaabccc
+No match
+
+/a+b?(*PRUNE)c+(*FAIL)/
+ aaabccc
+No match
+
+/a+b?(*COMMIT)c+(*FAIL)/
+ aaabccc
+No match
+
+/a+b?(*SKIP)c+(*FAIL)/
+ aaabcccaaabccc
+No match
+
+/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+ aaaxxxxxx
+ 0: aaaxxxxxx
+ aaa++++++
+ 0: aaa
+ bbbxxxxx
+ 0: bbbxxxxx
+ bbb+++++
+ 0: bbb
+ cccxxxx
+ 0: cccxxxx
+ ccc++++
+ 0: ccc
+ dddddddd
+ 0: ddd
+
+/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
+ aaaxxxxxx
+ 0: aaaxxxxxx
+ 1: aaaxxxxxx
+ aaa++++++
+ 0: aaa
+ 1: aaa
+ bbbxxxxx
+ 0: bbbxxxxx
+ 1: bbbxxxxx
+ bbb+++++
+ 0: bbb
+ 1: bbb
+ cccxxxx
+ 0: cccxxxx
+ 1: cccxxxx
+ ccc++++
+ 0: ccc
+ 1: ccc
+ dddddddd
+ 0: ddd
+ 1: ddd
+
+/a+b?(*THEN)c+(*FAIL)/
+ aaabccc
+No match
+
+/(A (A|B(*ACCEPT)|C) D)(E)/x
+ ABX
+ 0: AB
+ AADE
+ 0: AADE
+ 1: AAD
+ 2: A
+ 3: E
+ ACDE
+ 0: ACDE
+ 1: ACD
+ 2: C
+ 3: E
+ ** Failers
+No match
+ AD
+No match
+
+/^a+(*FAIL)/C
+ aaaaaa
+--->aaaaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ (*FAIL)
+ +3 ^ ^ (*FAIL)
+ +3 ^ ^ (*FAIL)
+ +3 ^ ^ (*FAIL)
+ +3 ^ ^ (*FAIL)
+ +3 ^^ (*FAIL)
+No match
+
+/a+b?c+(*FAIL)/C
+ aaabccc
+--->aaabccc
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ c+
+ +6 ^ ^ (*FAIL)
+ +6 ^ ^ (*FAIL)
+ +6 ^ ^ (*FAIL)
+ +4 ^ ^ c+
+ +2 ^ ^ b?
+ +4 ^ ^ c+
+ +2 ^^ b?
+ +4 ^^ c+
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ c+
+ +6 ^ ^ (*FAIL)
+ +6 ^ ^ (*FAIL)
+ +6 ^ ^ (*FAIL)
+ +4 ^ ^ c+
+ +2 ^^ b?
+ +4 ^^ c+
+ +0 ^ a+
+ +2 ^^ b?
+ +4 ^ ^ c+
+ +6 ^ ^ (*FAIL)
+ +6 ^ ^ (*FAIL)
+ +6 ^ ^ (*FAIL)
+ +4 ^^ c+
+No match
+
+/a+b?(*PRUNE)c+(*FAIL)/C
+ aaabccc
+--->aaabccc
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*PRUNE)
++12 ^ ^ c+
++14 ^ ^ (*FAIL)
++14 ^ ^ (*FAIL)
++14 ^ ^ (*FAIL)
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*PRUNE)
++12 ^ ^ c+
++14 ^ ^ (*FAIL)
++14 ^ ^ (*FAIL)
++14 ^ ^ (*FAIL)
+ +0 ^ a+
+ +2 ^^ b?
+ +4 ^ ^ (*PRUNE)
++12 ^ ^ c+
++14 ^ ^ (*FAIL)
++14 ^ ^ (*FAIL)
++14 ^ ^ (*FAIL)
+No match
+
+/a+b?(*COMMIT)c+(*FAIL)/C
+ aaabccc
+--->aaabccc
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*COMMIT)
++13 ^ ^ c+
++15 ^ ^ (*FAIL)
++15 ^ ^ (*FAIL)
++15 ^ ^ (*FAIL)
+No match
+
+/a+b?(*SKIP)c+(*FAIL)/C
+ aaabcccaaabccc
+--->aaabcccaaabccc
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*SKIP)
++11 ^ ^ c+
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*SKIP)
++11 ^ ^ c+
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
+No match
+
+/a+b?(*THEN)c+(*FAIL)/C
+ aaabccc
+--->aaabccc
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*THEN)
++11 ^ ^ c+
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
+ +0 ^ a+
+ +2 ^ ^ b?
+ +4 ^ ^ (*THEN)
++11 ^ ^ c+
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
+ +0 ^ a+
+ +2 ^^ b?
+ +4 ^ ^ (*THEN)
++11 ^ ^ c+
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
++13 ^ ^ (*FAIL)
+No match
+
+/a(*PRUNE:XXX)b/
+Failed: (*VERB) with an argument is not supported at offset 8
+
+/a(*MARK)b/
+Failed: (*VERB) not recognized at offset 7
+
+/(?i:A{1,}\6666666666)/
+Failed: number is too big at offset 19
+
+/\g6666666666/
+Failed: number is too big at offset 11
+
+/[\g6666666666]/
+Failed: number is too big at offset 12
+
+/(?1)\c[/
+Failed: reference to non-existent subpattern at offset 3
+
+/.+A/<crlf>
+ \r\nA
+No match
+
+/\nA/<crlf>
+ \r\nA
+ 0: \x0aA
+
+/[\r\n]A/<crlf>
+ \r\nA
+ 0: \x0aA
+
+/(\r|\n)A/<crlf>
+ \r\nA
+ 0: \x0aA
+ 1: \x0a
+
+/a(*CR)b/
+Failed: (*VERB) not recognized at offset 5
+
+/(*CR)a.b/
+ a\nb
+ 0: a\x0ab
+ ** Failers
+No match
+ a\rb
+No match
+
+/(*CR)a.b/<lf>
+ a\nb
+ 0: a\x0ab
+ ** Failers
+No match
+ a\rb
+No match
+
+/(*LF)a.b/<CRLF>
+ a\rb
+ 0: a\x0db
+ ** Failers
+No match
+ a\nb
+No match
+
+/(*CRLF)a.b/
+ a\rb
+ 0: a\x0db
+ a\nb
+ 0: a\x0ab
+ ** Failers
+No match
+ a\r\nb
+No match
+
+/(*ANYCRLF)a.b/<CR>
+ ** Failers
+No match
+ a\rb
+No match
+ a\nb
+No match
+ a\r\nb
+No match
+
+/(*ANY)a.b/<cr>
+ ** Failers
+No match
+ a\rb
+No match
+ a\nb
+No match
+ a\r\nb
+No match
+ a\x85b
+No match
+
/ End of testinput2 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput3 b/ext/pcre/pcrelib/testdata/testoutput3
index 839ae8a0d..28b1c3aaa 100644
--- a/ext/pcre/pcrelib/testdata/testoutput3
+++ b/ext/pcre/pcrelib/testdata/testoutput3
@@ -148,7 +148,7 @@ No match
/[[:alpha:]][[:lower:]][[:upper:]]/DZLfr_FR
------------------------------------------------------------------
- Bra 0
+ Bra
[A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
[a-z\xb5\xdf-\xf6\xf8-\xff]
[A-Z\xc0-\xd6\xd8-\xde]
diff --git a/ext/pcre/pcrelib/testdata/testoutput4 b/ext/pcre/pcrelib/testdata/testoutput4
index 966b28568..b49d4f98a 100644
--- a/ext/pcre/pcrelib/testdata/testoutput4
+++ b/ext/pcre/pcrelib/testdata/testoutput4
@@ -918,4 +918,24 @@ No match
a
0: a
+/\S\S/8g
+ A\x{a3}BC
+ 0: A\x{a3}
+ 0: BC
+
+/\S{2}/8g
+ A\x{a3}BC
+ 0: A\x{a3}
+ 0: BC
+
+/\W\W/8g
+ +\x{a3}==
+ 0: +\x{a3}
+ 0: ==
+
+/\W{2}/8g
+ +\x{a3}==
+ 0: +\x{a3}
+ 0: ==
+
/ End of testinput4 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput5 b/ext/pcre/pcrelib/testdata/testoutput5
index 1f0b2b124..2d9ee6949 100644
--- a/ext/pcre/pcrelib/testdata/testoutput5
+++ b/ext/pcre/pcrelib/testdata/testoutput5
@@ -1,6 +1,6 @@
/\x{100}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}
Ket
End
@@ -12,7 +12,7 @@ Need char = 128
/\x{1000}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{1000}
Ket
End
@@ -24,7 +24,7 @@ Need char = 128
/\x{10000}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{10000}
Ket
End
@@ -36,7 +36,7 @@ Need char = 128
/\x{100000}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100000}
Ket
End
@@ -48,7 +48,7 @@ Need char = 128
/\x{1000000}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{1000000}
Ket
End
@@ -60,7 +60,7 @@ Need char = 128
/\x{4000000}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{4000000}
Ket
End
@@ -72,7 +72,7 @@ Need char = 128
/\x{7fffFFFF}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{7fffffff}
Ket
End
@@ -84,7 +84,7 @@ Need char = 191
/[\x{ff}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{ff}
Ket
End
@@ -96,7 +96,7 @@ Need char = 191
/[\x{100}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x{100}]
Ket
End
@@ -118,7 +118,7 @@ Failed: character value in \x{...} sequence is too large at offset 12
/\x80/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{80}
Ket
End
@@ -130,7 +130,7 @@ Need char = 128
/\xff/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{ff}
Ket
End
@@ -142,7 +142,7 @@ Need char = 191
/\x{0041}\x{2262}\x{0391}\x{002e}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
A\x{2262}\x{391}.
Ket
End
@@ -156,7 +156,7 @@ Need char = '.'
/\x{D55c}\x{ad6d}\x{C5B4}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{d55c}\x{ad6d}\x{c5b4}
Ket
End
@@ -170,7 +170,7 @@ Need char = 180
/\x{65e5}\x{672c}\x{8a9e}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{65e5}\x{672c}\x{8a9e}
Ket
End
@@ -184,7 +184,7 @@ Need char = 158
/\x{80}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{80}
Ket
End
@@ -196,7 +196,7 @@ Need char = 128
/\x{084}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{84}
Ket
End
@@ -208,7 +208,7 @@ Need char = 132
/\x{104}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{104}
Ket
End
@@ -220,7 +220,7 @@ Need char = 132
/\x{861}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{861}
Ket
End
@@ -232,7 +232,7 @@ Need char = 161
/\x{212ab}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{212ab}
Ket
End
@@ -244,7 +244,7 @@ Need char = 171
/.{3,5}X/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
Any{3}
Any{0,2}
X
@@ -262,7 +262,7 @@ Need char = 'X'
/.{3,5}?/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
Any{3}
Any{0,2}?
Ket
@@ -334,7 +334,7 @@ can't tell the difference.) --/
/^[ab]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[ab]
Ket
@@ -357,13 +357,14 @@ No match
/^[^ab]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x00-`c-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: anchored utf8
No first char
No need char
@@ -380,12 +381,13 @@ No match
/[^ab\xC0-\xF0]/8SDZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-`c-\xbf\xf1-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: utf8
No first char
No need char
@@ -416,7 +418,7 @@ No match
/Ä€{3,4}/8SDZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}{3}
\x{100}?
Ket
@@ -433,8 +435,8 @@ Study returned NULL
/(\x{100}+|x)/8SDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
\x{100}+
Alt
x
@@ -451,8 +453,8 @@ Starting byte set: x \xc4
/(\x{100}*a|x)/8SDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
\x{100}*+
a
Alt
@@ -470,8 +472,8 @@ Starting byte set: a x \xc4
/(\x{100}{0,2}a|x)/8SDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
\x{100}{0,2}
a
Alt
@@ -489,8 +491,8 @@ Starting byte set: a x \xc4
/(\x{100}{1,2}a|x)/8SDZ
------------------------------------------------------------------
- Bra 0
- Bra 1
+ Bra
+ CBra 1
\x{100}
\x{100}{0,1}
a
@@ -533,7 +535,7 @@ No match
/\x{100}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}
Ket
End
@@ -545,7 +547,7 @@ Need char = 128
/\x{100}*/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*
Ket
End
@@ -558,7 +560,7 @@ No need char
/a\x{100}*/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
a
\x{100}*
Ket
@@ -572,7 +574,7 @@ No need char
/ab\x{100}*/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
ab
\x{100}*
Ket
@@ -586,7 +588,7 @@ Need char = 'b'
/a\x{100}\x{101}*/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
a\x{100}
\x{101}*
Ket
@@ -600,7 +602,7 @@ Need char = 128
/a\x{100}\x{101}+/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
a\x{100}
\x{101}+
Ket
@@ -614,7 +616,7 @@ Need char = 129
/\x{100}*A/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*+
A
Ket
@@ -630,7 +632,7 @@ Need char = 'A'
/\x{100}*\d(?R)/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*+
\d
Once
@@ -647,31 +649,33 @@ No need char
/[^\x{c4}]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[^\xc4]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
No first char
No need char
/[^\x{c4}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\xc3\xc5-\xff] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: utf8
No first char
No need char
/[\x{100}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x{100}]
Ket
End
@@ -691,7 +695,7 @@ No match
/[Z\x{100}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[Z\x{100}]
Ket
End
@@ -726,7 +730,7 @@ No match
/[z-\x{100}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[z-\x{100}]
Ket
End
@@ -738,7 +742,7 @@ No need char
/[z\Qa-d]Ä€\E]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\-\]adz\x{100}]
Ket
End
@@ -754,7 +758,7 @@ No need char
/[\xFF]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\xff
Ket
End
@@ -768,7 +772,7 @@ No need char
/[\xff]/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
\x{ff}
Ket
End
@@ -782,24 +786,26 @@ Need char = 191
/[^\xFF]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[^\xff]
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
No options
No first char
No need char
/[^\xff]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\xfe] (neg)
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+Contains explicit CR or LF match
Options: utf8
No first char
No need char
@@ -839,7 +845,7 @@ Failed: invalid UTF-8 string at offset 1
/ÃÃÃxxx/8?DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\X{c0}\X{c0}\X{c0}xxx
Ket
End
@@ -887,19 +893,27 @@ No match
\xf1\x8f\x80\x80
No match
\xf8\x88\x80\x80\x80
-No match
+Error -10
\xf9\x87\x80\x80\x80
-No match
+Error -10
\xfc\x84\x80\x80\x80\x80
-No match
+Error -10
\xfd\x83\x80\x80\x80\x80
+Error -10
+ \?\xf8\x88\x80\x80\x80
+No match
+ \?\xf9\x87\x80\x80\x80
+No match
+ \?\xfc\x84\x80\x80\x80\x80
+No match
+ \?\xfd\x83\x80\x80\x80\x80
No match
/\x{100}abc(xyz(?1))/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}abc
- Bra 1
+ CBra 1
xyz
Once
Recurse
@@ -915,10 +929,10 @@ Need char = 'z'
/[^\x{100}]abc(xyz(?1))/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[^\x{100}]
abc
- Bra 1
+ CBra 1
xyz
Once
Recurse
@@ -928,16 +942,17 @@ Need char = 'z'
End
------------------------------------------------------------------
Capturing subpattern count = 1
+Contains explicit CR or LF match
Options: utf8
No first char
Need char = 'z'
/[ab\x{100}]abc(xyz(?1))/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[ab\x{100}]
abc
- Bra 1
+ CBra 1
xyz
Once
Recurse
@@ -953,11 +968,11 @@ Need char = 'z'
/(\x{100}(b(?2)c))?/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 1
+ CBra 1
\x{100}
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -975,12 +990,12 @@ No need char
/(\x{100}(b(?2)c)){0,2}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 0
- Bra 1
+ Bra
+ CBra 1
\x{100}
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -989,9 +1004,9 @@ No need char
Ket
Ket
Brazero
- Bra 1
+ CBra 1
\x{100}
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -1010,11 +1025,11 @@ No need char
/(\x{100}(b(?1)c))?/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 1
+ CBra 1
\x{100}
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -1032,12 +1047,12 @@ No need char
/(\x{100}(b(?1)c)){0,2}/DZ8
------------------------------------------------------------------
- Bra 0
+ Bra
Brazero
- Bra 0
- Bra 1
+ Bra
+ CBra 1
\x{100}
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -1046,9 +1061,9 @@ No need char
Ket
Ket
Brazero
- Bra 1
+ CBra 1
\x{100}
- Bra 2
+ CBra 2
b
Once
Recurse
@@ -1081,7 +1096,7 @@ No need char
/^\ሴ/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
^
\x{1234}
Ket
@@ -1107,7 +1122,7 @@ Need char = 191
/\x{100}*\d/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*+
\d
Ket
@@ -1121,7 +1136,7 @@ No need char
/\x{100}*\s/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*+
\s
Ket
@@ -1135,7 +1150,7 @@ No need char
/\x{100}*\w/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*+
\w
Ket
@@ -1149,7 +1164,7 @@ No need char
/\x{100}*\D/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*
\D
Ket
@@ -1163,7 +1178,7 @@ No need char
/\x{100}*\S/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*
\S
Ket
@@ -1177,7 +1192,7 @@ No need char
/\x{100}*\W/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}*
\W
Ket
@@ -1191,7 +1206,7 @@ No need char
/\x{100}+\x{200}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}++
\x{200}
Ket
@@ -1205,7 +1220,7 @@ Need char = 128
/\x{100}+X/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
\x{100}++
X
Ket
@@ -1219,7 +1234,7 @@ Need char = 'X'
/X+\x{200}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
X++
\x{200}
Ket
@@ -1256,7 +1271,7 @@ Matched, but too many substrings
/^[\x{100}\E-\Q\E\x{150}]/BZ8
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x{100}-\x{150}]
Ket
@@ -1265,7 +1280,7 @@ Matched, but too many substrings
/^[\QÄ€\E-\QÅ\E]/BZ8
------------------------------------------------------------------
- Bra 0
+ Bra
^
[\x{100}-\x{150}]
Ket
@@ -1431,7 +1446,7 @@ No match
/[\h]/8BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]
Ket
End
@@ -1441,7 +1456,7 @@ No match
/[\h]{3,}/8BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]{3,}
Ket
End
@@ -1451,7 +1466,7 @@ No match
/[\v]/8BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x0a-\x0d\x85\x{2028}-\x{2029}]
Ket
End
@@ -1459,7 +1474,7 @@ No match
/[\H]/8BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff\x{100}-\x{167f}\x{1681}-\x{180d}\x{180f}-\x{1fff}\x{200b}-\x{202e}\x{2030}-\x{205e}\x{2060}-\x{2fff}\x{3001}-\x{7fffffff}]
Ket
End
@@ -1467,10 +1482,44 @@ No match
/[\V]/8BZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x00-\x09\x0e-\x84\x86-\xff\x{100}-\x{2027}\x{2029}-\x{7fffffff}]
Ket
End
------------------------------------------------------------------
+/.*$/8<any>
+ \x{1ec5}
+ 0: \x{1ec5}
+
+/-- This tests the stricter UTF-8 check according to RFC 3629. --/
+
+/X/8
+ \x{0}\x{d7ff}\x{e000}\x{10ffff}
+No match
+ \x{d800}
+Error -10
+ \x{d800}\?
+No match
+ \x{da00}
+Error -10
+ \x{da00}\?
+No match
+ \x{dfff}
+Error -10
+ \x{dfff}\?
+No match
+ \x{110000}
+Error -10
+ \x{110000}\?
+No match
+ \x{2000000}
+Error -10
+ \x{2000000}\?
+No match
+ \x{7fffffff}
+Error -10
+ \x{7fffffff}\?
+No match
+
/ End of testinput5 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput6 b/ext/pcre/pcrelib/testdata/testoutput6
index 776eed4e5..0a58b844f 100644
--- a/ext/pcre/pcrelib/testdata/testoutput6
+++ b/ext/pcre/pcrelib/testdata/testoutput6
@@ -99,7 +99,7 @@ No match
No match
/^\p{Cs}/8
- \x{dfff}
+ \?\x{dfff}
0: \x{dfff}
** Failers
No match
@@ -113,7 +113,7 @@ No match
No match
Z
No match
- \x{dfff}
+ \x{e000}
No match
/^\p{Lm}/8
@@ -550,7 +550,7 @@ No match
/[\p{L}]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\p{L}]
Ket
End
@@ -562,7 +562,7 @@ No need char
/[\p{^L}]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\P{L}]
Ket
End
@@ -574,7 +574,7 @@ No need char
/[\P{L}]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\P{L}]
Ket
End
@@ -586,7 +586,7 @@ No need char
/[\P{^L}]/DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\p{L}]
Ket
End
@@ -598,7 +598,7 @@ No need char
/[abc\p{L}\x{0660}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[a-c\p{L}\x{660}]
Ket
End
@@ -610,7 +610,7 @@ No need char
/[\p{Nd}]/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\p{Nd}]
Ket
End
@@ -624,7 +624,7 @@ No need char
/[\p{Nd}+-]+/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
[+\-\p{Nd}]+
Ket
End
@@ -779,7 +779,7 @@ No match
/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iDZ
------------------------------------------------------------------
- Bra 0
+ Bra
NC A\x{391}\x{10427}\x{ff3a}\x{1fb0}
Ket
End
@@ -791,7 +791,7 @@ No need char
/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
A\x{391}\x{10427}\x{ff3a}\x{1fb0}
Ket
End
@@ -803,7 +803,7 @@ Need char = 176
/AB\x{1fb0}/8DZ
------------------------------------------------------------------
- Bra 0
+ Bra
AB\x{1fb0}
Ket
End
@@ -815,7 +815,7 @@ Need char = 176
/AB\x{1fb0}/8DZi
------------------------------------------------------------------
- Bra 0
+ Bra
NC AB\x{1fb0}
Ket
End
@@ -857,7 +857,7 @@ Need char = 'B' (caseless)
/[\x{105}-\x{109}]/8iDZ
------------------------------------------------------------------
- Bra 0
+ Bra
[\x{104}-\x{109}]
Ket
End
@@ -881,7 +881,7 @@ No match
/[z-\x{100}]/8iDZ
------------------------------------------------------------------
- Bra 0
+ Bra
[Z\x{39c}\x{178}z-\x{101}]
Ket
End
@@ -919,7 +919,7 @@ No match
/[z-\x{100}]/8DZi
------------------------------------------------------------------
- Bra 0
+ Bra
[Z\x{39c}\x{178}z-\x{101}]
Ket
End
@@ -1452,4 +1452,74 @@ was broken in all cases./
123abc\xc4\xc5zz
0: abc\xc4
+/\X{1,3}\d/
+ \x8aBCD
+No match
+
+/\X?\d/
+ \x8aBCD
+No match
+
+/\P{L}?\d/
+ \x8aBCD
+No match
+
+/[\PPP\x8a]{1,}\x80/
+ A\x80
+ 0: A\x80
+
+/(?:[\PPa*]*){8,}/
+
+/[\P{Any}]/BZ
+------------------------------------------------------------------
+ Bra
+ [\P{Any}]
+ Ket
+ End
+------------------------------------------------------------------
+
+/[\P{Any}\E]/BZ
+------------------------------------------------------------------
+ Bra
+ [\P{Any}]
+ Ket
+ End
+------------------------------------------------------------------
+
+/(\P{Yi}+\277)/
+
+/(\P{Yi}+\277)?/
+
+/(?<=\P{Yi}{3}A)X/
+
+/\p{Yi}+(\P{Yi}+)(?1)/
+
+/(\P{Yi}{2}\277)?/
+
+/[\P{Yi}A]/
+
+/[\P{Yi}\P{Yi}\P{Yi}A]/
+
+/[^\P{Yi}A]/
+
+/[^\P{Yi}\P{Yi}\P{Yi}A]/
+
+/(\P{Yi}*\277)*/
+
+/(\P{Yi}*?\277)*/
+
+/(\p{Yi}*+\277)*/
+
+/(\P{Yi}?\277)*/
+
+/(\P{Yi}??\277)*/
+
+/(\p{Yi}?+\277)*/
+
+/(\P{Yi}{0,3}\277)*/
+
+/(\P{Yi}{0,3}?\277)*/
+
+/(\p{Yi}{0,3}+\277)*/
+
/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput7 b/ext/pcre/pcrelib/testdata/testoutput7
index a77186dbd..39c50750e 100644
--- a/ext/pcre/pcrelib/testdata/testoutput7
+++ b/ext/pcre/pcrelib/testdata/testoutput7
@@ -7072,4 +7072,20 @@ No match
>\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
+/.+A/<crlf>
+ \r\nA
+No match
+
+/\nA/<crlf>
+ \r\nA
+ 0: \x0aA
+
+/[\r\n]A/<crlf>
+ \r\nA
+ 0: \x0aA
+
+/(\r|\n)A/<crlf>
+ \r\nA
+ 0: \x0aA
+
/ End of testinput7 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput9 b/ext/pcre/pcrelib/testdata/testoutput9
index bc5f0e71a..acaeb398d 100644
--- a/ext/pcre/pcrelib/testdata/testoutput9
+++ b/ext/pcre/pcrelib/testdata/testoutput9
@@ -271,7 +271,7 @@ No match
No match
/^\p{Cs}/8
- \x{dfff}
+ \?\x{dfff}
0: \x{dfff}
** Failers
No match
@@ -285,7 +285,7 @@ No match
No match
Z
No match
- \x{dfff}
+ \x{e000}
No match
/^\p{Lm}/8
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index e7f41fa2b..2cf8ed3a1 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -16,11 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.c,v 1.168.2.9.2.19 2007/07/24 22:35:18 tony2001 Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* $Id: php_pcre.c,v 1.168.2.9.2.21 2007/09/20 08:10:44 tony2001 Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -1224,8 +1220,11 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
efree(subject_value);
subject_value = result;
subject_len = *result_len;
+ } else {
+ efree(subject_value);
+ return NULL;
}
-
+
zend_hash_move_forward(Z_ARRVAL_P(regex));
}
diff --git a/ext/pcre/tests/006.phpt b/ext/pcre/tests/006.phpt
new file mode 100644
index 000000000..d1282bf42
--- /dev/null
+++ b/ext/pcre/tests/006.phpt
@@ -0,0 +1,22 @@
+--TEST--
+preg_replace() with array of failing regular expressions
+--FILE--
+<?php
+
+$text = '[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]';
+$result = preg_replace(array('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU'), '', $text);
+var_dump($text);
+var_dump($result);
+
+$result = preg_replace('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '', $text);
+var_dump($text);
+var_dump($result);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(58) "[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]"
+NULL
+string(58) "[CODE]&lt;td align=&quot;$stylevar[right]&quot;&gt;[/CODE]"
+NULL
+Done
diff --git a/ext/pcre/tests/bug42298.phpt b/ext/pcre/tests/bug42298.phpt
new file mode 100644
index 000000000..156f35677
--- /dev/null
+++ b/ext/pcre/tests/bug42298.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Bug #42298 (pcre gives bogus results with /u)
+--FILE--
+<?php
+$str = "A\xc2\xa3BC";
+preg_match_all('/\S\S/u', $str, $m); var_dump($m);
+preg_match_all('/\S{2}/u', $str, $m); var_dump($m);
+
+$str = "A\xe2\x82\xac ";
+preg_match_all('/\W\W/u', $str, $m); var_dump($m);
+preg_match_all('/\W{2}/u', $str, $m); var_dump($m);
+
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "A£"
+ [1]=>
+ string(2) "BC"
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "A£"
+ [1]=>
+ string(2) "BC"
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(4) "€ "
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(4) "€ "
+ }
+}
diff --git a/ext/pcre/upgrade-pcre.php b/ext/pcre/upgrade-pcre.php
index 2f7202e0f..dd0a8a783 100644
--- a/ext/pcre/upgrade-pcre.php
+++ b/ext/pcre/upgrade-pcre.php
@@ -33,10 +33,13 @@ function recurse($path)
{
global $newpcre, $dirlen;
- foreach(scandir($path) as $file) {
+ foreach (scandir($path) as $file) {
- if ($file[0] === '.' || $file === 'CVS') continue;
- if (substr_compare($file, '.lo', -3, 3) == 0 || substr_compare($file, '.o', -2, 2) == 0) continue;
+ if ($file[0] === '.' ||
+ $file === 'CVS' ||
+ substr_compare($file, '.lo', -3, 3) == 0 ||
+ substr_compare($file, '.loT', -4, 4) == 0 ||
+ substr_compare($file, '.o', -2, 2) == 0) continue;
$file = "$path/$file";
@@ -58,7 +61,19 @@ function recurse($path)
die("$newfile is not available any more\n");
}
- copy($newfile, $file);
+ // maintain file mtimes so that cvs doesnt get crazy
+ if (file_get_contents($newfile) !== file_get_contents($file)) {
+ copy($newfile, $file);
+ }
+
+ // always include the config.h file
+ $content = file_get_contents($newfile);
+ $newcontent = preg_replace('/#\s*ifdef HAVE_CONFIG_H\s*(.+)\s*#\s*endif/', '$1', $content);
+
+ if ($content !== $newcontent) {
+ file_put_contents($file, $newcontent);
+ }
+
echo "OK\n";
}
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index af9c15472..e3d49f3c9 100755
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dbh.c,v 1.82.2.31.2.15 2007/07/16 18:00:18 iliaa Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.31.2.17 2007/09/12 18:26:49 iliaa Exp $ */
/* The PDO Database Handle Class */
@@ -1130,20 +1130,50 @@ static PHP_METHOD(PDO, getAvailableDrivers)
}
/* }}} */
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo___construct, 0, 0, 3)
+ ZEND_ARG_INFO(0, dsn)
+ ZEND_ARG_INFO(0, username)
+ ZEND_ARG_INFO(0, passwd)
+ ZEND_ARG_INFO(0, options) /* array */
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo_prepare, 0, 0, 1)
+ ZEND_ARG_INFO(0, statment)
+ ZEND_ARG_INFO(0, options) /* array */
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_pdo_setattribute, 0)
+ ZEND_ARG_INFO(0, attribute)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_pdo_getattribute, 0)
+ ZEND_ARG_INFO(0, attribute)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_pdo_exec, 0)
+ ZEND_ARG_INFO(0, query)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo_lastinsertid, 0, 0, 0)
+ ZEND_ARG_INFO(0, seqname)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo_quote, 0, 0, 1)
+ ZEND_ARG_INFO(0, string)
+ ZEND_ARG_INFO(0, paramtype)
+ZEND_END_ARG_INFO()
+/* }}} */
+
zend_function_entry pdo_dbh_functions[] = {
- ZEND_MALIAS(PDO, __construct, dbh_constructor, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, prepare, NULL, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(PDO, __construct, dbh_constructor, arginfo_pdo___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, prepare, arginfo_pdo_prepare, ZEND_ACC_PUBLIC)
PHP_ME(PDO, beginTransaction, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDO, commit, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDO, rollBack, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, setAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, exec, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, setAttribute, arginfo_pdo_setattribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, exec, arginfo_pdo_exec, ZEND_ACC_PUBLIC)
PHP_ME(PDO, query, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, lastInsertId, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, lastInsertId, arginfo_pdo_lastinsertid, ZEND_ACC_PUBLIC)
PHP_ME(PDO, errorCode, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDO, errorInfo, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, getAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, quote, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, getAttribute, arginfo_pdo_getattribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, quote, arginfo_pdo_quote, ZEND_ACC_PUBLIC)
PHP_ME(PDO, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(PDO, __sleep, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(PDO, getAvailableDrivers, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
@@ -1423,12 +1453,6 @@ static void dbh_free(pdo_dbh_t *dbh TSRMLS_DC)
}
}
- if (dbh->properties) {
- zend_hash_destroy(dbh->properties);
- efree(dbh->properties);
- dbh->properties = NULL;
- }
-
pefree(dbh, dbh->is_persistent);
}
@@ -1448,6 +1472,12 @@ static void pdo_dbh_free_storage(pdo_dbh_t *dbh TSRMLS_DC)
dbh->methods->rollback(dbh TSRMLS_CC);
dbh->in_txn = 0;
}
+
+ if (dbh->properties) {
+ zend_hash_destroy(dbh->properties);
+ efree(dbh->properties);
+ dbh->properties = NULL;
+ }
if (!dbh->is_persistent) {
dbh_free(dbh TSRMLS_CC);
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index f611f10a8..4aaa8973a 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.11.0 on Tue Jun 5 18:45:24 2007 */
+/* Generated by re2c 0.11.0 on Mon Oct 29 18:36:37 2007 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.12 2007/06/05 22:55:26 iliaa Exp $ */
+/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.13 2007/10/29 22:37:25 iliaa Exp $ */
#include "php.h"
#include "php_pdo_driver.h"
@@ -48,125 +48,233 @@ static int scan(Scanner *s)
s->tok = cursor;
- {
- static unsigned char yybm[] = {
- 192, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 64, 200, 200, 200, 200, 128,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 208, 200, 200, 200, 200, 208,
- 200, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 200, 200, 200, 200, 232,
- 200, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- };
-
- {
- YYCTYPE yych;
-
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 8) {
- goto yy8;
- }
- if(yych <= 0x00) goto yy11;
- if(yych <= '&') goto yy2;
- if(yych <= '\'') goto yy4;
- if(yych <= '>') goto yy5;
- goto yy6;
+
+{
+ YYCTYPE yych;
+
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case 0x00: goto yy11;
+ case '"': goto yy2;
+ case '\'': goto yy4;
+ case ':': goto yy5;
+ case '?': goto yy6;
+ default: goto yy8;
+ }
yy2:
- yych = *++YYCURSOR;
- goto yy24;
+ yych = *++YYCURSOR;
+ goto yy24;
yy3:
- { SKIP_ONE(PDO_PARSER_TEXT); }
+ { SKIP_ONE(PDO_PARSER_TEXT); }
yy4:
- yych = *++YYCURSOR;
- goto yy20;
+ yych = *++YYCURSOR;
+ goto yy20;
yy5:
- yych = *++YYCURSOR;
- if(yybm[0+yych] & 32) {
- goto yy16;
- }
- if(yych == ':') goto yy13;
- if(yych == '?') goto yy13;
- goto yy3;
+ yych = *++YYCURSOR;
+ switch(yych) {
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy16;
+ case ':':
+ case '?': goto yy13;
+ default: goto yy3;
+ }
yy6:
- ++YYCURSOR;
- if(yybm[0+(yych = *YYCURSOR)] & 16) {
- goto yy13;
- }
- { RET(PDO_PARSER_BIND_POS); }
+ ++YYCURSOR;
+ switch((yych = *YYCURSOR)) {
+ case ':':
+ case '?': goto yy13;
+ default: goto yy7;
+ }
+yy7:
+ { RET(PDO_PARSER_BIND_POS); }
yy8:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 8) {
- goto yy8;
- }
- { RET(PDO_PARSER_TEXT); }
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case 0x00:
+ case '"':
+ case '\'':
+ case ':':
+ case '?': goto yy10;
+ default: goto yy8;
+ }
+yy10:
+ { RET(PDO_PARSER_TEXT); }
yy11:
- ++YYCURSOR;
- { RET(PDO_PARSER_EOI); }
+ ++YYCURSOR;
+ { RET(PDO_PARSER_EOI); }
yy13:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 16) {
- goto yy13;
- }
- { RET(PDO_PARSER_TEXT); }
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case ':':
+ case '?': goto yy13;
+ default: goto yy15;
+ }
+yy15:
+ { RET(PDO_PARSER_TEXT); }
yy16:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 32) {
- goto yy16;
- }
- { RET(PDO_PARSER_BIND); }
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy16;
+ default: goto yy18;
+ }
+yy18:
+ { RET(PDO_PARSER_BIND); }
yy19:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
yy20:
- if(yybm[0+yych] & 64) {
- goto yy19;
- }
- ++YYCURSOR;
- { RET(PDO_PARSER_TEXT); }
+ switch(yych) {
+ case '\'': goto yy21;
+ default: goto yy19;
+ }
+yy21:
+ ++YYCURSOR;
+ { RET(PDO_PARSER_TEXT); }
yy23:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
yy24:
- if(yybm[0+yych] & 128) {
- goto yy23;
- }
- ++YYCURSOR;
- { RET(PDO_PARSER_TEXT); }
+ switch(yych) {
+ case '"': goto yy25;
+ default: goto yy23;
}
+yy25:
+ ++YYCURSOR;
+ { RET(PDO_PARSER_TEXT); }
}
}
diff --git a/ext/pdo/pdo_sql_parser.c.orig b/ext/pdo/pdo_sql_parser.c.orig
index 29555f6f9..9b537680c 100644
--- a/ext/pdo/pdo_sql_parser.c.orig
+++ b/ext/pdo/pdo_sql_parser.c.orig
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.11.0 on Tue Jun 5 18:45:24 2007 */
+/* Generated by re2c 0.11.0 on Mon Oct 29 18:36:37 2007 */
#line 1 "ext/pdo/pdo_sql_parser.re"
/*
+----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.12 2007/06/05 22:55:26 iliaa Exp $ */
+/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.13 2007/10/29 22:37:25 iliaa Exp $ */
#include "php.h"
#include "php_pdo_driver.h"
@@ -50,142 +50,250 @@ static int scan(Scanner *s)
#line 55 "ext/pdo/pdo_sql_parser.re"
- {
- static unsigned char yybm[] = {
- 192, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 64, 200, 200, 200, 200, 128,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 208, 200, 200, 200, 200, 208,
- 200, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 200, 200, 200, 200, 232,
- 200, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200,
- };
-
-#line 90 "ext/pdo/pdo_sql_parser.c"
- {
- YYCTYPE yych;
-
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 8) {
- goto yy8;
- }
- if(yych <= 0x00) goto yy11;
- if(yych <= '&') goto yy2;
- if(yych <= '\'') goto yy4;
- if(yych <= '>') goto yy5;
- goto yy6;
+
+#line 55 "ext/pdo/pdo_sql_parser.c"
+{
+ YYCTYPE yych;
+
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case 0x00: goto yy11;
+ case '"': goto yy2;
+ case '\'': goto yy4;
+ case ':': goto yy5;
+ case '?': goto yy6;
+ default: goto yy8;
+ }
yy2:
- yych = *++YYCURSOR;
- goto yy24;
+ yych = *++YYCURSOR;
+ goto yy24;
yy3:
#line 63 "ext/pdo/pdo_sql_parser.re"
- { SKIP_ONE(PDO_PARSER_TEXT); }
-#line 110 "ext/pdo/pdo_sql_parser.c"
+ { SKIP_ONE(PDO_PARSER_TEXT); }
+#line 75 "ext/pdo/pdo_sql_parser.c"
yy4:
- yych = *++YYCURSOR;
- goto yy20;
+ yych = *++YYCURSOR;
+ goto yy20;
yy5:
- yych = *++YYCURSOR;
- if(yybm[0+yych] & 32) {
- goto yy16;
- }
- if(yych == ':') goto yy13;
- if(yych == '?') goto yy13;
- goto yy3;
+ yych = *++YYCURSOR;
+ switch(yych) {
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy16;
+ case ':':
+ case '?': goto yy13;
+ default: goto yy3;
+ }
yy6:
- ++YYCURSOR;
- if(yybm[0+(yych = *YYCURSOR)] & 16) {
- goto yy13;
- }
+ ++YYCURSOR;
+ switch((yych = *YYCURSOR)) {
+ case ':':
+ case '?': goto yy13;
+ default: goto yy7;
+ }
+yy7:
#line 62 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_BIND_POS); }
-#line 129 "ext/pdo/pdo_sql_parser.c"
+ { RET(PDO_PARSER_BIND_POS); }
+#line 160 "ext/pdo/pdo_sql_parser.c"
yy8:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 8) {
- goto yy8;
- }
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case 0x00:
+ case '"':
+ case '\'':
+ case ':':
+ case '?': goto yy10;
+ default: goto yy8;
+ }
+yy10:
#line 64 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_TEXT); }
-#line 139 "ext/pdo/pdo_sql_parser.c"
+ { RET(PDO_PARSER_TEXT); }
+#line 176 "ext/pdo/pdo_sql_parser.c"
yy11:
- ++YYCURSOR;
+ ++YYCURSOR;
#line 65 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_EOI); }
-#line 144 "ext/pdo/pdo_sql_parser.c"
+ { RET(PDO_PARSER_EOI); }
+#line 181 "ext/pdo/pdo_sql_parser.c"
yy13:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 16) {
- goto yy13;
- }
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case ':':
+ case '?': goto yy13;
+ default: goto yy15;
+ }
+yy15:
#line 60 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_TEXT); }
-#line 154 "ext/pdo/pdo_sql_parser.c"
+ { RET(PDO_PARSER_TEXT); }
+#line 194 "ext/pdo/pdo_sql_parser.c"
yy16:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 32) {
- goto yy16;
- }
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch(yych) {
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy16;
+ default: goto yy18;
+ }
+yy18:
#line 61 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_BIND); }
-#line 164 "ext/pdo/pdo_sql_parser.c"
+ { RET(PDO_PARSER_BIND); }
+#line 269 "ext/pdo/pdo_sql_parser.c"
yy19:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
yy20:
- if(yybm[0+yych] & 64) {
- goto yy19;
- }
- ++YYCURSOR;
+ switch(yych) {
+ case '\'': goto yy21;
+ default: goto yy19;
+ }
+yy21:
+ ++YYCURSOR;
#line 59 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_TEXT); }
-#line 176 "ext/pdo/pdo_sql_parser.c"
+ { RET(PDO_PARSER_TEXT); }
+#line 283 "ext/pdo/pdo_sql_parser.c"
yy23:
- ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
+ ++YYCURSOR;
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
yy24:
- if(yybm[0+yych] & 128) {
- goto yy23;
- }
- ++YYCURSOR;
-#line 58 "ext/pdo/pdo_sql_parser.re"
- { RET(PDO_PARSER_TEXT); }
-#line 188 "ext/pdo/pdo_sql_parser.c"
+ switch(yych) {
+ case '"': goto yy25;
+ default: goto yy23;
}
+yy25:
+ ++YYCURSOR;
+#line 58 "ext/pdo/pdo_sql_parser.re"
+ { RET(PDO_PARSER_TEXT); }
+#line 297 "ext/pdo/pdo_sql_parser.c"
}
#line 66 "ext/pdo/pdo_sql_parser.re"
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 0dae474d2..5f957bc24 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_sql_parser.re,v 1.28.2.4.2.9 2007/06/05 22:55:26 iliaa Exp $ */
+/* $Id: pdo_sql_parser.re,v 1.28.2.4.2.10 2007/10/29 22:37:25 iliaa Exp $ */
#include "php.h"
#include "php_pdo_driver.h"
@@ -46,7 +46,7 @@ static int scan(Scanner *s)
s->tok = cursor;
/*!re2c
- BINDCHR = [:][a-zA-Z0-9_]+;
+ BINDCHR = [:][a-zA-Z0-9_-]+;
QUESTION = [?];
SPECIALS = [:?"'];
MULTICHAR = [:?];
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 1e129a5df..3e85321b7 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.22 2007/07/31 22:48:42 iliaa Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.26 2007/10/31 12:58:24 iliaa Exp $ */
/* The PDO Statement Handle Class */
@@ -37,37 +37,61 @@
#include "zend_interfaces.h"
#include "php_memory_streams.h"
-#if COMPILE_DL_PDO
-/* {{{ content from zend_arg_defs.c:
- * since it is a .c file, it won't be installed for use by PECL extensions, so we include it here. */
-ZEND_BEGIN_ARG_INFO(first_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(1)
+/* {{{ arginfo */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_execute, 0, 0, 0)
+ ZEND_ARG_INFO(0, bound_input_params) /* array */
ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(second_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetch, 0, 0, 0)
+ ZEND_ARG_INFO(0, how)
+ ZEND_ARG_INFO(0, orientation)
+ ZEND_ARG_INFO(0, offset)
ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(third_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetchobject, 0, 0, 1)
+ ZEND_ARG_INFO(0, class_name)
+ ZEND_ARG_INFO(0, ctor_args) /* array */
ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetchcolumn, 0, 0, 0)
+ ZEND_ARG_INFO(0, column_number)
ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(all_args_by_ref, 1)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetchall, 0, 0, 0)
+ ZEND_ARG_INFO(0, how)
+ ZEND_ARG_INFO(0, class_name)
+ ZEND_ARG_INFO(0, ctor_args) /* array */
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_bindvalue, 0, 0, 2)
+ ZEND_ARG_INFO(0, paramno)
+ ZEND_ARG_INFO(0, param)
+ ZEND_ARG_INFO(0, type)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_bindparam, 0, 0, 2)
+ ZEND_ARG_INFO(0, paramno)
+ ZEND_ARG_INFO(1, param)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, maxlen)
+ ZEND_ARG_INFO(0, driverdata)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_bindcolumn, 0, 0, 2)
+ ZEND_ARG_INFO(0, column)
+ ZEND_ARG_INFO(1, param)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, maxlen)
+ ZEND_ARG_INFO(0, driverdata)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_pdostatement_setattribute, 0)
+ ZEND_ARG_INFO(0, attribute)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_pdostatement_getattribute, 0)
+ ZEND_ARG_INFO(0, attribute)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_pdostatement_getcolumnmeta, 0)
+ ZEND_ARG_INFO(0, column)
+ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_setfetchmode, 0, 0, 1)
+ ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_INFO(0, params)
ZEND_END_ARG_INFO()
/* }}} */
-#endif
#define PHP_STMT_GET_OBJ \
pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC); \
@@ -545,7 +569,11 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
char *buf = NULL;
size_t len;
len = php_stream_copy_to_mem((php_stream*)value, &buf, PHP_STREAM_COPY_ALL, 0);
- ZVAL_STRINGL(dest, buf, len, 0);
+ if(buf == NULL) {
+ ZVAL_EMPTY_STRING(dest);
+ } else {
+ ZVAL_STRINGL(dest, buf, len, 0);
+ }
php_stream_close((php_stream*)value);
} else {
php_stream_to_zval((php_stream*)value, dest);
@@ -1232,7 +1260,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
}
/* }}} */
-static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, int mode, int fetch_all TSRMLS_DC) /* {{{ */
+static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, long mode, int fetch_all TSRMLS_DC) /* {{{ */
{
int flags = mode & PDO_FETCH_FLAGS;
@@ -1518,10 +1546,16 @@ static PHP_METHOD(PDOStatement, fetchAll)
}
}
+ if ((how & ~PDO_FETCH_FLAGS) == PDO_FETCH_USE_DEFAULT) {
+ how |= stmt->default_fetch_type & ~PDO_FETCH_FLAGS;
+ }
+
if (!error) {
PDO_STMT_CLEAR_ERR();
MAKE_STD_ZVAL(data);
- if ((how & PDO_FETCH_GROUP) || how == PDO_FETCH_KEY_PAIR) {
+ if ( (how & PDO_FETCH_GROUP) || how == PDO_FETCH_KEY_PAIR ||
+ (how == PDO_FETCH_USE_DEFAULT && stmt->default_fetch_type == PDO_FETCH_KEY_PAIR)
+ ) {
array_init(return_value);
return_all = return_value;
} else {
@@ -1537,7 +1571,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
do {
MAKE_STD_ZVAL(data);
} while (do_fetch(stmt, TRUE, data, how, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC));
- } else if (how == PDO_FETCH_KEY_PAIR) {
+ } else if (how == PDO_FETCH_KEY_PAIR || (how == PDO_FETCH_USE_DEFAULT && stmt->default_fetch_type == PDO_FETCH_KEY_PAIR)) {
while (do_fetch(stmt, TRUE, data, how, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC));
} else {
array_init(return_value);
@@ -1888,6 +1922,7 @@ fail_out:
case PDO_FETCH_OBJ:
case PDO_FETCH_BOUND:
case PDO_FETCH_NAMED:
+ case PDO_FETCH_KEY_PAIR:
break;
case PDO_FETCH_COLUMN:
@@ -2120,22 +2155,22 @@ static PHP_METHOD(PDOStatement, __sleep)
/* }}} */
zend_function_entry pdo_dbstmt_functions[] = {
- PHP_ME(PDOStatement, execute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetch, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindParam, second_arg_force_ref, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindColumn, second_arg_force_ref, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindValue, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, execute, arginfo_pdostatement_execute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetch, arginfo_pdostatement_fetch, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, bindParam, arginfo_pdostatement_bindparam, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, bindColumn, arginfo_pdostatement_bindcolumn, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, bindValue, arginfo_pdostatement_bindvalue, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, rowCount, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchColumn, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchAll, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchObject, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetchColumn, arginfo_pdostatement_fetchcolumn, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetchAll, arginfo_pdostatement_fetchall, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetchObject, arginfo_pdostatement_fetchobject, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, errorCode, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, errorInfo, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, setAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, getAttribute, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, setAttribute, arginfo_pdostatement_setattribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, getAttribute, arginfo_pdostatement_getattribute, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, columnCount, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, getColumnMeta, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, setFetchMode, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, getColumnMeta, arginfo_pdostatement_getcolumnmeta, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, setFetchMode, arginfo_pdostatement_setfetchmode, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, nextRowset, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, closeCursor, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDOStatement, debugDumpParams, NULL, ZEND_ACC_PUBLIC)
diff --git a/ext/pdo/tests/bug_42917.phpt b/ext/pdo/tests/bug_42917.phpt
new file mode 100644
index 000000000..d4b71f57d
--- /dev/null
+++ b/ext/pdo/tests/bug_42917.phpt
@@ -0,0 +1,40 @@
+--TEST--
+PDO Common: Bug #42917 (PDO::FETCH_KEY_PAIR doesn't work with setFetchMode)
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+$dir = getenv('REDIR_TEST_DIR');
+if (false == $dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+
+$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
+
+for ($i = 0; $i < 5; $i++) {
+ $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
+}
+
+$res = $db->query("SELECT a,b FROM test");
+$res->setFetchMode(PDO::FETCH_KEY_PAIR);
+var_dump($res->fetchAll());
+
+?>
+--EXPECT--
+array(5) {
+ ["test0"]=>
+ string(1) "0"
+ ["test1"]=>
+ string(1) "1"
+ ["test2"]=>
+ string(1) "2"
+ ["test3"]=>
+ string(1) "3"
+ ["test4"]=>
+ string(1) "4"
+}
diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt
new file mode 100644
index 000000000..5082895cb
--- /dev/null
+++ b/ext/pdo/tests/bug_43130.phpt
@@ -0,0 +1,31 @@
+--TEST--
+PDO Common: Bug #43130 (Bound parameters cannot have - in their name)
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+$dir = getenv('REDIR_TEST_DIR');
+if (false == $dir) die('skip no driver');
+if (!strncasecmp(getenv('PDOTEST_DSN'), 'sqlite', strlen('sqlite'))) die('skip not relevant for sqlite driver');
+require_once $dir . 'pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+
+$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
+
+for ($i = 0; $i < 5; $i++) {
+ $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
+}
+
+$stmt = $db->prepare("SELECT a FROM test WHERE b=:id-value");
+$stmt->bindParam(':id-value', $id);
+$id = '1';
+$stmt->execute();
+var_dump($stmt->fetch(PDO::FETCH_COLUMN));
+?>
+--EXPECT--
+string(5) "test1"
diff --git a/ext/pdo/tests/bug_43139.phpt b/ext/pdo/tests/bug_43139.phpt
new file mode 100644
index 000000000..04b9bf311
--- /dev/null
+++ b/ext/pdo/tests/bug_43139.phpt
@@ -0,0 +1,34 @@
+--TEST--
+PDO Common: Bug #43139 (PDO ignore ATTR_DEFAULT_FETCH_MODE in some cases with fetchAll())
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+$dir = getenv('REDIR_TEST_DIR');
+if (false == $dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+
+$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+
+var_dump($db->query('select 0 as abc, 1 as xyz, 2 as def')->fetchAll(PDO::FETCH_GROUP));
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(2) {
+ ["xyz"]=>
+ string(1) "1"
+ ["def"]=>
+ string(1) "2"
+ }
+ }
+}
diff --git a/ext/pdo/tests/pdo_029.phpt b/ext/pdo/tests/pdo_029.phpt
index a5847149c..f3dc1f2fa 100755
--- a/ext/pdo/tests/pdo_029.phpt
+++ b/ext/pdo/tests/pdo_029.phpt
@@ -34,7 +34,7 @@ class PDOStatementX extends PDOStatement
echo __METHOD__ . "()\n";
}
- function execute()
+ function execute($params = array())
{
echo __METHOD__ . "()\n";
parent::execute();
diff --git a/ext/pdo/tests/pdo_030.phpt b/ext/pdo/tests/pdo_030.phpt
index b6482d69d..243e94a1e 100755
--- a/ext/pdo/tests/pdo_030.phpt
+++ b/ext/pdo/tests/pdo_030.phpt
@@ -35,7 +35,7 @@ class PDOStatementX extends PDOStatement
echo __METHOD__ . "()\n";
}
- function execute()
+ function execute($params = array())
{
echo __METHOD__ . "()\n";
parent::execute();
diff --git a/ext/pdo_oci/config.m4 b/ext/pdo_oci/config.m4
index 3a8f88097..804ec032d 100755
--- a/ext/pdo_oci/config.m4
+++ b/ext/pdo_oci/config.m4
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.14.2.5.2.5 2007/08/17 13:30:36 sixd Exp $
+dnl $Id: config.m4,v 1.14.2.5.2.6 2007/08/31 21:08:48 sixd Exp $
if test "$PHP_PDO" != "no"; then
@@ -24,7 +24,7 @@ AC_DEFUN([AC_PDO_OCI_VERSION],[
PDO_OCI_VERSION=8.1
fi
else
- AC_MSG_ERROR(Oracle-OCI needed libraries not found under $PDO_OCI_DIR)
+ AC_MSG_ERROR(Oracle OCI libraries not found under $PDO_OCI_DIR)
fi
AC_MSG_RESULT($PDO_OCI_VERSION)
])
@@ -54,7 +54,7 @@ AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[
])
PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO,
-[ --with-pdo-oci[=DIR] PDO: Oracle-OCI support. DIR defaults to \$ORACLE_HOME.
+[ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to \$ORACLE_HOME.
Use --with-pdo-oci=instantclient,prefix,version
for an Oracle Instant Client SDK.
For Linux with 10.2.0.3 RPMs (for example) use:
@@ -67,12 +67,12 @@ if test "$PHP_PDO_OCI" != "no"; then
else
PDO_OCI_DIR=$PHP_PDO_OCI
fi
- AC_MSG_RESULT($PDO_OCI_DIR :$PHP_PDO_OCI:)
+ AC_MSG_RESULT($PHP_PDO_OCI)
AC_MSG_CHECKING([if that is sane])
if test -z "$PDO_OCI_DIR"; then
AC_MSG_ERROR([
-You need to tell me where to find your oracle SDK, or set ORACLE_HOME.
+You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.
])
else
AC_MSG_RESULT([yes])
@@ -251,6 +251,8 @@ You need to tell me where to find your oracle SDK, or set ORACLE_HOME.
[
PHP_ADD_EXTENSION_DEP(pdo_oci, pdo)
])
+
+ AC_DEFINE_UNQUOTED(PHP_PDO_OCI_CLIENT_VERSION, "$PDO_OCI_VERSION", [ ])
fi
fi
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 7c01eeb1d..6dcbf5989 100755
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci_driver.c,v 1.24.2.4.2.6 2007/07/03 04:32:26 sixd Exp $ */
+/* $Id: oci_driver.c,v 1.24.2.4.2.7 2007/08/31 21:08:48 sixd Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -31,6 +31,8 @@
#include "php_pdo_oci_int.h"
#include "Zend/zend_exceptions.h"
+static inline ub4 pdo_oci_sanitize_prefetch(long prefetch);
+
static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC) /* {{{ */
{
pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
@@ -285,14 +287,14 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd
}
- prefetch = 1024 * pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, 100 TSRMLS_CC);
+ prefetch = pdo_oci_sanitize_prefetch(pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC));
if (prefetch) {
H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0,
- OCI_ATTR_PREFETCH_MEMORY, H->err);
+ OCI_ATTR_PREFETCH_ROWS, H->err);
if (!H->last_err) {
- prefetch /= 1024;
+ prefetch *= PDO_OCI_PREFETCH_ROWSIZE;
H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0,
- OCI_ATTR_PREFETCH_ROWS, H->err);
+ OCI_ATTR_PREFETCH_MEMORY, H->err);
}
}
@@ -446,6 +448,69 @@ static int oci_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_
} else {
return 0;
}
+
+}
+/* }}} */
+
+static int oci_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC) /* {{{ */
+{
+ pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
+
+ switch (attr) {
+ case PDO_ATTR_SERVER_VERSION:
+ case PDO_ATTR_SERVER_INFO:
+ {
+ text infostr[512];
+ char verstr[15];
+ ub4 vernum;
+
+ if (OCIServerRelease(H->svc, H->err, infostr, (ub4)sizeof(infostr), (ub1)OCI_HTYPE_SVCCTX, &vernum))
+ {
+ ZVAL_STRING(return_value, "<<Unknown>>", 1);
+ } else {
+ if (attr == PDO_ATTR_SERVER_INFO) {
+ ZVAL_STRING(return_value, (char *)infostr, 1);
+ } else {
+ slprintf(verstr, sizeof(verstr), "%d.%d.%d.%d.%d",
+ (int)((vernum>>24) & 0xFF), /* version number */
+ (int)((vernum>>20) & 0x0F), /* release number*/
+ (int)((vernum>>12) & 0xFF), /* update number */
+ (int)((vernum>>8) & 0x0F), /* port release number */
+ (int)((vernum>>0) & 0xFF)); /* port update number */
+
+ ZVAL_STRING(return_value, verstr, 1);
+ }
+ }
+ return TRUE;
+ }
+
+ case PDO_ATTR_CLIENT_VERSION:
+ {
+#if OCI_MAJOR_VERSION > 10 || (OCI_MAJOR_VERSION == 10 && OCI_MINOR_VERSION >= 2)
+ /* Run time client version */
+ sword major, minor, update, patch, port_update;
+ char verstr[15];
+
+ OCIClientVersion(&major, &minor, &update, &patch, &port_update);
+ slprintf(verstr, sizeof(verstr), "%d.%d.%d.%d.%d", major, minor, update, patch, port_update);
+ ZVAL_STRING(return_value, verstr, 1);
+#else
+ /* Compile time client version */
+ ZVAL_STRING(return_value, PHP_PDO_OCI_CLIENT_VERSION, 1);
+#endif /* Check for OCIClientVersion() support */
+
+ return TRUE;
+ }
+
+ case PDO_ATTR_AUTOCOMMIT:
+ ZVAL_BOOL(return_value, dbh->auto_commit);
+ return TRUE;
+
+ default:
+ return FALSE;
+
+ }
+ return FALSE;
}
/* }}} */
@@ -461,7 +526,7 @@ static struct pdo_dbh_methods oci_methods = {
oci_handle_set_attribute,
NULL,
pdo_oci_fetch_error_func,
- NULL, /* get_attr */
+ oci_handle_get_attribute,
NULL, /* check_liveness */
NULL /* get_driver_methods */
};
@@ -483,7 +548,7 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC
/* allocate an environment */
#if HAVE_OCIENVNLSCREATE
if (vars[0].optval) {
- H->charset = OCINlsCharSetNameToId(pdo_oci_Env, vars[0].optval);
+ H->charset = OCINlsCharSetNameToId(pdo_oci_Env, (const oratext *)vars[0].optval);
if (!H->charset) {
oci_init_error("OCINlsCharSetNameToId: unknown character set name");
goto cleanup;
@@ -598,6 +663,17 @@ pdo_driver_t pdo_oci_driver = {
pdo_oci_handle_factory
};
+static inline ub4 pdo_oci_sanitize_prefetch(long prefetch) /* {{{ */
+{
+ if (prefetch < 0) {
+ prefetch = 0;
+ } else if (prefetch > UB4MAXVAL / PDO_OCI_PREFETCH_ROWSIZE) {
+ prefetch = PDO_OCI_PREFETCH_DEFAULT;
+ }
+ return ((ub4)prefetch);
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index c5572e36d..a2aa0c4d5 100755
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci_statement.c,v 1.16.2.10.2.6 2007/06/30 02:30:34 sixd Exp $ */
+/* $Id: oci_statement.c,v 1.16.2.10.2.7 2007/08/31 21:08:48 sixd Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -31,8 +31,8 @@
#include "php_pdo_oci_int.h"
#include "Zend/zend_extensions.h"
-#define STMT_CALL(name, params) \
- do { \
+#define STMT_CALL(name, params) \
+ do { \
S->last_err = name params; \
S->last_err = _oci_error(S->err, stmt->dbh, stmt, #name, S->last_err, FALSE, __FILE__, __LINE__ TSRMLS_CC); \
if (S->last_err) { \
@@ -40,8 +40,8 @@
} \
} while(0)
-#define STMT_CALL_MSG(name, msg, params) \
- do { \
+#define STMT_CALL_MSG(name, msg, params) \
+ do { \
S->last_err = name params; \
S->last_err = _oci_error(S->err, stmt->dbh, stmt, #name ": " #msg, S->last_err, FALSE, __FILE__, __LINE__ TSRMLS_CC); \
if (S->last_err) { \
@@ -529,7 +529,7 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ */
col->precision = scale;
col->maxlen = data_size;
col->namelen = namelen;
- col->name = estrndup(colname, namelen);
+ col->name = estrndup((char *)colname, namelen);
S->cols[colno].dtype = dtype;
diff --git a/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h
index 1ef008834..079cc5465 100755
--- a/ext/pdo_oci/php_pdo_oci_int.h
+++ b/ext/pdo_oci/php_pdo_oci_int.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pdo_oci_int.h,v 1.4.2.2.2.3 2007/06/30 02:30:35 sixd Exp $ */
+/* $Id: php_pdo_oci_int.h,v 1.4.2.2.2.4 2007/08/31 21:08:48 sixd Exp $ */
#include <oci.h>
@@ -31,15 +31,15 @@ typedef struct {
typedef struct {
OCIServer *server;
OCISession *session;
- OCIEnv *env;
+ OCIEnv *env;
OCIError *err;
- OCISvcCtx *svc;
+ OCISvcCtx *svc;
/* OCI9; 0 == use NLS_LANG */
ub2 charset;
sword last_err;
- unsigned attached:1;
- unsigned _reserved:31;
+ unsigned attached:1;
+ unsigned _reserved:31;
pdo_oci_error_info einfo;
} pdo_oci_db_handle;
@@ -62,15 +62,15 @@ typedef struct {
OCIStmt *stmt;
OCIError *err;
sword last_err;
- ub2 stmt_type;
- ub4 exec_type;
+ ub2 stmt_type;
+ ub4 exec_type;
pdo_oci_column *cols;
pdo_oci_error_info einfo;
unsigned int have_blobs:1;
} pdo_oci_stmt;
typedef struct {
- OCIBind *bind; /* allocated by OCI */
+ OCIBind *bind; /* allocated by OCI */
sb2 oci_type;
sb2 indicator;
ub2 retcode;
@@ -93,3 +93,8 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor
extern struct pdo_stmt_methods oci_stmt_methods;
+/* Default prefetch size in number of rows */
+#define PDO_OCI_PREFETCH_DEFAULT 100
+
+/* Arbitrary assumed row length for prefetch memory limit calcuation */
+#define PDO_OCI_PREFETCH_ROWSIZE 1024
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt
new file mode 100644
index 000000000..298d59ed0
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt
@@ -0,0 +1,64 @@
+--TEST--
+PDO_OCI: Attribute: Basic autocommit functionality
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+$dbh = PDOTest::factory();
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$dbh->exec("drop table pdo_ac_tab");
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+print "PDO::ATTR_AUTOCOMMIT: Default: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+echo "Change setting to false - ";
+
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+echo "Change setting back to true - ";
+
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true);
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+// Use 2nd connection to check that autocommit does commit
+
+echo "Insert data\n";
+$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))");
+$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')");
+
+$dbh2 = PDOTest::factory();
+
+echo "Second connection should be able to see committed data\n";
+$s = $dbh2->prepare("select col1 from pdo_ac_tab");
+$s->execute();
+while ($r = $s->fetch()) {
+ echo "Data is: " . $r[0] . "\n";
+}
+
+$dbh->exec("drop table pdo_ac_tab");
+
+echo "Done\n";
+
+?>
+--EXPECT--
+PDO::ATTR_AUTOCOMMIT: Default: bool(true)
+Change setting to false - PDO::ATTR_AUTOCOMMIT: bool(false)
+Change setting back to true - PDO::ATTR_AUTOCOMMIT: bool(true)
+Insert data
+Second connection should be able to see committed data
+Data is: some data
+Done \ No newline at end of file
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
new file mode 100644
index 000000000..9addca883
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
@@ -0,0 +1,127 @@
+--TEST--
+PDO_OCI: Attribute: beginTransaction and native transactions
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+$dbh = PDOTest::factory();
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$dbh->exec("drop table pdo_ac_tab");
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+$dbh->exec("create table pdo_ac_tab (col1 varchar2(25))");
+
+echo "Test 1 Check beginTransaction insertion\n";
+
+$dbh->beginTransaction();
+try {
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')");
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')");
+ $dbh->commit();
+}
+catch (PDOException $e) {
+ echo "Caught unexpected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+ $dbh->rollback();
+}
+
+echo "Test 2 Cause an exception and test beginTransaction rollback\n";
+
+$dbh->beginTransaction();
+try {
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')");
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')");
+ $dbh->commit();
+}
+catch (PDOException $e) {
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+ $dbh->rollback();
+}
+
+echo "Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction\n";
+
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 3')");
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true);
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+try {
+ $dbh->rollback();
+}
+catch (PDOException $e) {
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+}
+
+echo "Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction\n";
+
+$dbh->beginTransaction();
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 4')");
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+try {
+ $dbh->rollback();
+}
+catch (PDOException $e) {
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+}
+
+echo "Test 5 Handle transactions ourselves\n";
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+$dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #2')");
+$dbh->exec("rollback");
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 5')");
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 6')");
+
+$dbh->exec("commit");
+
+// Open new connection to really verify what was inserted
+
+$dbh2 = PDOTest::factory();
+
+echo "Query Results are:\n";
+$s = $dbh2->prepare("select col1 from pdo_ac_tab");
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1 Check beginTransaction insertion
+Test 2 Cause an exception and test beginTransaction rollback
+Caught expected exception at line 35
+SQLSTATE[HY000]: General error: 12899 OCIStmtExecute: ORA-12899: %s
+%s
+Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction
+PDO::ATTR_AUTOCOMMIT: bool(true)
+Caught expected exception at line %d
+There is no active transaction
+Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction
+PDO::ATTR_AUTOCOMMIT: bool(false)
+Caught expected exception at line %d
+There is no active transaction
+Test 5 Handle transactions ourselves
+PDO::ATTR_AUTOCOMMIT: bool(false)
+Query Results are:
+data 1
+data 2
+data 3
+data 4
+data 5
+data 6
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
new file mode 100644
index 000000000..81e9b74ff
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
@@ -0,0 +1,51 @@
+--TEST--
+PDO_OCI: Atrribute: closing a connection in non-autocommit mode commits data
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+// Check connection can be created with AUTOCOMMIT off
+putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_AUTOCOMMIT=>false)));
+$dbh = PDOTest::factory();
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$dbh->exec("drop table pdo_ac_tab");
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+echo "Insert data\n";
+
+$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))");
+
+$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')");
+
+$dbh = null; // close first connection
+
+echo "Second connection should be able to see committed data\n";
+$dbh2 = PDOTest::factory();
+$s = $dbh2->prepare("select col1 from pdo_ac_tab");
+$s->execute();
+while ($r = $s->fetch()) {
+ echo "Data is: " . $r[0] . "\n";
+}
+
+$dbh2->exec("drop table pdo_ac_tab");
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+PDO::ATTR_AUTOCOMMIT: bool(false)
+Insert data
+Second connection should be able to see committed data
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_case.phpt b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
new file mode 100644
index 000000000..4c19d6c73
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
@@ -0,0 +1,81 @@
+--TEST--
+PDO_OCI: Attribute: Column Case
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+function do_query1($dbh)
+{
+ var_dump($dbh->getAttribute(PDO::ATTR_CASE));
+ $s = $dbh->prepare("select dummy from dual");
+ $s->execute();
+ while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
+ var_dump($r);
+ }
+}
+
+function do_query2($dbh, $mode)
+{
+ echo "Mode desired is $mode\n";
+ $s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode));
+ $s->execute();
+ while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
+ var_dump($r);
+ }
+}
+
+$dbh = PDOTest::factory();
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+echo "Test 1 - Force column names to lower case\n";
+$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
+do_query1($dbh);
+
+echo "Test 2 - Leave column names as returned by the database driver\n";
+$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
+do_query1($dbh);
+
+echo "Test 3 - Force column names to upper case\n";
+$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER);
+do_query1($dbh);
+
+echo "Test 4 - Setting on statement has no effect. Attempt lower case but get upper\n";
+$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); // reset
+do_query2($dbh, PDO::CASE_LOWER);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test 1 - Force column names to lower case
+int(2)
+array(1) {
+ ["dummy"]=>
+ string(1) "X"
+}
+Test 2 - Leave column names as returned by the database driver
+int(0)
+array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+}
+Test 3 - Force column names to upper case
+int(1)
+array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+}
+Test 4 - Setting on statement has no effect. Attempt lower case but get upper
+Mode desired is 2
+array(1) {
+ ["DUMMY"]=>
+ string(1) "X"
+}
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
new file mode 100644
index 000000000..b21f1b77f
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
@@ -0,0 +1,43 @@
+--TEST--
+PDO_OCI: Attribute: Client version
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+$dbh = PDOTest::factory();
+
+echo "ATTR_CLIENT_VERSION: ";
+$cv = $dbh->getAttribute(PDO::ATTR_CLIENT_VERSION);
+var_dump($cv);
+
+$s = split("\.", $cv);
+if ($s[0] >= 10 && count($s) > 1 && $s[1] >= 2) {
+ if (count($s) != 5) {
+ echo "Wrong number of values in array\nVersion was: ";
+ var_dump($cv);
+ } else {
+ echo "Version OK, so far as can be portably checked\n";
+ }
+} else {
+ if (count($s) != 2) {
+ echo "Wrong number of values in array\nVersion was: ";
+ var_dump($cv);
+ } else {
+ echo "Version OK, so far as can be portably checked\n";
+ }
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+ATTR_CLIENT_VERSION: string(%d) "%d.%s"
+Version OK, so far as can be portably checked
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt b/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt
new file mode 100644
index 000000000..7934e7953
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt
@@ -0,0 +1,21 @@
+--TEST--
+PDO_OCI: Attribute: verify driver name
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc';
+
+$dbh = PDOTest::factory();
+var_dump($dbh->getAttribute(PDO::ATTR_DRIVER_NAME));
+
+echo "Done\n";
+?>
+--EXPECT--
+string(3) "oci"
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
new file mode 100644
index 000000000..b9c4612b8
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
@@ -0,0 +1,61 @@
+--TEST--
+PDO_OCI: Attribute: Oracle Nulls
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+function do_query($dbh)
+{
+ var_dump($dbh->getAttribute(PDO::ATTR_ORACLE_NULLS));
+ $s = $dbh->prepare("select '' as myempty, null as mynull from dual");
+ $s->execute();
+ while ($r = $s->fetch()) {
+ var_dump($r[0]);
+ var_dump($r[1]);
+ }
+}
+
+$dbh = PDOTest::factory();
+
+print "PDO::ATTR_ORACLE_NULLS: Default: ";
+do_query($dbh);
+
+print "PDO::ATTR_ORACLE_NULLS: PDO::NULL_NATURAL: ";
+$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL); // No conversion.
+
+do_query($dbh);
+
+print "PDO::ATTR_ORACLE_NULLS: PDO::NULL_EMPTY_STRING: ";
+$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING); // Empty string is converted to NULL.
+
+do_query($dbh);
+
+print "PDO::ATTR_ORACLE_NULLS: PDO::NULL_TO_STRING: ";
+$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING); // NULL is converted to an empty string.
+
+do_query($dbh);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+PDO::ATTR_ORACLE_NULLS: Default: int(0)
+NULL
+NULL
+PDO::ATTR_ORACLE_NULLS: PDO::NULL_NATURAL: int(0)
+NULL
+NULL
+PDO::ATTR_ORACLE_NULLS: PDO::NULL_EMPTY_STRING: int(1)
+NULL
+NULL
+PDO::ATTR_ORACLE_NULLS: PDO::NULL_TO_STRING: int(2)
+string(0) ""
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt
new file mode 100644
index 000000000..839fe83b0
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+PDO_OCI: Attribute: Set prefetch on connection
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+$dbh = PDOTest::factory();
+
+echo "Test connect: (value is ignored & has no effect)\n";
+putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_PREFETCH=>101)));
+$dbh = PDOTest::factory();
+
+echo "Test set: (value is ignored & has no effect)\n";
+$dbh->setAttribute(PDO::ATTR_PREFETCH, 102);
+
+// Verify can fetch
+$s = $dbh->prepare("select dummy from dual" );
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test connect: (value is ignored & has no effect)
+Test set: (value is ignored & has no effect)
+X
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt
new file mode 100644
index 000000000..4b8fd8079
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt
@@ -0,0 +1,47 @@
+--TEST--
+PDO_OCI: Attribute: prefetch on statements
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+$dbh = PDOTest::factory();
+
+$s = $dbh->prepare("select '' as myempty, null as mynull from dual", array(PDO::ATTR_PREFETCH => 101));
+
+echo "Test 1: Can't set prefetch after prepare\n";
+var_dump($s->setAttribute(PDO::ATTR_PREFETCH, 102));
+
+// Verify can fetch
+$s = $dbh->prepare("select dummy from dual" );
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Test 2: Turn off prefetching\n";
+$s = $dbh->prepare("select '' as myempty, null as mynull from dual", array(PDO::ATTR_PREFETCH => 0));
+$s = $dbh->prepare("select dummy from dual" );
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1: Can't set prefetch after prepare
+
+Warning: PDOStatement::setAttribute(): SQLSTATE[IM001]: Driver does not support this function: This driver doesn't support setting attributes in %s on line %d
+bool(false)
+X
+Test 2: Turn off prefetching
+X
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_server.phpt b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
new file mode 100644
index 000000000..dba5a1985
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
@@ -0,0 +1,40 @@
+--TEST--
+PDO_OCI: Attribute: Server version and info
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
+
+$dbh = PDOTest::factory();
+
+echo "Test 1\n";
+echo "ATTR_SERVER_VERSION: ";
+var_dump($dbh->getAttribute(PDO::ATTR_SERVER_VERSION));
+
+echo "Test 2\n";
+echo "ATTR_SERVER_INFO\n";
+$si = $dbh->getAttribute(PDO::ATTR_SERVER_INFO);
+$pos = strpos($si, "Oracle");
+if ($pos === 0) {
+ echo "Found 'Oracle' at position $pos as expected\n";
+} else {
+ echo "Unexpected result. Server info was:\n";
+ var_dump($si);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+ATTR_SERVER_VERSION: string(%d) "%d.%d.%d.%d.%d"
+Test 2
+ATTR_SERVER_INFO
+Found 'Oracle' at position 0 as expected
+Done
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index ef7e87884..968eda3f1 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.331.2.13.2.22 2007/08/22 22:40:29 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.331.2.13.2.25 2007/10/03 23:31:58 iliaa Exp $ */
#include <stdlib.h>
@@ -82,7 +82,7 @@
#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet"); }
#ifndef HAVE_PQFREEMEM
-#define PGfreemem free
+#define PQfreemem free
#endif
ZEND_DECLARE_MODULE_GLOBALS(pgsql)
@@ -5001,7 +5001,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
ZVAL_STRINGL(new_val, "NOW()", sizeof("NOW()")-1, 1);
} else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
err = 1;
} else {
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
@@ -5366,7 +5366,11 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
assert(Z_TYPE_P(var_array) == IS_ARRAY);
if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) {
- return FAILURE;
+ smart_str_appends(&querystr, "INSERT INTO ");
+ smart_str_appends(&querystr, table);
+ smart_str_appends(&querystr, " DEFAULT VALUES");
+
+ goto no_values;
}
/* convert input array if needed */
@@ -5424,6 +5428,9 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
/* Remove the trailing "," */
querystr.len--;
smart_str_appends(&querystr, ");");
+
+no_values:
+
smart_str_0(&querystr);
if ((opt & (PGSQL_DML_EXEC|PGSQL_DML_ASYNC)) &&
@@ -5435,7 +5442,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
}
cleanup:
- if (!(opt & PGSQL_DML_NO_CONV)) {
+ if (!(opt & PGSQL_DML_NO_CONV) && converted) {
zval_dtor(converted);
FREE_ZVAL(converted);
}
diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt
new file mode 100644
index 000000000..575e527db
--- /dev/null
+++ b/ext/pgsql/tests/80_bug42783.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #42783 (pg_insert() does not support an empty value array)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('config.inc');
+
+$dbh = @pg_connect($conn_str);
+if (!$dbh) {
+ die ("Could not connect to the server");
+}
+
+pg_query("CREATE TABLE php_test (id SERIAL PRIMARY KEY, time TIMESTAMP NOT NULL DEFAULT now())");
+
+pg_insert($dbh, 'php_test', array());
+
+var_dump(pg_fetch_assoc(pg_query("SELECT * FROM php_test")));
+
+pg_query($dbh, "DROP TABLE php_test");
+pg_close($dbh);
+?>
+===DONE===
+--EXPECTF--
+array(2) {
+ ["id"]=>
+ string(%d) "%d"
+ ["time"]=>
+ string(%d) "%s"
+}
+===DONE===
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 28118452b..3e3e4b67a 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.164.2.33.2.45 2007/08/20 17:01:22 sebastian Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.47 2007/10/28 13:47:14 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1992,7 +1992,7 @@ ZEND_METHOD(reflection_parameter, getClass)
{
reflection_object *intern;
parameter_reference *param;
- zend_class_entry **pce;
+ zend_class_entry **pce, *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
@@ -2011,7 +2011,7 @@ ZEND_METHOD(reflection_parameter, getClass)
* lint-mode.
*/
if (0 == strncmp(param->arg_info->class_name, "self", sizeof("self")- 1)) {
- zend_class_entry *ce= param->fptr->common.scope;
+ ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Parameter uses 'self' as type hint but function is not a class member!");
@@ -2019,7 +2019,7 @@ ZEND_METHOD(reflection_parameter, getClass)
}
pce= &ce;
} else if (0 == strncmp(param->arg_info->class_name, "parent", sizeof("parent")- 1)) {
- zend_class_entry *ce= param->fptr->common.scope;
+ ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Parameter uses 'parent' as type hint but function is not a class member!");
@@ -3405,7 +3405,7 @@ ZEND_METHOD(reflection_class, isInstance)
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstance)
{
- zval *retval_ptr;
+ zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
@@ -3449,7 +3449,9 @@ ZEND_METHOD(reflection_class, newInstance)
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
efree(params);
- zval_ptr_dtor(&retval_ptr);
+ if (retval_ptr) {
+ zval_ptr_dtor(&retval_ptr);
+ }
zend_error(E_WARNING, "Invocation of %s's constructor failed", ce->name);
RETURN_NULL();
}
@@ -3469,7 +3471,7 @@ ZEND_METHOD(reflection_class, newInstance)
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstanceArgs)
{
- zval *retval_ptr;
+ zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = 0;
@@ -3524,7 +3526,9 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
if (params) {
efree(params);
}
- zval_ptr_dtor(&retval_ptr);
+ if (retval_ptr) {
+ zval_ptr_dtor(&retval_ptr);
+ }
zend_error(E_WARNING, "Invocation of %s's constructor failed", ce->name);
RETURN_NULL();
}
@@ -4903,7 +4907,7 @@ PHP_MINFO_FUNCTION(reflection) /* {{{ */
php_info_print_table_start();
php_info_print_table_header(2, "Reflection", "enabled");
- php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.45 2007/08/20 17:01:22 sebastian Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.47 2007/10/28 13:47:14 iliaa Exp $");
php_info_print_table_end();
} /* }}} */
diff --git a/ext/reflection/tests/bug42976.phpt b/ext/reflection/tests/bug42976.phpt
new file mode 100644
index 000000000..38aed3a40
--- /dev/null
+++ b/ext/reflection/tests/bug42976.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails)
+--FILE--
+<?php
+
+Class C {
+ function __construct(&$x) {
+ $x = "x.changed";
+ }
+}
+
+$x = "x.original";
+new C($x); // OK
+var_dump($x);
+
+$rc = new ReflectionClass('C');
+$x = "x.original";
+$rc->newInstance($x); // causes crash
+var_dump($x);
+$x = "x.original";
+$rc->newInstanceArgs(array($x)); // causes crash
+var_dump($x);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(9) "x.changed"
+
+Warning: Invocation of C's constructor failed in %s/bug42976.php on line %d
+string(10) "x.original"
+
+Warning: Invocation of C's constructor failed in %s/bug42976.php on line %d
+string(10) "x.original"
+Done
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index e80e51d10..3166b1577 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_files.c,v 1.100.2.3.2.9 2007/08/23 12:23:59 jani Exp $ */
+/* $Id: mod_files.c,v 1.100.2.3.2.10 2007/09/10 23:42:54 iliaa Exp $ */
#include "php.h"
@@ -295,7 +295,7 @@ PS_OPEN_FUNC(files)
argv[argc++] = last;
last = ++p;
p = strchr(p, ';');
- if (argc > 1) break;
+ if (argc > 2) break;
}
argv[argc++] = last;
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index e9a797327..d7a8b347c 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.103.2.21.2.35 2007/08/22 14:18:09 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.21.2.38 2007/10/17 12:08:45 dmitry Exp $ */
#include <time.h>
@@ -357,7 +357,7 @@ static zend_bool soap_check_xml_ref(zval **data, xmlNodePtr node TSRMLS_DC)
return 0;
}
-xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent)
+static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xmlNodePtr parent, int check_class_map)
{
xmlNodePtr node = NULL;
TSRMLS_FETCH();
@@ -428,7 +428,7 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par
xmlSetNs(node, nsp);
}
} else {
- if (SOAP_GLOBAL(class_map) && data &&
+ if (check_class_map && SOAP_GLOBAL(class_map) && data &&
Z_TYPE_P(data) == IS_OBJECT &&
!Z_OBJPROP_P(data)->nApplyCount) {
zend_class_entry *ce = Z_OBJCE_P(data);
@@ -489,6 +489,11 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par
return node;
}
+xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent)
+{
+ return master_to_xml_int(encode, data, style, parent, 1);
+}
+
static zval *master_to_zval_int(encodePtr encode, xmlNodePtr data)
{
zval *ret = NULL;
@@ -859,13 +864,50 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo
efree(str);
str = estrdup((char*)xmlBufferContent(out));
new_len = n;
- } else if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
- soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str);
}
xmlBufferFree(out);
xmlBufferFree(in);
- } else if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
- soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str);
+ }
+
+ if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
+ char *err = emalloc(new_len + 8);
+ char c;
+ int i;
+
+ memcpy(err, str, new_len+1);
+ for (i = 0; (c = err[i++]);) {
+ if ((c & 0x80) == 0) {
+ } else if ((c & 0xe0) == 0xc0) {
+ if ((err[i] & 0xc0) != 0x80) {
+ break;
+ }
+ i++;
+ } else if ((c & 0xf0) == 0xe0) {
+ if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80) {
+ break;
+ }
+ i += 2;
+ } else if ((c & 0xf8) == 0xf0) {
+ if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80 || (err[i+2] & 0xc0) != 0x80) {
+ break;
+ }
+ i += 3;
+ } else {
+ break;
+ }
+ }
+ if (c) {
+ err[i-1] = '\\';
+ err[i++] = 'x';
+ err[i++] = ((unsigned char)c >> 4) + ((((unsigned char)c >> 4) > 9) ? ('a' - 10) : '0');
+ err[i++] = (c & 15) + (((c & 15) > 9) ? ('a' - 10) : '0');
+ err[i++] = '.';
+ err[i++] = '.';
+ err[i++] = '.';
+ err[i++] = 0;
+ }
+
+ soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", err);
}
text = xmlNewTextLen(BAD_CAST(str), new_len);
@@ -1166,9 +1208,10 @@ static zval* get_zval_property(zval* object, char* name TSRMLS_DC)
zval *data;
zend_class_entry *old_scope;
+ INIT_PZVAL(&member);
ZVAL_STRING(&member, name, 0);
old_scope = EG(scope);
- EG(scope) = Z_OBJCE_P(object);
+ EG(scope) = Z_OBJCE_P(object);
data = Z_OBJ_HT_P(object)->read_property(object, &member, BP_VAR_IS TSRMLS_CC);
if (data == EG(uninitialized_zval_ptr)) {
/* Hack for bug #32455 */
@@ -1199,9 +1242,10 @@ static void unset_zval_property(zval* object, char* name TSRMLS_DC)
zval member;
zend_class_entry *old_scope;
+ INIT_PZVAL(&member);
ZVAL_STRING(&member, name, 0);
old_scope = EG(scope);
- EG(scope) = Z_OBJCE_P(object);
+ EG(scope) = Z_OBJCE_P(object);
Z_OBJ_HT_P(object)->unset_property(object, &member TSRMLS_CC);
EG(scope) = old_scope;
} else if (Z_TYPE_P(object) == IS_ARRAY) {
@@ -2685,7 +2729,7 @@ static xmlNodePtr guess_xml_convert(encodeTypePtr type, zval *data, int style, x
} else {
enc = get_conversion(IS_NULL);
}
- ret = master_to_xml(enc, data, style, parent);
+ ret = master_to_xml_int(enc, data, style, parent, 0);
/*
if (style == SOAP_LITERAL && SOAP_GLOBAL(sdl)) {
set_ns_and_type(ret, &enc->details);
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index ba7543a5f..2776a8e26 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.77.2.11.2.12 2007/07/24 09:27:46 dmitry Exp $ */
+/* $Id: php_http.c,v 1.77.2.11.2.13 2007/10/17 11:17:46 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -918,7 +918,7 @@ try_again:
efree(http_body);
efree(loc);
if (new_url->scheme == NULL && new_url->path != NULL) {
- new_url->scheme = NULL;
+ new_url->scheme = phpurl->scheme ? estrdup(phpurl->scheme) : NULL;
new_url->host = phpurl->host ? estrdup(phpurl->host) : NULL;
new_url->port = phpurl->port;
if (new_url->path && new_url->path[0] != '/') {
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 6e7303885..fb60b08ac 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_schema.c,v 1.58.2.6.2.5 2007/02/15 17:01:29 dmitry Exp $ */
+/* $Id: php_schema.c,v 1.58.2.6.2.6 2007/08/31 10:48:45 dmitry Exp $ */
#include "php_soap.h"
#include "libxml/uri.h"
@@ -453,7 +453,14 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
newType = emalloc(sizeof(sdlType));
memset(newType, 0, sizeof(sdlType));
- newType->name = estrdup("anonymous");
+ {
+ smart_str anonymous = {0};
+
+ smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
+ smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
+ smart_str_0(&anonymous);
+ newType->name = anonymous.c;
+ }
newType->namens = estrdup((char*)tns->children->content);
if (cur_type->elements == NULL) {
@@ -463,6 +470,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
schema_simpleType(sdl, tns, trav, newType);
+
trav = trav->next;
}
if (trav != NULL) {
@@ -541,7 +549,14 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
newType = emalloc(sizeof(sdlType));
memset(newType, 0, sizeof(sdlType));
- newType->name = estrdup("anonymous");
+ {
+ smart_str anonymous = {0};
+
+ smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
+ smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
+ smart_str_0(&anonymous);
+ newType->name = anonymous.c;
+ }
newType->namens = estrdup((char*)tns->children->content);
if (cur_type->elements == NULL) {
@@ -1879,7 +1894,14 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
}
dummy_type = emalloc(sizeof(sdlType));
memset(dummy_type, 0, sizeof(sdlType));
- dummy_type->name = estrdup("anonymous");
+ {
+ smart_str anonymous = {0};
+
+ smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
+ smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
+ smart_str_0(&anonymous);
+ dummy_type->name = anonymous.c;
+ }
dummy_type->namens = estrdup((char*)tns->children->content);
schema_simpleType(sdl, tns, trav, dummy_type);
newAttr->encode = dummy_type->encode;
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 10165f609..9229dcef1 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_soap.h,v 1.38.2.6.2.5 2007/04/02 13:43:08 dmitry Exp $ */
+/* $Id: php_soap.h,v 1.38.2.6.2.6 2007/09/05 11:20:45 dmitry Exp $ */
#ifndef PHP_SOAP_H
#define PHP_SOAP_H
@@ -106,6 +106,7 @@ struct _soapService {
HashTable *class_map;
int features;
struct _soapHeader **soap_headers_ptr;
+ int send_errors;
};
#define SOAP_CLASS 1
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index f4d1cbeb6..d11e8e7e4 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.28.2.27 2007/08/01 10:39:33 dmitry Exp $ */
+/* $Id: soap.c,v 1.156.2.28.2.33 2007/11/01 15:41:13 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1035,6 +1035,7 @@ PHP_METHOD(SoapServer, SoapServer)
service = emalloc(sizeof(soapService));
memset(service, 0, sizeof(soapService));
+ service->send_errors = 1;
cache_wsdl = SOAP_GLOBAL(cache);
@@ -1099,6 +1100,11 @@ PHP_METHOD(SoapServer, SoapServer)
cache_wsdl = Z_LVAL_PP(tmp);
}
+ if (zend_hash_find(ht, "send_errors", sizeof("send_errors"), (void**)&tmp) == SUCCESS &&
+ (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG)) {
+ service->send_errors = Z_LVAL_PP(tmp);
+ }
+
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode.");
}
@@ -1866,8 +1872,10 @@ PHP_METHOD(SoapServer, handle)
INIT_ZVAL(result);
ZVAL_STRINGL(&nm_ob_gzhandler, "ob_gzhandler", sizeof("ob_gzhandler") - 1, 0);
+ INIT_PZVAL(&str);
ZVAL_STRINGL(&str, (char*)buf, size, 0);
params[0] = &str;
+ INIT_PZVAL(&mode);
ZVAL_LONG(&mode, PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END);
params[1] = &mode;
if (call_user_function(CG(function_table), NULL, &nm_ob_gzhandler, &result, 2, params TSRMLS_CC) != FAILURE &&
@@ -2005,17 +2013,47 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
our fault code with their own handling... Figure this out later
*/
sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
- snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
- sapi_add_header(cont_len, strlen(cont_len), 1);
if (soap_version == SOAP_1_2) {
sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1);
} else {
sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1);
}
- php_write(buf, size TSRMLS_CC);
+
+ if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0) &&
+ zend_hash_exists(EG(function_table), "ob_gzhandler", sizeof("ob_gzhandler"))) {
+ zval nm_ob_gzhandler;
+ zval str;
+ zval mode;
+ zval result;
+ zval *params[2];
+
+ INIT_ZVAL(result);
+ ZVAL_STRINGL(&nm_ob_gzhandler, "ob_gzhandler", sizeof("ob_gzhandler") - 1, 0);
+ INIT_PZVAL(&str);
+ ZVAL_STRINGL(&str, (char*)buf, size, 0);
+ params[0] = &str;
+ INIT_PZVAL(&mode);
+ ZVAL_LONG(&mode, PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END);
+ params[1] = &mode;
+ if (call_user_function(CG(function_table), NULL, &nm_ob_gzhandler, &result, 2, params TSRMLS_CC) != FAILURE &&
+ Z_TYPE(result) == IS_STRING &&
+ zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), "0", sizeof("0")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) {
+ xmlFree(buf);
+ buf = NULL;
+ snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", Z_STRLEN(result));
+ sapi_add_header(cont_len, strlen(cont_len), 1);
+ php_write(Z_STRVAL(result), Z_STRLEN(result) TSRMLS_CC);
+ }
+ zval_dtor(&result);
+ }
+ if (buf) {
+ snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
+ sapi_add_header(cont_len, strlen(cont_len), 1);
+ php_write(buf, size TSRMLS_CC);
+ xmlFree(buf);
+ }
xmlFreeDoc(doc_return);
- xmlFree(buf);
zend_clear_exception(TSRMLS_C);
}
@@ -2035,11 +2073,15 @@ static void soap_error_handler(int error_num, const char *error_filename, const
{
zend_bool _old_in_compilation, _old_in_execution;
zend_execute_data *_old_current_execute_data;
+ int _old_http_response_code;
+ char *_old_http_status_line;
TSRMLS_FETCH();
_old_in_compilation = CG(in_compilation);
_old_in_execution = EG(in_execution);
_old_current_execute_data = EG(current_execute_data);
+ _old_http_response_code = SG(sapi_headers).http_response_code;
+ _old_http_status_line = SG(sapi_headers).http_status_line;
if (!SOAP_GLOBAL(use_soap_error_handler)) {
call_old_error_handler(error_num, error_filename, error_lineno, format, args);
@@ -2097,12 +2139,18 @@ static void soap_error_handler(int error_num, const char *error_filename, const
old_objects = EG(objects_store).object_buckets;
EG(objects_store).object_buckets = NULL;
PG(display_errors) = 0;
+ SG(sapi_headers).http_status_line = NULL;
zend_try {
call_old_error_handler(error_num, error_filename, error_lineno, format, args);
} zend_catch {
CG(in_compilation) = _old_in_compilation;
EG(in_execution) = _old_in_execution;
EG(current_execute_data) = _old_current_execute_data;
+ if (SG(sapi_headers).http_status_line) {
+ efree(SG(sapi_headers).http_status_line);
+ }
+ SG(sapi_headers).http_status_line = _old_http_status_line;
+ SG(sapi_headers).http_response_code = _old_http_response_code;
} zend_end_try();
EG(objects_store).object_buckets = old_objects;
PG(display_errors) = old;
@@ -2129,46 +2177,64 @@ static void soap_error_handler(int error_num, const char *error_filename, const
char* code = SOAP_GLOBAL(error_code);
char buffer[1024];
- int buffer_len;
zval *outbuf = NULL;
- zval outbuflen;
+ zval **tmp;
+ soapServicePtr service;
- INIT_ZVAL(outbuflen);
+ if (code == NULL) {
+ code = "Server";
+ }
+ if (SOAP_GLOBAL(error_object) &&
+ Z_TYPE_P(SOAP_GLOBAL(error_object)) == IS_OBJECT &&
+ instanceof_function(Z_OBJCE_P(SOAP_GLOBAL(error_object)), soap_server_class_entry TSRMLS_CC) &&
+ zend_hash_find(Z_OBJPROP_P(SOAP_GLOBAL(error_object)), "service", sizeof("service"), (void **)&tmp) != FAILURE &&
+ (service = (soapServicePtr)zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)) &&
+ !service->send_errors) {
+ strcpy(buffer, "Internal Error");
+ } else {
+ int buffer_len;
+ zval outbuflen;
+
+ INIT_ZVAL(outbuflen);
#ifdef va_copy
- va_copy(argcopy, args);
- buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, argcopy);
- va_end(argcopy);
+ va_copy(argcopy, args);
+ buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, argcopy);
+ va_end(argcopy);
#else
- buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, args);
+ buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, args);
#endif
- buffer[sizeof(buffer)-1]=0;
- if (buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
- buffer_len = sizeof(buffer) - 1;
- }
+ buffer[sizeof(buffer)-1]=0;
+ if (buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
+ buffer_len = sizeof(buffer) - 1;
+ }
- if (code == NULL) {
- code = "Server";
- }
- /* Get output buffer and send as fault detials */
- if (php_ob_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) {
- ALLOC_INIT_ZVAL(outbuf);
- php_ob_get_buffer(outbuf TSRMLS_CC);
- }
- php_end_ob_buffer(0, 0 TSRMLS_CC);
+ /* Get output buffer and send as fault detials */
+ if (php_ob_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) {
+ ALLOC_INIT_ZVAL(outbuf);
+ php_ob_get_buffer(outbuf TSRMLS_CC);
+ }
+ php_end_ob_buffer(0, 0 TSRMLS_CC);
+ }
INIT_ZVAL(fault_obj);
set_soap_fault(&fault_obj, NULL, code, buffer, NULL, outbuf, NULL TSRMLS_CC);
fault = 1;
}
PG(display_errors) = 0;
+ SG(sapi_headers).http_status_line = NULL;
zend_try {
call_old_error_handler(error_num, error_filename, error_lineno, format, args);
} zend_catch {
CG(in_compilation) = _old_in_compilation;
EG(in_execution) = _old_in_execution;
EG(current_execute_data) = _old_current_execute_data;
+ if (SG(sapi_headers).http_status_line) {
+ efree(SG(sapi_headers).http_status_line);
+ }
+ SG(sapi_headers).http_status_line = _old_http_status_line;
+ SG(sapi_headers).http_response_code = _old_http_response_code;
} zend_end_try();
PG(display_errors) = old;
@@ -2878,8 +2944,8 @@ PHP_METHOD(SoapClient, __getTypes)
while (zend_hash_get_current_data_ex(sdl->types, (void **)&type, &pos) != FAILURE) {
type_to_string((*type), &buf, 0);
add_next_index_stringl(return_value, buf.c, buf.len, 1);
- zend_hash_move_forward_ex(sdl->types, &pos);
smart_str_free(&buf);
+ zend_hash_move_forward_ex(sdl->types, &pos);
}
}
}
@@ -3248,7 +3314,17 @@ static void deserialize_parameters(xmlNodePtr params, sdlFunctionPtr function, i
}
trav = trav->next;
}
- if (num_of_params > 0) {
+
+ if (num_of_params == 1 &&
+ function &&
+ function->binding &&
+ function->binding->bindingType == BINDING_SOAP &&
+ ((sdlSoapBindingFunctionPtr)function->bindingAttributes)->style == SOAP_DOCUMENT &&
+ (function->requestParameters == NULL ||
+ zend_hash_num_elements(function->requestParameters) == 0) &&
+ strcmp(params->name, function->functionName) == 0) {
+ num_of_params = 0;
+ } else if (num_of_params > 0) {
tmp_parameters = safe_emalloc(num_of_params, sizeof(zval *), 0);
trav = params;
@@ -3289,7 +3365,11 @@ static sdlFunctionPtr find_function(sdlPtr sdl, xmlNodePtr func, zval* function_
if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
if (fnb->style == SOAP_DOCUMENT) {
- function = NULL;
+ if (func->children != NULL ||
+ (function->requestParameters != NULL &&
+ zend_hash_num_elements(function->requestParameters) > 0)) {
+ function = NULL;
+ }
}
}
if (sdl != NULL && function == NULL) {
@@ -4532,8 +4612,6 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
switch (type->kind) {
case XSD_TYPEKIND_SIMPLE:
- case XSD_TYPEKIND_LIST:
- case XSD_TYPEKIND_UNION:
if (type->encode) {
smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
smart_str_appendc(buf, ' ');
@@ -4542,6 +4620,40 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
}
smart_str_appendl(buf, type->name, strlen(type->name));
break;
+ case XSD_TYPEKIND_LIST:
+ smart_str_appendl(buf, "list ", 5);
+ smart_str_appendl(buf, type->name, strlen(type->name));
+ if (type->elements) {
+ sdlTypePtr *item_type;
+
+ smart_str_appendl(buf, " {", 2);
+ zend_hash_internal_pointer_reset_ex(type->elements, &pos);
+ if (zend_hash_get_current_data_ex(type->elements, (void **)&item_type, &pos) != FAILURE) {
+ smart_str_appendl(buf, (*item_type)->name, strlen((*item_type)->name));
+ }
+ smart_str_appendc(buf, '}');
+ }
+ break;
+ case XSD_TYPEKIND_UNION:
+ smart_str_appendl(buf, "union ", 6);
+ smart_str_appendl(buf, type->name, strlen(type->name));
+ if (type->elements) {
+ sdlTypePtr *item_type;
+ int first = 0;
+
+ smart_str_appendl(buf, " {", 2);
+ zend_hash_internal_pointer_reset_ex(type->elements, &pos);
+ while (zend_hash_get_current_data_ex(type->elements, (void **)&item_type, &pos) != FAILURE) {
+ if (!first) {
+ smart_str_appendc(buf, ',');
+ first = 0;
+ }
+ smart_str_appendl(buf, (*item_type)->name, strlen((*item_type)->name));
+ zend_hash_move_forward_ex(type->elements, &pos);
+ }
+ smart_str_appendc(buf, '}');
+ }
+ break;
case XSD_TYPEKIND_COMPLEX:
case XSD_TYPEKIND_RESTRICTION:
case XSD_TYPEKIND_EXTENSION:
diff --git a/ext/soap/tests/bugs/bug42086.phpt b/ext/soap/tests/bugs/bug42086.phpt
new file mode 100755
index 000000000..6edc06f87
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42086.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #42086 (SoapServer return Procedure '' not present for WSIBasic compliant wsdl)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$request = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><firstFunctionWithoutParam/></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+
+class firstFunctionWithoutParamResponse {
+ public $param;
+}
+
+function firstFunctionWithoutParam() {
+ $ret = new firstFunctionWithoutParamResponse();
+ $ret->param = "firstFunctionWithoutParam";
+ return $ret;
+}
+
+$server = new SoapServer(dirname(__FILE__).'/bug42086.wsdl',
+ array('features'=>SOAP_SINGLE_ELEMENT_ARRAYS));
+$server->addFunction('firstFunctionWithoutParam');
+$server->handle($request);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><firstFunctionWithoutParamReturn><param>firstFunctionWithoutParam</param></firstFunctionWithoutParamReturn></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug42086.wsdl b/ext/soap/tests/bugs/bug42086.wsdl
new file mode 100755
index 000000000..5ec3d956c
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42086.wsdl
@@ -0,0 +1,141 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!-- WSDL file generated by Zend Studio. -->
+
+<definitions name="LBAService" targetNamespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" xmlns:typens="http://xml.avaya.com/ws/device-management/distributed-enterprise" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.avaya.com/ws/device-management/distributed-enterprise">
+ <xsd:complexType name="firstFunctionClassParam">
+ <xsd:all>
+ <xsd:element name="param" type="xsd:string"/>
+ <xsd:element name="vectparam" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:all>
+ </xsd:complexType>
+ <xsd:complexType name="firstFunctionClassParamResponse">
+ <xsd:all>
+ <xsd:element name="param" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+ <xsd:complexType name="firstFunctionWithoutParamResponse">
+ <xsd:all>
+ <xsd:element name="param" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+ <xsd:complexType name="secondFunctionClassParam">
+ <xsd:all>
+ <xsd:element name="param" type="xsd:string"/>
+ <xsd:element name="vectparam" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:all>
+ </xsd:complexType>
+ <xsd:complexType name="secondFunctionClassParamResponse">
+ <xsd:all>
+ <xsd:element name="param" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+ <xsd:complexType name="secondFunctionWithoutParamResponse">
+ <xsd:all>
+ <xsd:element name="param" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:schema>
+ </types>
+ <message name="firstFunctionClassParam">
+ <part name="firstFunctionClassParam" type="typens:firstFunctionClassParam"/>
+ </message>
+ <message name="firstFunctionClassParamResponse">
+ <part name="firstFunctionClassParamReturn" type="typens:firstFunctionClassParamResponse"/>
+ </message>
+ <message name="firstFunctionWithoutParam"/>
+<!--
+ <message name="firstFunctionWithoutParam">
+ <part name="firstFunctionWithoutParam"/>
+ </message>
+-->
+ <message name="firstFunctionWithoutParamResponse">
+ <part name="firstFunctionWithoutParamReturn" type="typens:firstFunctionWithoutParamResponse"/>
+ </message>
+ <message name="secondFunctionClassParam">
+ <part name="secondFunctionClassParam" type="typens:secondFunctionClassParam"/>
+ </message>
+ <message name="secondFunctionClassParamResponse">
+ <part name="secondFunctionClassParamReturn" type="typens:secondFunctionClassParamResponse"/>
+ </message>
+ <message name="secondFunctionWithoutParam"/>
+ <message name="secondFunctionWithoutParamResponse">
+ <part name="secondFunctionWithoutParamReturn" type="typens:secondFunctionWithoutParamResponse"/>
+ </message>
+ <portType name="wsImpPortType">
+ <operation name="firstFunctionClassParam">
+ <documentation>
+ Enter description here...
+ </documentation>
+ <input message="typens:firstFunctionClassParam"/>
+ <output message="typens:firstFunctionClassParamResponse"/>
+ </operation>
+ <operation name="firstFunctionWithoutParam">
+ <documentation>
+ Enter description here...
+ </documentation>
+ <input message="typens:firstFunctionWithoutParam"/>
+ <output message="typens:firstFunctionWithoutParamResponse"/>
+ </operation>
+ <operation name="secondFunctionClassParam">
+ <documentation>
+ Enter description here...
+ </documentation>
+ <input message="typens:secondFunctionClassParam"/>
+ <output message="typens:secondFunctionClassParamResponse"/>
+ </operation>
+ <operation name="secondFunctionWithoutParam">
+ <documentation>
+ Enter description here...
+ </documentation>
+ <input message="typens:secondFunctionWithoutParam"/>
+ <output message="typens:secondFunctionWithoutParamResponse"/>
+ </operation>
+ </portType>
+ <binding name="wsImpBinding" type="typens:wsImpPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="firstFunctionClassParam">
+ <soap:operation soapAction="urn:wsImpAction"/>
+ <input>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </input>
+ <output>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </output>
+ </operation>
+ <operation name="firstFunctionWithoutParam">
+ <soap:operation soapAction="urn:wsImpAction"/>
+ <input>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </input>
+ <output>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </output>
+ </operation>
+ <operation name="secondFunctionClassParam">
+ <soap:operation soapAction="urn:wsImpAction"/>
+ <input>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </input>
+ <output>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </output>
+ </operation>
+ <operation name="secondFunctionWithoutParam">
+ <soap:operation soapAction="urn:wsImpAction"/>
+ <input>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </input>
+ <output>
+ <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="LBAService">
+ <port name="wsImpPort" binding="typens:wsImpBinding">
+ <soap:address location="test://"/>
+ </port>
+ </service>
+</definitions>
diff --git a/ext/soap/tests/bugs/bug42214.phpt b/ext/soap/tests/bugs/bug42214.phpt
new file mode 100755
index 000000000..aaad3a14f
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42214.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #42214 SoapServer sends clients internal PHP errors
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$request = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/server.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+
+function test() {
+ $a = $b;
+ obvious_error(); // will cause an error
+}
+
+$server = new SoapServer(NULL, array('uri' =>'http://localhost/server.php',
+ 'send_errors'=>0));
+$server->addFunction('test');
+$server->handle($request);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Internal Error</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug42326.phpt b/ext/soap/tests/bugs/bug42326.phpt
new file mode 100755
index 000000000..02ba9d01e
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42326.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Bug #42326 (SoapServer crash)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$request = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com/"><SOAP-ENV:Body><ns1:GetProductsRequest><time></time></ns1:GetProductsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+
+
+$soap_admin_classmap = array('productDetailsType' => 'SOAP_productDetailsType',
+ 'GetProductsRequest' => 'SOAP_GetProductsRequest',
+ 'GetProductsResponse' => 'SOAP_GetProductsResponse');
+
+class SOAP_productDetailsType {
+ public $id = 0;
+}
+
+class SOAP_GetProductsRequest {
+ public $time = '';
+}
+
+class SOAP_GetProductsResponse {
+ public $products;
+ function __construct(){
+ $this->products = new SOAP_productDetailsType();
+
+ }
+}
+
+class SOAP_Admin {
+ public function GetProducts($time){
+ return new SOAP_GetProductsResponse();
+ }
+}
+
+$soap = new SoapServer(dirname(__FILE__).'/bug42326.wsdl', array('classmap' => $soap_admin_classmap));
+$soap->setClass('SOAP_Admin');
+ob_start();
+$soap->handle($request);
+ob_end_clean();
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/soap/tests/bugs/bug42326.wsdl b/ext/soap/tests/bugs/bug42326.wsdl
new file mode 100755
index 000000000..a125ed8cd
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42326.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<wsdl:definitions name="OSCAdmin.wsdl"
+targetNamespace="http://www.example.com/"
+xmlns:tns="http://www.example.com/"
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+ <wsdl:types>
+
+ <xsd:schema targetNamespace="http://www.example.com/"
+ xmlns="http://www.w3.org/2000/10/XMLSchema">
+ <xsd:element name="productDetailsType">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="id" type="xsd:integer"/>
+
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+
+
+ <xsd:schema targetNamespace="http://www.example.com/"
+ xmlns="http://www.w3.org/2000/10/XMLSchema">
+ <xsd:element name="GetProductsRequest">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="time" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+
+ <xsd:schema targetNamespace="http://www.example.com/"
+ xmlns="http://www.w3.org/2000/10/XMLSchema">
+ <xsd:element name="GetProductsResponse">
+ <xsd:complexType>
+ <xsd:all>
+ <xsd:element name="products" type="tns:productDetailsType"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+
+
+ </wsdl:types>
+
+ <wsdl:message name="GetProductsRequest">
+ <wsdl:part name="in" element="tns:GetProductsRequest"/>
+ </wsdl:message>
+
+ <wsdl:message name="GetProductsResponse">
+ <wsdl:part name="out" element="tns:GetProductsResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="OSCAdminPortType">
+ <wsdl:operation name="GetProducts">
+ <wsdl:input message="tns:GetProductsRequest"/>
+ <wsdl:output message="tns:GetProductsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="OSCAdminSoapBinding" type="tns:OSCAdminPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="GetProducts">
+ <soap:operation soapAction=""/>
+ <wsdl:input name="in">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="out">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="OSCAdminService">
+ <wsdl:port name="OSCAdminPort" binding="tns:OSCAdminSoapBinding">
+ <soap:address location="test://"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/ext/soap/tests/bugs/bug42359.phpt b/ext/soap/tests/bugs/bug42359.phpt
new file mode 100755
index 000000000..27cb42d49
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42359.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #42326 (SoapServer crash)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$soap = new SoapClient(dirname(__FILE__)."/bug42359.wsdl");
+print_r($soap->__getTypes());
+?>
+--EXPECT--
+Array
+(
+ [0] => list listItem {anonymous1}
+ [1] => string anonymous1
+ [2] => string enumItem
+ [3] => list listItem2 {enumItem}
+)
+
diff --git a/ext/soap/tests/bugs/bug42359.wsdl b/ext/soap/tests/bugs/bug42359.wsdl
new file mode 100755
index 000000000..bc73adaec
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42359.wsdl
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<definitions name="listTest" targetNamespace="urn:listTest" xmlns:typens="urn:listTest" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:listTest">
+ <xsd:simpleType name="listItem">
+ <xsd:list>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="test1" />
+ <xsd:enumeration value="test2" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:list>
+ </xsd:simpleType>
+ <xsd:simpleType name="enumItem">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="test1" />
+ <xsd:enumeration value="test2" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="listItem2">
+ <xsd:list itemType="typens:enumItem"/>
+ </xsd:simpleType>
+ </xsd:schema>
+ </types>
+ <message name="testRequest">
+ <part name="item" type="typens:listItem"/>
+ </message>
+ <message name="testRequestResponse">
+ <part name="testRequestReturn" type="xsd:integer"/>
+ </message>
+ <portType name="listTestPortType">
+ <operation name="testRequest">
+ <documentation>
+ Test request
+ </documentation>
+ <input message="typens:testRequest"/>
+ <output message="typens:testRequestResponse"/>
+ </operation>
+ </portType>
+ <binding name="listTestBinding" type="typens:listTestPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="testRequest">
+ <soap:operation soapAction="urn:listTestAction"/>
+ <input>
+ <soap:body namespace="urn:listTest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body namespace="urn:listTest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="listTestService">
+ <port name="listTestPort" binding="typens:listTestBinding">
+ <soap:address location="http://test/service"/>
+ </port>
+ </service>
+</definitions>
diff --git a/ext/soap/tests/bugs/bug42488.phpt b/ext/soap/tests/bugs/bug42488.phpt
new file mode 100755
index 000000000..83120abec
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42488.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #42488 (SoapServer reports an encoding error and the error itself breaks)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$request = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="test:\" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:getBadUTF/></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+$soap = new SoapServer(NULL, array('uri'=>'test://'));
+function getBadUTF(){
+ return "stuff\x93thing";
+}
+$soap->addFunction('getBadUTF');
+$soap->handle($request);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SOAP-ERROR: Encoding: string 'stuff\x93...' is not a valid utf-8 string</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> \ No newline at end of file
diff --git a/ext/soap/tests/classmap004.phpt b/ext/soap/tests/classmap004.phpt
new file mode 100755
index 000000000..58f29f488
--- /dev/null
+++ b/ext/soap/tests/classmap004.phpt
@@ -0,0 +1,66 @@
+--TEST--
+SOAP Classmap 4: encoding of objects with __get()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ini_set("soap.wsdl_cache_enabled",0);
+
+class A {
+ public $a;
+ function __construct($a){
+ $this->x = $a;
+ }
+ function __get($name) {
+ return @$this->a[$name];
+ }
+ function __set($name, $val) {
+ $this->a[$name] = $val;
+ }
+ function __unset($name) {
+ unset($this->a[$name]);
+ }
+}
+
+class B extends A {
+ function __construct($a){
+ parent::__construct($a);
+ $this->y = $a + 1;
+ }
+}
+
+function f(){
+ return new B(5);
+}
+
+class LocalSoapClient extends SoapClient {
+
+ function __construct($wsdl, $options) {
+ parent::__construct($wsdl, $options);
+ $this->server = new SoapServer($wsdl, $options);
+ $this->server->addFunction("f");
+ }
+
+ function __doRequest($request, $location, $action, $version) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
+}
+
+$client = new LocalSoapClient(dirname(__FILE__)."/classmap003.wsdl",
+ array('classmap'=>array('A'=>'A','B'=>'B')));
+print_r($client->f());
+?>
+--EXPECT--
+B Object
+(
+ [a] => Array
+ (
+ [x] => 5
+ [y] => 6
+ )
+
+)
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index c0c75e22a..3ae93adcc 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.171.2.9.2.13 2007/07/24 11:35:08 jani Exp $ */
+/* $Id: sockets.c,v 1.171.2.9.2.14 2007/09/26 10:55:07 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -616,7 +616,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) /
}
/* }}} */
-/* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec]) U
+/* {{{ proto int socket_select(array &read_fds, array &write_fds, array &except_fds, int tv_sec[, int tv_usec]) U
Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */
PHP_FUNCTION(socket_select)
{
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 0ba3ff10a..4f409a0f7 100755
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.71.2.17.2.13 2007/07/20 10:53:56 tony2001 Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.14 2007/10/18 05:26:55 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1365,7 +1365,7 @@ SPL_METHOD(Array, hasChildren)
Create a sub iterator for the current element (same class as $this) */
SPL_METHOD(Array, getChildren)
{
- zval *object = getThis(), **entry;
+ zval *object = getThis(), **entry, *flags;
spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
@@ -1387,7 +1387,10 @@ SPL_METHOD(Array, getChildren)
RETURN_ZVAL(*entry, 0, 0);
}
- spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), &return_value, 0, *entry TSRMLS_CC);
+ MAKE_STD_ZVAL(flags);
+ ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER);
+ spl_instantiate_arg_ex2(intern->std.ce, &return_value, 0, *entry, flags TSRMLS_CC);
+ zval_ptr_dtor(&flags);
}
/* }}} */
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 43f13a534..930b83385 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_directory.c,v 1.45.2.27.2.22 2007/08/21 22:45:53 johannes Exp $ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.23 2007/09/22 15:55:35 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -862,7 +862,7 @@ SPL_METHOD(SplFileInfo, getRealPath)
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
}
- if (intern->file_name_len && VCWD_REALPATH(intern->file_name, buff)) {
+ if (intern->file_name && VCWD_REALPATH(intern->file_name, buff)) {
#ifdef ZTS
if (VCWD_ACCESS(buff, F_OK)) {
RETVAL_FALSE;
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 6426e2d8a..8bd107bbf 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.73.2.30.2.28 2007/05/11 00:15:25 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.29 2007/10/18 05:26:55 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1124,15 +1124,17 @@ static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more T
spl_dual_it_free(intern TSRMLS_CC);
if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data TSRMLS_CC);
- intern->current.data = *data;
- intern->current.data->refcount++;
+ if (data && *data) {
+ intern->current.data = *data;
+ intern->current.data->refcount++;
+ }
if (intern->inner.iterator->funcs->get_current_key) {
intern->current.key_type = intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &intern->current.str_key, &intern->current.str_key_len, &intern->current.int_key TSRMLS_CC);
} else {
intern->current.key_type = HASH_KEY_IS_LONG;
intern->current.int_key = intern->current.pos;
}
- return SUCCESS;
+ return EG(exception) ? FAILURE : SUCCESS;
}
return FAILURE;
}
diff --git a/ext/spl/tests/bug42259.phpt b/ext/spl/tests/bug42259.phpt
index 22c8bc5d6..ceefe78e5 100644
--- a/ext/spl/tests/bug42259.phpt
+++ b/ext/spl/tests/bug42259.phpt
@@ -1,10 +1,12 @@
--TEST--
Bug #42259 (SimpleXMLIterator loses ancestry)
--SKIPIF--
+<?php
if (!extension_loaded("spl")) print "skip";
if (!extension_loaded('simplexml')) print 'skip';
if (!extension_loaded("libxml")) print "skip LibXML not present";
if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available';
+?>
--FILE--
<?php
$xml =<<<EOF
diff --git a/ext/spl/tests/bug42654.phpt b/ext/spl/tests/bug42654.phpt
new file mode 100755
index 000000000..bac87e231
--- /dev/null
+++ b/ext/spl/tests/bug42654.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Bug #42654 (RecursiveIteratorIterator modifies only part of leaves)
+--FILE--
+<?php
+$data = array(1 => 'val1',
+ array(2 => 'val2',
+ array(3 => 'val3'),
+ ),
+ 4 => 'val4'
+ );
+
+$iterator = new RecursiveIteratorIterator(new
+RecursiveArrayIterator($data));
+foreach($iterator as $foo) {
+ $key = $iterator->key();
+ echo "update $key\n";
+ var_dump($iterator->getInnerIterator());
+ $iterator->offsetSet($key, 'alter');
+ var_dump($iterator->getInnerIterator());
+}
+$copy = $iterator->getArrayCopy();
+var_dump($copy);
+?>
+--EXPECTF--
+update 1
+object(RecursiveArrayIterator)#%d (3) {
+ [1]=>
+ string(4) "val1"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(4) "val4"
+}
+object(RecursiveArrayIterator)#%d (3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(4) "val4"
+}
+update 2
+object(RecursiveArrayIterator)#%d (2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+}
+object(RecursiveArrayIterator)#%d (2) {
+ [2]=>
+ string(5) "alter"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+}
+update 3
+object(RecursiveArrayIterator)#%d (1) {
+ [3]=>
+ string(4) "val3"
+}
+object(RecursiveArrayIterator)#%d (1) {
+ [3]=>
+ string(5) "alter"
+}
+update 4
+object(RecursiveArrayIterator)#%d (3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(4) "val4"
+}
+object(RecursiveArrayIterator)#%d (3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(5) "alter"
+}
+array(3) {
+ [1]=>
+ string(5) "alter"
+ [2]=>
+ array(2) {
+ [2]=>
+ string(4) "val2"
+ [3]=>
+ array(1) {
+ [3]=>
+ string(4) "val3"
+ }
+ }
+ [4]=>
+ string(5) "alter"
+}
diff --git a/ext/spl/tests/bug42703.phpt b/ext/spl/tests/bug42703.phpt
new file mode 100755
index 000000000..5c52763cd
--- /dev/null
+++ b/ext/spl/tests/bug42703.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Bug #42703 (Exception raised in an iterator::current() causes segfault in FilterIterator)
+--FILE--
+<?php
+class BlaIterator implements Iterator
+{
+ public function rewind() { }
+
+ public function next() { }
+
+ public function valid() {
+ return true;
+ }
+
+ public function current()
+ {
+ throw new Exception('boo');
+ }
+
+ public function key() { }
+}
+
+$it = new BlaIterator();
+$itit = new IteratorIterator($it);
+
+try {
+ foreach($itit as $key => $value) {
+ echo $key, $value;
+ }
+}
+catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+var_dump($itit->current());
+var_dump($itit->key());
+?>
+--EXPECTF--
+string(3) "boo"
+NULL
+NULL
diff --git a/ext/standard/array.c b/ext/standard/array.c
index cc85ddc20..e3f2b7609 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.308.2.21.2.32 2007/08/10 12:17:26 jani Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.42 2007/11/06 13:28:21 jani Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -78,6 +78,7 @@
#define DIFF_NORMAL 1
#define DIFF_KEY 2
#define DIFF_ASSOC 6
+#define DIFF_COMP_DATA_NONE -1
#define DIFF_COMP_DATA_INTERNAL 0
#define DIFF_COMP_DATA_USER 1
#define DIFF_COMP_KEY_INTERNAL 0
@@ -86,6 +87,7 @@
#define INTERSECT_NORMAL 1
#define INTERSECT_KEY 2
#define INTERSECT_ASSOC 6
+#define INTERSECT_COMP_DATA_NONE -1
#define INTERSECT_COMP_DATA_INTERNAL 0
#define INTERSECT_COMP_DATA_USER 1
#define INTERSECT_COMP_KEY_INTERNAL 0
@@ -616,7 +618,7 @@ static int array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
/* check if comparison function is valid */
#define PHP_ARRAY_CMP_FUNC_CHECK(func_name) \
if (!zend_is_callable(*func_name, 0, NULL)) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid comparison function."); \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid comparison function"); \
BG(user_compare_fci_cache) = old_user_compare_fci_cache; \
BG(user_compare_func_name) = old_compare_func; \
RETURN_FALSE; \
@@ -962,7 +964,7 @@ PHP_FUNCTION(min)
zval **result;
if (argc<=0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Atleast one value should be passed");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "At least one value should be passed");
RETURN_NULL();
}
set_compare_func(SORT_REGULAR TSRMLS_CC);
@@ -975,7 +977,7 @@ PHP_FUNCTION(min)
if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) {
RETVAL_ZVAL(*result, 1, 0);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain atleast one element");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element");
RETURN_FALSE;
}
} else {
@@ -1012,7 +1014,7 @@ PHP_FUNCTION(max)
zval **result;
if (argc<=0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Atleast one value should be passed");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "At least one value should be passed");
RETURN_NULL();
}
set_compare_func(SORT_REGULAR TSRMLS_CC);
@@ -1025,7 +1027,7 @@ PHP_FUNCTION(max)
if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) {
RETVAL_ZVAL(*result, 1, 0);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain atleast one element");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element");
RETURN_FALSE;
}
} else {
@@ -1077,11 +1079,13 @@ static int php_array_walk(HashTable *target_hash, zval **userdata, int recursive
SEPARATE_ZVAL_TO_MAKE_IS_REF(args[0]);
thash = HASH_OF(*(args[0]));
- if (thash == target_hash) {
+ if (thash->nApplyCount > 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
return 0;
}
+ thash->nApplyCount++;
php_array_walk(thash, userdata, recursive TSRMLS_CC);
+ thash->nApplyCount--;
} else {
zend_fcall_info fci;
@@ -1840,7 +1844,7 @@ PHP_FUNCTION(shuffle)
{
zval *array;
- if (zend_parse_parameters(1 TSRMLS_CC, "a", &array) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
@@ -2869,6 +2873,166 @@ PHP_FUNCTION(array_unique)
}
/* }}} */
+static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
+{
+ zval result;
+ zval *first;
+ zval *second;
+
+ first = *((zval **) a);
+ second = *((zval **) b);
+
+ if (string_compare_function(&result, first, second TSRMLS_CC) == FAILURE) {
+ return 0;
+ }
+
+ if (Z_TYPE(result) == IS_DOUBLE) {
+ if (Z_DVAL(result) < 0) {
+ return -1;
+ } else if (Z_DVAL(result) > 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ convert_to_long(&result);
+
+ if (Z_LVAL(result) < 0) {
+ return -1;
+ } else if (Z_LVAL(result) > 0) {
+ return 1;
+ }
+
+ return 0;
+}
+/* }}} */
+
+static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
+{
+ zval **args[2];
+ zval *retval_ptr;
+ zend_fcall_info fci;
+
+ args[0] = (zval **) a;
+ args[1] = (zval **) b;
+
+ fci.size = sizeof(fci);
+ fci.function_table = EG(function_table);
+ fci.function_name = *BG(user_compare_func_name);
+ fci.symbol_table = NULL;
+ fci.object_pp = NULL;
+ fci.retval_ptr_ptr = &retval_ptr;
+ fci.param_count = 2;
+ fci.params = args;
+ fci.no_separation = 0;
+
+ if (zend_call_function(&fci, &BG(user_compare_fci_cache) TSRMLS_CC)== SUCCESS
+ && retval_ptr) {
+ long retval;
+
+ convert_to_long_ex(&retval_ptr);
+ retval = Z_LVAL_P(retval_ptr);
+ zval_ptr_dtor(&retval_ptr);
+ return retval < 0 ? -1 : retval > 0 ? 1 : 0;;
+ } else {
+ return 0;
+ }
+}
+/* }}} */
+
+static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
+{
+ Bucket *p;
+ int argc, i;
+ zval ***args;
+ int (*intersect_data_compare_func)(zval **, zval ** TSRMLS_DC) = NULL;
+ zend_bool ok;
+ zval **data;
+
+ /* Get the argument count */
+ argc = ZEND_NUM_ARGS();
+ /* Allocate arguments array and get the arguments, checking for errors. */
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
+ if (argc < 2 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
+ efree(args);
+ WRONG_PARAM_COUNT;
+ }
+ if (data_compare_type == INTERSECT_COMP_DATA_USER) {
+ char *callback_name;
+
+ if (argc < 3) {
+ efree(args);
+ WRONG_PARAM_COUNT;
+ }
+ argc--;
+ if (!zend_is_callable(*args[argc], 0, &callback_name)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
+ efree(callback_name);
+ efree(args);
+ return;
+ }
+ efree(callback_name);
+ intersect_data_compare_func = zval_user_compare;
+ BG(user_compare_func_name) = args[argc];
+ } else if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL) {
+ intersect_data_compare_func = zval_compare;
+ }
+
+ if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #1 is not an array");
+ RETVAL_NULL();
+ goto out;
+ }
+
+ array_init(return_value);
+
+ for (p = Z_ARRVAL_PP(args[0])->pListHead; p != NULL; p = p->pListNext) {
+ if (p->nKeyLength == 0) {
+ ok = 1;
+ for (i = 1; i < argc; i++) {
+ if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1);
+ zval_dtor(return_value);
+ RETVAL_NULL();
+ goto out;
+ } else if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), p->h, (void**)&data) == FAILURE ||
+ (intersect_data_compare_func &&
+ intersect_data_compare_func((zval**)p->pData, data TSRMLS_CC) != 0)) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ (*((zval**)p->pData))->refcount++;
+ zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, p->pData, sizeof(zval*), NULL);
+ }
+ } else {
+ ok = 1;
+ for (i = 1; i < argc; i++) {
+ if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1);
+ zval_dtor(return_value);
+ RETVAL_NULL();
+ goto out;
+ } else if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p->arKey, p->nKeyLength, p->h, (void**)&data) == FAILURE ||
+ (intersect_data_compare_func &&
+ intersect_data_compare_func((zval**)p->pData, data TSRMLS_CC) != 0)) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ (*((zval**)p->pData))->refcount++;
+ zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval*), NULL);
+ }
+ }
+ }
+out:
+ efree(args);
+}
+/* }}} */
+
static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_compare_type, int key_compare_type) /* {{{ */
{
zval ***args = NULL;
@@ -3011,10 +3175,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
intersect_data_compare_func = array_user_compare;
BG(user_compare_func_name) = args[arr_argc + 1];/* data - key */
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug.", data_compare_type, key_compare_type);
+ efree(args);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type);
return;
}
} else {
+ efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior);
return;
}
@@ -3033,6 +3199,9 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
hash = HASH_OF(*args[i]);
list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
if (!list) {
+ efree(args);
+ efree(lists);
+ efree(ptrs);
RETURN_FALSE;
}
lists[i] = list;
@@ -3185,8 +3354,7 @@ out:
Returns the entries of arr1 that have keys which are present in all the other arguments. Kind of equivalent to array_diff(array_keys($arr1), array_keys($arr2)[,array_keys(...)]). Equivalent of array_intersect_assoc() but does not do compare of the data. */
PHP_FUNCTION(array_intersect_key)
{
- php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_KEY,
- INTERSECT_COMP_DATA_INTERNAL, INTERSECT_COMP_KEY_INTERNAL);
+ php_array_intersect_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_COMP_DATA_NONE);
}
/* }}} */
@@ -3221,8 +3389,7 @@ PHP_FUNCTION(array_uintersect)
Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check */
PHP_FUNCTION(array_intersect_assoc)
{
- php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_ASSOC,
- INTERSECT_COMP_DATA_INTERNAL, INTERSECT_COMP_KEY_INTERNAL);
+ php_array_intersect_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_COMP_DATA_INTERNAL);
}
/* }}} */
@@ -3230,8 +3397,7 @@ PHP_FUNCTION(array_intersect_assoc)
Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Data is compared by using an user-supplied callback. */
PHP_FUNCTION(array_uintersect_assoc)
{
- php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_ASSOC,
- INTERSECT_COMP_DATA_USER, INTERSECT_COMP_KEY_INTERNAL);
+ php_array_intersect_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_COMP_DATA_USER);
}
/* }}} */
@@ -3253,6 +3419,98 @@ PHP_FUNCTION(array_uintersect_uassoc)
}
/* }}} */
+static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
+{
+ Bucket *p;
+ int argc, i;
+ zval ***args;
+ int (*diff_data_compare_func)(zval **, zval ** TSRMLS_DC) = NULL;
+ zend_bool ok;
+ zval **data;
+
+ /* Get the argument count */
+ argc = ZEND_NUM_ARGS();
+ /* Allocate arguments array and get the arguments, checking for errors. */
+ args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
+ if (argc < 2 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
+ efree(args);
+ WRONG_PARAM_COUNT;
+ }
+ if (data_compare_type == DIFF_COMP_DATA_USER) {
+ char *callback_name;
+
+ if (argc < 3) {
+ efree(args);
+ WRONG_PARAM_COUNT;
+ }
+ argc--;
+ if (!zend_is_callable(*args[argc], 0, &callback_name)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback %s", callback_name);
+ efree(callback_name);
+ efree(args);
+ return;
+ }
+ efree(callback_name);
+ diff_data_compare_func = zval_user_compare;
+ BG(user_compare_func_name) = args[argc];
+ } else if (data_compare_type == DIFF_COMP_DATA_INTERNAL) {
+ diff_data_compare_func = zval_compare;
+ }
+
+ if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #1 is not an array");
+ RETVAL_NULL();
+ goto out;
+ }
+
+ array_init(return_value);
+
+ for (p = Z_ARRVAL_PP(args[0])->pListHead; p != NULL; p = p->pListNext) {
+ if (p->nKeyLength == 0) {
+ ok = 1;
+ for (i = 1; i < argc; i++) {
+ if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1);
+ zval_dtor(return_value);
+ RETVAL_NULL();
+ goto out;
+ } else if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), p->h, (void**)&data) == SUCCESS &&
+ (!diff_data_compare_func ||
+ diff_data_compare_func((zval**)p->pData, data TSRMLS_CC) == 0)) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ (*((zval**)p->pData))->refcount++;
+ zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, p->pData, sizeof(zval*), NULL);
+ }
+ } else {
+ ok = 1;
+ for (i = 1; i < argc; i++) {
+ if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is not an array", i + 1);
+ zval_dtor(return_value);
+ RETVAL_NULL();
+ goto out;
+ } else if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p->arKey, p->nKeyLength, p->h, (void**)&data) == SUCCESS &&
+ (!diff_data_compare_func ||
+ diff_data_compare_func((zval**)p->pData, data TSRMLS_CC) == 0)) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok) {
+ (*((zval**)p->pData))->refcount++;
+ zend_hash_quick_update(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength, p->h, p->pData, sizeof(zval*), NULL);
+ }
+ }
+ }
+out:
+ efree(args);
+}
+/* }}} */
+
static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_compare_type, int key_compare_type) /* {{{ */
{
zval ***args = NULL;
@@ -3395,10 +3653,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
diff_data_compare_func = array_user_compare;
BG(user_compare_func_name) = args[arr_argc + 1];/* data - key*/
} else {
+ efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type);
return;
}
} else {
+ efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior);
return;
}
@@ -3417,6 +3677,9 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
hash = HASH_OF(*args[i]);
list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
if (!list) {
+ efree(args);
+ efree(ptrs);
+ efree(lists);
RETURN_FALSE;
}
lists[i] = list;
@@ -3567,8 +3830,7 @@ out:
Returns the entries of arr1 that have keys which are not present in any of the others arguments. This function is like array_diff() but works on the keys instead of the values. The associativity is preserved. */
PHP_FUNCTION(array_diff_key)
{
- php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_KEY,
- DIFF_COMP_DATA_INTERNAL, DIFF_COMP_KEY_INTERNAL);
+ php_array_diff_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_COMP_DATA_NONE);
}
/* }}} */
@@ -3603,8 +3865,7 @@ PHP_FUNCTION(array_udiff)
Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal */
PHP_FUNCTION(array_diff_assoc)
{
- php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_ASSOC,
- DIFF_COMP_DATA_INTERNAL, DIFF_COMP_KEY_INTERNAL);
+ php_array_diff_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_COMP_DATA_INTERNAL);
}
/* }}} */
@@ -3621,8 +3882,7 @@ PHP_FUNCTION(array_diff_uassoc)
Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function. */
PHP_FUNCTION(array_udiff_assoc)
{
- php_array_diff(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_ASSOC,
- DIFF_COMP_DATA_USER, DIFF_COMP_KEY_INTERNAL);
+ php_array_diff_key(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIFF_COMP_DATA_USER);
}
/* }}} */
@@ -4341,6 +4601,8 @@ PHP_FUNCTION(array_map)
efree(args);
efree(array_pos);
zval_dtor(return_value);
+ zval_ptr_dtor(&null);
+ efree(params);
RETURN_NULL();
}
}
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 9ef859430..43b3b1407 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.725.2.31.2.61 2007/08/16 23:05:43 jani Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.66 2007/10/22 07:37:20 dmitry Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -50,6 +50,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#include <time.h>
#include <stdio.h>
+#ifndef PHP_WIN32
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
#ifdef NETWARE
#include <netinet/in.h>
#endif
@@ -4336,11 +4341,12 @@ PHP_FUNCTION(ip2long)
if (Z_STRLEN_PP(str) == 0 || (ip = inet_addr(Z_STRVAL_PP(str))) == INADDR_NONE) {
/* the only special case when we should return -1 ourselves,
- * because inet_addr() considers it wrong.
+ * because inet_addr() considers it wrong. We return 0xFFFFFFFF and
+ * not -1 or ~0 because of 32/64bit issues.
*/
if (Z_STRLEN_PP(str) == sizeof("255.255.255.255") - 1 &&
!memcmp(Z_STRVAL_PP(str), "255.255.255.255", sizeof("255.255.255.255") - 1)) {
- RETURN_LONG(-1);
+ RETURN_LONG(0xFFFFFFFF);
}
RETURN_FALSE;
@@ -4495,7 +4501,7 @@ PHP_FUNCTION(putenv)
}
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter syntax.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter syntax");
RETURN_FALSE;
}
/* }}} */
@@ -4809,7 +4815,7 @@ PHP_FUNCTION(time_sleep_until)
c_ts = (double)(d_ts - tm.tv_sec - tm.tv_usec / 1000000.00);
if (c_ts < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sleep until to time is less than current time.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sleep until to time is less than current time");
RETURN_FALSE;
}
@@ -6074,6 +6080,10 @@ PHP_FUNCTION(move_uploaded_file)
zval **path, **new_path;
zend_bool successful = 0;
+#ifndef PHP_WIN32
+ int oldmask; int ret;
+#endif
+
if (!SG(rfc1867_uploaded_files)) {
RETURN_FALSE;
}
@@ -6099,6 +6109,16 @@ PHP_FUNCTION(move_uploaded_file)
VCWD_UNLINK(Z_STRVAL_PP(new_path));
if (VCWD_RENAME(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path)) == 0) {
successful = 1;
+#ifndef PHP_WIN32
+ oldmask = umask(077);
+ umask(oldmask);
+
+ ret = VCWD_CHMOD(Z_STRVAL_PP(new_path), 0666 & ~oldmask);
+
+ if (ret == -1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ }
+#endif
} else if (php_copy_file_ex(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path), STREAM_DISABLE_OPEN_BASEDIR TSRMLS_CC) == SUCCESS) {
VCWD_UNLINK(Z_STRVAL_PP(path));
successful = 1;
@@ -6113,13 +6133,14 @@ PHP_FUNCTION(move_uploaded_file)
}
/* }}} */
-
+/* {{{ php_simple_ini_parser_cb
+ */
static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, zval *arr)
{
zval *element;
switch (callback_type) {
-
+
case ZEND_INI_PARSER_ENTRY:
if (!arg2) {
/* bare string - nothing to do */
@@ -6129,7 +6150,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
*element = *arg2;
zval_copy_ctor(element);
INIT_PZVAL(element);
- zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
+ zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &element, sizeof(zval *), NULL);
break;
case ZEND_INI_PARSER_POP_ENTRY:
@@ -6141,7 +6162,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
break;
}
- if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0]=='0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
+ if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) {
ulong key = (ulong) zend_atoi(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
if (zend_hash_index_find(Z_ARRVAL_P(arr), key, (void **) &find_hash) == FAILURE) {
ALLOC_ZVAL(hash);
@@ -6153,12 +6174,12 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
hash = *find_hash;
}
} else {
- if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void **) &find_hash) == FAILURE) {
+ if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_hash) == FAILURE) {
ALLOC_ZVAL(hash);
INIT_PZVAL(hash);
array_init(hash);
- zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &hash, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &hash, sizeof(zval *), NULL);
} else {
hash = *find_hash;
}
@@ -6174,7 +6195,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
*element = *arg2;
zval_copy_ctor(element);
INIT_PZVAL(element);
- add_next_index_zval(hash, element);
+ add_next_index_zval(hash, element);
}
break;
@@ -6182,7 +6203,10 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type,
break;
}
}
+/* }}} */
+/* {{{ php_ini_parser_cb_with_sections
+ */
static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback_type, zval *arr)
{
TSRMLS_FETCH();
@@ -6190,7 +6214,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback
if (callback_type == ZEND_INI_PARSER_SECTION) {
MAKE_STD_ZVAL(BG(active_ini_file_section));
array_init(BG(active_ini_file_section));
- zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &BG(active_ini_file_section), sizeof(zval *), NULL);
+ zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL);
} else if (arg2) {
zval *active_arr;
@@ -6203,7 +6227,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback
php_simple_ini_parser_cb(arg1, arg2, callback_type, active_arr);
}
}
-
+/* }}} */
/* {{{ proto array parse_ini_file(string filename [, bool process_sections])
Parse configuration file */
@@ -6226,9 +6250,9 @@ PHP_FUNCTION(parse_ini_file)
if (zend_get_parameters_ex(2, &filename, &process_sections) == FAILURE) {
RETURN_FALSE;
}
-
+
convert_to_boolean_ex(process_sections);
-
+
if (Z_BVAL_PP(process_sections)) {
BG(active_ini_file_section) = NULL;
ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
@@ -6236,7 +6260,7 @@ PHP_FUNCTION(parse_ini_file)
ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
}
break;
-
+
default:
ZEND_WRONG_PARAM_COUNT();
break;
@@ -6247,7 +6271,7 @@ PHP_FUNCTION(parse_ini_file)
memset(&fh, 0, sizeof(fh));
fh.filename = Z_STRVAL_PP(filename);
Z_TYPE(fh) = ZEND_HANDLE_FILENAME;
-
+
array_init(return_value);
zend_parse_ini_file(&fh, 0, ini_parser_cb, return_value);
}
@@ -6268,7 +6292,7 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
prefix_len = va_arg(args, uint);
if (!prefix_len && !hash_key->nKeyLength) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard");
return 0;
}
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index bd9cafa57..3e661fd9b 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: browscap.c,v 1.85.2.2.2.3 2007/03/07 00:52:40 iliaa Exp $ */
+/* $Id: browscap.c,v 1.85.2.2.2.4 2007/10/04 13:31:10 jani Exp $ */
#include "php.h"
#include "php_regex.h"
@@ -290,7 +290,7 @@ PHP_FUNCTION(get_browser)
char *browscap = INI_STR("browscap");
if (!browscap || !browscap[0]) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "browscap ini directive not set.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "browscap ini directive not set");
RETURN_FALSE;
}
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 0c90abd51..a3f540d2e 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dir.c,v 1.147.2.3.2.10 2007/08/22 14:59:44 jani Exp $ */
+/* $Id: dir.c,v 1.147.2.3.2.12 2007/09/19 22:37:58 iliaa Exp $ */
/* {{{ includes/startup/misc */
@@ -396,11 +396,17 @@ PHP_FUNCTION(glob)
glob_t globbuf;
int n;
int ret;
+ zend_bool basedir_limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE) {
return;
}
+ if (pattern_len >= MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pattern exceeds the maximum allowed length of %d characters", MAXPATHLEN);
+ RETURN_FALSE;
+ }
+
if ((GLOB_AVAILABLE_FLAGS & flags) != flags) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "At least one of the passed flags is invalid or not supported on this platform");
RETURN_FALSE;
@@ -424,22 +430,7 @@ PHP_FUNCTION(glob)
}
#endif
- if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
- int pattern_len = strlen(pattern);
- char *basename = estrndup(pattern, pattern_len);
-
- php_dirname(basename, pattern_len);
- if (PG(safe_mode) && (!php_checkuid(basename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- efree(basename);
- RETURN_FALSE;
- }
- if (php_check_open_basedir(basename TSRMLS_CC)) {
- efree(basename);
- RETURN_FALSE;
- }
- efree(basename);
- }
-
+
memset(&globbuf, 0, sizeof(glob_t));
globbuf.gl_offs = 0;
if (0 != (ret = glob(pattern, flags & GLOB_FLAGMASK, NULL, &globbuf))) {
@@ -453,8 +444,7 @@ PHP_FUNCTION(glob)
can be used for simple glob() calls without further error
checking.
*/
- array_init(return_value);
- return;
+ goto no_results;
}
#endif
RETURN_FALSE;
@@ -462,12 +452,29 @@ PHP_FUNCTION(glob)
/* now catch the FreeBSD style of "no matches" */
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
+no_results:
+ if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
+ struct stat s;
+
+ if (0 != VCWD_STAT(pattern, &s) || S_IFDIR != (s.st_mode & S_IFMT)) {
+ RETURN_FALSE;
+ }
+ }
array_init(return_value);
return;
}
array_init(return_value);
for (n = 0; n < globbuf.gl_pathc; n++) {
+ if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
+ if (PG(safe_mode) && (!php_checkuid(globbuf.gl_pathv[n], NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ basedir_limit = 1;
+ continue;
+ } else if (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0 TSRMLS_CC)) {
+ basedir_limit = 1;
+ continue;
+ }
+ }
/* we need to do this everytime since GLOB_ONLYDIR does not guarantee that
* all directories will be filtered. GNU libc documentation states the
* following:
@@ -491,6 +498,11 @@ PHP_FUNCTION(glob)
}
globfree(&globbuf);
+
+ if (basedir_limit && !zend_hash_num_elements(Z_ARRVAL_P(return_value))) {
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
}
/* }}} */
#endif
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 75d8e2e89..09f186cf0 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dl.c,v 1.106.2.1.2.2 2007/02/23 00:37:35 iliaa Exp $ */
+/* $Id: dl.c,v 1.106.2.1.2.5 2007/09/18 20:19:34 stas Exp $ */
#include "php.h"
#include "dl.h"
@@ -73,6 +73,11 @@ PHP_FUNCTION(dl)
RETURN_FALSE;
}
+ if (Z_STRLEN_PP(file) >= MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File name exceeds the maximum allowed length of %d characters", MAXPATHLEN);
+ RETURN_FALSE;
+ }
+
if ((strncmp(sapi_module.name, "cgi", 3)!=0) &&
(strcmp(sapi_module.name, "cli")!=0) &&
(strncmp(sapi_module.name, "embed", 5)!=0)) {
@@ -125,6 +130,13 @@ void php_dl(zval *file, int type, zval *return_value, int start_now TSRMLS_DC)
if (extension_dir && extension_dir[0]){
int extension_dir_len = strlen(extension_dir);
+ if (type == MODULE_TEMPORARY) {
+ if (strchr(Z_STRVAL_P(file), '/') != NULL || strchr(Z_STRVAL_P(file), DEFAULT_SLASH) != NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Temporary module name should contain only filename");
+ RETURN_FALSE;
+ }
+ }
+
if (IS_SLASH(extension_dir[extension_dir_len-1])) {
spprintf(&libpath, 0, "%s%s", extension_dir, Z_STRVAL_P(file));
} else {
@@ -189,8 +201,9 @@ void php_dl(zval *file, int type, zval *return_value, int start_now TSRMLS_DC)
int zend_api;
unsigned char zend_debug, zts;
- if(( ((struct pre_4_1_0_module_entry *)module_entry)->zend_api > 20000000)
- &&(((struct pre_4_1_0_module_entry *)module_entry)->zend_api < 20010901)) {
+ if ((((struct pre_4_1_0_module_entry *)module_entry)->zend_api > 20000000) &&
+ (((struct pre_4_1_0_module_entry *)module_entry)->zend_api < 20010901)
+ ) {
name = ((struct pre_4_1_0_module_entry *)module_entry)->name;
zend_api = ((struct pre_4_1_0_module_entry *)module_entry)->zend_api;
zend_debug = ((struct pre_4_1_0_module_entry *)module_entry)->zend_debug;
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index eb44b1d72..8f999c39f 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -16,7 +16,7 @@
| Ilia Alshanetsky <iliaa@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.113.2.3.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: exec.c,v 1.113.2.3.2.2 2007/10/04 13:31:11 jani Exp $ */
#include <stdio.h>
#include "php.h"
@@ -463,7 +463,7 @@ PHP_FUNCTION(proc_nice)
errno = 0;
nice(pri);
if (errno) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only a super user may attempt to increase the priority of a process.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only a super user may attempt to increase the priority of a process");
RETURN_FALSE;
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 9dd377ee7..e10295496 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.6.2.26 2007/08/12 17:09:59 iliaa Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28 2007/09/04 12:51:49 iliaa Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -610,7 +610,7 @@ PHP_FUNCTION(file_put_contents)
RETURN_FALSE;
}
- if (flags & LOCK_EX && php_stream_lock(stream, LOCK_EX)) {
+ if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) {
php_stream_close(stream);
RETURN_FALSE;
}
@@ -2518,6 +2518,11 @@ PHP_FUNCTION(fnmatch)
== FAILURE)
return;
+ if (filename_len >= MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Filename exceeds the maximum allowed length of %d characters", MAXPATHLEN);
+ RETURN_FALSE;
+ }
+
RETURN_BOOL( ! fnmatch( pattern, filename, flags ));
}
/* }}} */
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index c2cbaa6c5..df60b2e2d 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.136.2.8.2.13 2007/07/23 23:03:09 iliaa Exp $ */
+/* $Id: filestat.c,v 1.136.2.8.2.15 2007/10/31 13:23:06 jani Exp $ */
#include "php.h"
#include "safe_mode.h"
@@ -698,14 +698,10 @@ PHP_FUNCTION(touch)
/* }}} */
#endif
-/* {{{ proto void clearstatcache(void)
- Clear file stat cache */
-PHP_FUNCTION(clearstatcache)
+/* {{{ php_clear_stat_cache()
+*/
+PHPAPI void php_clear_stat_cache(TSRMLS_D)
{
- if (ZEND_NUM_ARGS()) {
- WRONG_PARAM_COUNT;
- }
-
if (BG(CurrentStatFile)) {
efree(BG(CurrentStatFile));
BG(CurrentStatFile) = NULL;
@@ -718,6 +714,17 @@ PHP_FUNCTION(clearstatcache)
}
/* }}} */
+/* {{{ proto void clearstatcache(void)
+ Clear file stat cache */
+PHP_FUNCTION(clearstatcache)
+{
+ if (ZEND_NUM_ARGS()) {
+ WRONG_PARAM_COUNT;
+ }
+ php_clear_stat_cache(TSRMLS_C);
+}
+/* }}} */
+
#define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT)
#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK)
#define IS_ABLE_CHECK(__t) ((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X)
@@ -821,7 +828,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
gid_t *gids;
groups = getgroups(0, NULL);
- if(groups) {
+ if(groups > 0) {
gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0);
n=getgroups(groups, gids);
for(i=0;i<n;i++){
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index c287bd551..763272460 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filters.c,v 1.44.2.6.2.4 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: filters.c,v 1.44.2.6.2.5 2007/10/04 13:31:11 jani Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1880,7 +1880,7 @@ static php_stream_filter *consumed_filter_create(const char *filtername, zval *f
/* Create this filter */
data = pecalloc(1, sizeof(php_consumed_filter_data), persistent);
if (!data) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", sizeof(php_consumed_filter_data));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", sizeof(php_consumed_filter_data));
return NULL;
}
data->persistent = persistent;
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 736e50915..46c782536 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: formatted_print.c,v 1.82.2.1.2.16 2007/06/03 09:12:04 shire Exp $ */
+/* $Id: formatted_print.c,v 1.82.2.1.2.17 2007/10/04 13:31:11 jani Exp $ */
#include <math.h> /* modf() */
#include "php.h"
@@ -445,7 +445,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC
if (argnum <= 0) {
efree(result);
efree(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument number must be greater than zero.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument number must be greater than zero");
return NULL;
}
@@ -487,7 +487,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC
if ((width = php_sprintf_getnumber(format, &inpos)) < 0) {
efree(result);
efree(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Width must be greater than zero and less than %d.", INT_MAX);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Width must be greater than zero and less than %d", INT_MAX);
return NULL;
}
adjusting |= ADJ_WIDTH;
@@ -504,7 +504,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC
if ((precision = php_sprintf_getnumber(format, &inpos)) < 0) {
efree(result);
efree(args);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Precision must be greater than zero and less than %d.", INT_MAX);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Precision must be greater than zero and less than %d", INT_MAX);
return NULL;
}
adjusting |= ADJ_PRECISION;
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 6bde3c929..e408615b6 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -18,11 +18,12 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.2 2007/06/07 08:59:00 tony2001 Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.6 2007/10/04 13:31:11 jani Exp $ */
#include "php.h"
#include "php_globals.h"
#include "php_network.h"
+#include "php_ini.h"
#include <stdio.h>
#include <stdlib.h>
@@ -68,7 +69,11 @@
#include "php_fopen_wrappers.h"
+#define FTPS_ENCRYPT_DATA 1
+#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC)
+/* {{{ get_ftp_result
+ */
static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC)
{
while (php_stream_gets(stream, buffer, buffer_size-1) &&
@@ -76,24 +81,21 @@ static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer
isdigit((int) buffer[2]) && buffer[3] == ' '));
return strtol(buffer, NULL, 10);
}
-#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC)
-
-#define FTPS_ENCRYPT_DATA 1
+/* }}} */
-static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper,
- php_stream *stream,
- php_stream_statbuf *ssb
- TSRMLS_DC)
+/* {{{ php_stream_ftp_stream_stat
+ */
+static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
{
/* For now, we return with a failure code to prevent the underlying
* file's details from being used instead. */
return -1;
}
+/* }}} */
-
-static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper,
- php_stream *stream
- TSRMLS_DC)
+/* {{{ php_stream_ftp_stream_close
+ */
+static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC)
{
php_stream *controlstream = (php_stream *)stream->wrapperdata;
@@ -104,6 +106,7 @@ static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper,
}
return 0;
}
+/* }}} */
/* {{{ php_ftp_fopen_connect
*/
@@ -409,7 +412,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
}
if (strpbrk(mode, "wa+")) {
if (read_write) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP does not support simultaneous read/write connections.");
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP does not support simultaneous read/write connections");
return NULL;
}
if (strchr(mode, 'a')) {
@@ -420,7 +423,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
}
if (!read_write) {
/* No mode specified? */
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unknown file open mode.");
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unknown file open mode");
return NULL;
}
@@ -483,7 +486,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
goto errexit;
}
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Remote file already exists and overwrite context option not specified.");
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Remote file already exists and overwrite context option not specified");
errno = EEXIST;
goto errexit;
}
@@ -563,7 +566,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
php_url_free(resource);
return datastream;
- errexit:
+errexit:
if (resource) {
php_url_free(resource);
}
@@ -668,6 +671,8 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, cha
char ip[sizeof("123.123.123.123")];
unsigned short portno;
+ tmp_line[0] = '\0';
+
stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC);
if (!stream) {
goto opendir_errexit;
@@ -725,7 +730,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, cha
php_url_free(resource);
return php_stream_alloc(&php_ftp_dirstream_ops, datastream, 0, mode);
- opendir_errexit:
+opendir_errexit:
if (resource) {
php_url_free(resource);
}
@@ -733,8 +738,9 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, cha
php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result);
php_stream_close(stream);
}
- if (tmp_line[0] != '\0')
+ if (tmp_line[0] != '\0') {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line);
+ }
return NULL;
}
/* }}} */
@@ -824,7 +830,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int f
#endif
} else {
/* error or unsupported command */
- mdtm_error:
+mdtm_error:
#ifdef NETWARE
ssb->sb.st_mtime.tv_sec = -1;
#else
@@ -856,7 +862,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int f
php_url_free(resource);
return 0;
- stat_errexit:
+stat_errexit:
if (resource) {
php_url_free(resource);
}
@@ -906,7 +912,7 @@ static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, char *url, int opt
php_stream_close(stream);
return 1;
- unlink_errexit:
+unlink_errexit:
if (resource) {
php_url_free(resource);
}
@@ -982,7 +988,7 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, char *url_from, ch
php_stream_close(stream);
return 1;
- rename_errexit:
+rename_errexit:
if (resource_from) {
php_url_free(resource_from);
}
@@ -1079,7 +1085,7 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, char *url, int mode
return 1;
- mkdir_errexit:
+mkdir_errexit:
if (resource) {
php_url_free(resource);
}
@@ -1129,7 +1135,7 @@ static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, char *url, int opti
return 1;
- rmdir_errexit:
+rmdir_errexit:
if (resource) {
php_url_free(resource);
}
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 3b4919354..357257997 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.111.2.2.2.14 2007/05/27 15:57:11 nlopess Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.15 2007/10/03 04:53:05 stas Exp $ */
/*
* HTML entity resources:
@@ -484,18 +484,29 @@ struct basic_entities_dec {
} \
mbseq[mbpos++] = (mbchar); }
+#define CHECK_LEN(pos, chars_need) \
+ if((str_len - (pos)) < chars_need) { \
+ *status = FAILURE; \
+ return 0; \
+ }
+
/* {{{ get_next_char
*/
inline static unsigned short get_next_char(enum entity_charset charset,
unsigned char * str,
+ int str_len,
int * newpos,
unsigned char * mbseq,
- int * mbseqlen)
+ int * mbseqlen,
+ int *status)
{
int pos = *newpos;
int mbpos = 0;
int mbspace = *mbseqlen;
unsigned short this_char = str[pos++];
+ unsigned char next_char;
+
+ *status = SUCCESS;
if (mbspace <= 0) {
*mbseqlen = 0;
@@ -517,6 +528,10 @@ inline static unsigned short get_next_char(enum entity_charset charset,
do {
if (this_char < 0x80) {
more = 0;
+ if(stat) {
+ /* we didn't finish the UTF sequence correctly */
+ *status = FAILURE;
+ }
break;
} else if (this_char < 0xc0) {
switch (stat) {
@@ -555,6 +570,7 @@ inline static unsigned short get_next_char(enum entity_charset charset,
break;
default:
/* invalid */
+ *status = FAILURE;
more = 0;
}
}
@@ -562,21 +578,27 @@ inline static unsigned short get_next_char(enum entity_charset charset,
else if (this_char < 0xe0) {
stat = 0x10; /* 2 byte */
utf = (this_char & 0x1f) << 6;
+ CHECK_LEN(pos, 1);
} else if (this_char < 0xf0) {
stat = 0x20; /* 3 byte */
utf = (this_char & 0xf) << 12;
+ CHECK_LEN(pos, 2);
} else if (this_char < 0xf8) {
stat = 0x30; /* 4 byte */
utf = (this_char & 0x7) << 18;
+ CHECK_LEN(pos, 3);
} else if (this_char < 0xfc) {
stat = 0x40; /* 5 byte */
utf = (this_char & 0x3) << 24;
+ CHECK_LEN(pos, 4);
} else if (this_char < 0xfe) {
stat = 0x50; /* 6 byte */
utf = (this_char & 0x1) << 30;
+ CHECK_LEN(pos, 5);
} else {
/* invalid; bail */
more = 0;
+ *status = FAILURE;
break;
}
@@ -594,7 +616,8 @@ inline static unsigned short get_next_char(enum entity_charset charset,
/* check if this is the first of a 2-byte sequence */
if (this_char >= 0xa1 && this_char <= 0xfe) {
/* peek at the next char */
- unsigned char next_char = str[pos];
+ CHECK_LEN(pos, 1);
+ next_char = str[pos];
if ((next_char >= 0x40 && next_char <= 0x7e) ||
(next_char >= 0xa1 && next_char <= 0xfe)) {
/* yes, this a wide char */
@@ -614,7 +637,8 @@ inline static unsigned short get_next_char(enum entity_charset charset,
(this_char >= 0xe0 && this_char <= 0xef)
) {
/* peek at the next char */
- unsigned char next_char = str[pos];
+ CHECK_LEN(pos, 1);
+ next_char = str[pos];
if ((next_char >= 0x40 && next_char <= 0x7e) ||
(next_char >= 0x80 && next_char <= 0xfc))
{
@@ -633,7 +657,8 @@ inline static unsigned short get_next_char(enum entity_charset charset,
/* check if this is the first of a multi-byte sequence */
if (this_char >= 0xa1 && this_char <= 0xfe) {
/* peek at the next char */
- unsigned char next_char = str[pos];
+ CHECK_LEN(pos, 1);
+ next_char = str[pos];
if (next_char >= 0xa1 && next_char <= 0xfe) {
/* yes, this a jis kanji char */
this_char <<= 8;
@@ -644,7 +669,8 @@ inline static unsigned short get_next_char(enum entity_charset charset,
} else if (this_char == 0x8e) {
/* peek at the next char */
- unsigned char next_char = str[pos];
+ CHECK_LEN(pos, 1);
+ next_char = str[pos];
if (next_char >= 0xa1 && next_char <= 0xdf) {
/* JIS X 0201 kana */
this_char <<= 8;
@@ -655,8 +681,10 @@ inline static unsigned short get_next_char(enum entity_charset charset,
} else if (this_char == 0x8f) {
/* peek at the next two char */
- unsigned char next_char = str[pos];
- unsigned char next2_char = str[pos+1];
+ unsigned char next2_char;
+ CHECK_LEN(pos, 2);
+ next_char = str[pos];
+ next2_char = str[pos+1];
if ((next_char >= 0xa1 && next_char <= 0xfe) &&
(next2_char >= 0xa1 && next2_char <= 0xfe)) {
/* JIS X 0212 hojo-kanji */
@@ -1098,13 +1126,22 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, int oldlen, int *ne
maxlen = 128;
replaced = emalloc (maxlen);
len = 0;
-
i = 0;
while (i < oldlen) {
unsigned char mbsequence[16]; /* allow up to 15 characters in a multibyte sequence */
int mbseqlen = sizeof(mbsequence);
- unsigned short this_char = get_next_char(charset, old, &i, mbsequence, &mbseqlen);
-
+ int status = SUCCESS;
+ unsigned short this_char = get_next_char(charset, old, oldlen, &i, mbsequence, &mbseqlen, &status);
+
+ if(status == FAILURE) {
+ /* invalid MB sequence */
+ efree(replaced);
+ if(!PG(display_errors)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid multibyte sequence in argument");
+ }
+ *newlen = 0;
+ return STR_EMPTY_ALLOC();
+ }
matches_map = 0;
if (len + 16 > maxlen)
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 92e369855..a82ca61fa 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http.c,v 1.14.2.4.2.3 2007/01/03 23:16:56 iliaa Exp $ */
+/* $Id: http.c,v 1.14.2.4.2.4 2007/10/04 13:31:11 jani Exp $ */
#include "php_http.h"
#include "php_ini.h"
@@ -76,7 +76,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
}
if (zend_hash_get_current_data_ex(ht, (void **)&zdata, NULL) == FAILURE || !zdata || !(*zdata)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error traversing form data array.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error traversing form data array");
return FAILURE;
}
if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == IS_OBJECT) {
@@ -203,7 +203,7 @@ PHP_FUNCTION(http_build_query)
}
if (Z_TYPE_P(formdata) != IS_ARRAY && Z_TYPE_P(formdata) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter 1 expected to be Array or Object. Incorrect value given.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter 1 expected to be Array or Object. Incorrect value given");
RETURN_FALSE;
}
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 5fbce9ea1..0d964fd14 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -19,7 +19,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.9 2007/04/23 16:37:28 bjori Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.10 2007/10/04 13:31:11 jani Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -137,7 +137,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
/* Normal http request (possibly with proxy) */
if (strpbrk(mode, "awx+")) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support writeable connections.");
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support writeable connections");
php_url_free(resource);
return NULL;
}
diff --git a/ext/standard/image.c b/ext/standard/image.c
index dc94fe25c..0356da8dc 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: image.c,v 1.114.2.2.2.5 2007/05/08 18:38:20 iliaa Exp $ */
+/* $Id: image.c,v 1.114.2.2.2.6 2007/10/04 13:31:11 jani Exp $ */
#include "php.h"
#include <stdio.h>
@@ -1317,8 +1317,7 @@ PHP_FUNCTION(getimagesize)
#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
result = php_handle_swc(stream TSRMLS_CC);
#else
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The image is a compressed SWF file, but you do not have a static version of the zlib extension enabled.");
-
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The image is a compressed SWF file, but you do not have a static version of the zlib extension enabled");
#endif
break;
case IMAGE_FILETYPE_PSD:
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 8db5085db..fe348786b 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mail.c,v 1.87.2.1.2.7 2007/07/11 17:36:56 johannes Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.8 2007/10/04 13:31:11 jani Exp $ */
#include <stdlib.h>
#include <ctype.h>
@@ -98,7 +98,7 @@ PHP_FUNCTION(mail)
char *p, *e;
if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE");
RETURN_FALSE;
}
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 78ba87529..097b70788 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.57.2.5.2.5 2007/06/06 22:04:04 iliaa Exp $ */
+/* $Id: pack.c,v 1.57.2.5.2.6 2007/09/22 15:25:46 iliaa Exp $ */
#include "php.h"
@@ -56,6 +56,9 @@
#define INC_OUTPUTPOS(a,b) \
if ((a) < 0 || ((INT_MAX - outputpos)/((int)b)) < (a)) { \
+ efree(argv); \
+ efree(formatcodes); \
+ efree(formatargs); \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow in format string", code); \
RETURN_FALSE; \
} \
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index b519b0cae..d30cf37de 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_filestat.h,v 1.24.2.4.2.1 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: php_filestat.h,v 1.24.2.4.2.2 2007/10/31 13:23:06 jani Exp $ */
#ifndef PHP_FILESTAT_H
#define PHP_FILESTAT_H
@@ -87,6 +87,7 @@ typedef unsigned int php_stat_len;
typedef int php_stat_len;
#endif
+PHPAPI void php_clear_stat_cache(TSRMLS_D);
PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC);
/* Switches for various filestat functions: */
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 0d17dcbf6..6afbc4531 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_fopen_wrapper.c,v 1.45.2.4.2.7 2007/06/21 12:42:36 dmitry Exp $ */
+/* $Id: php_fopen_wrapper.c,v 1.45.2.4.2.8 2007/10/04 13:31:11 jani Exp $ */
#include <stdio.h>
#include <stdlib.h>
@@ -253,7 +253,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
pathdup = estrndup(path + 6, strlen(path + 6));
p = strstr(pathdup, "/resource=");
if (!p) {
- php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "No URL resource specified.");
+ php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "No URL resource specified");
efree(pathdup);
return NULL;
}
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index d4a1406a1..2ef4b6790 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -15,7 +15,7 @@
| Author: Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: proc_open.c,v 1.36.2.1.2.16 2007/08/17 10:42:30 jani Exp $ */
+/* $Id: proc_open.c,v 1.36.2.1.2.17 2007/09/12 11:42:43 nlopess Exp $ */
#if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
# define _BSD_SOURCE /* linux wants this when XOPEN mode is on */
@@ -677,6 +677,12 @@ PHP_FUNCTION(proc_open)
#ifdef PHP_WIN32
descriptors[ndesc].childend = dup_fd_as_handle(fd);
_close(fd);
+
+ /* simulate the append mode by fseeking to the end of the file
+ this introduces a potential race-condition, but it is the best we can do, though */
+ if (strchr(Z_STRVAL_PP(zmode), 'a')) {
+ SetFilePointer(descriptors[ndesc].childend, 0, NULL, FILE_END);
+ }
#else
descriptors[ndesc].childend = fd;
#endif
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 725aa8cf3..7963e529a 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.58.2.6.2.15 2007/07/09 17:27:24 dmitry Exp $ */
+/* $Id: streamsfuncs.c,v 1.58.2.6.2.16 2007/10/04 13:31:11 jani Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -357,7 +357,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
}
if (to_read <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0");
RETURN_FALSE;
}
@@ -406,7 +406,7 @@ PHP_FUNCTION(stream_get_contents)
php_stream_from_zval(stream, &zsrc);
if (pos > 0 && php_stream_seek(stream, pos, SEEK_SET) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream.", pos);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos);
RETURN_FALSE;
}
@@ -442,7 +442,7 @@ PHP_FUNCTION(stream_copy_to_stream)
php_stream_from_zval(dest, &zdest);
if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream.", pos);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos);
RETURN_FALSE;
}
@@ -757,10 +757,10 @@ PHP_FUNCTION(stream_select)
convert_to_long_ex(sec);
if (Z_LVAL_PP(sec) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0");
RETURN_FALSE;
} else if (usec < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The microseconds parameter must be greater than 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The microseconds parameter must be greater than 0");
RETURN_FALSE;
}
@@ -945,7 +945,7 @@ PHP_FUNCTION(stream_context_get_options)
}
context = decode_context_param(zcontext TSRMLS_CC);
if (!context) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter");
RETURN_FALSE;
}
@@ -975,7 +975,7 @@ PHP_FUNCTION(stream_context_set_option)
/* figure out where the context is coming from exactly */
context = decode_context_param(zcontext TSRMLS_CC);
if (!context) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter");
RETURN_FALSE;
}
@@ -1002,7 +1002,7 @@ PHP_FUNCTION(stream_context_set_params)
context = decode_context_param(zcontext TSRMLS_CC);
if (!context) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid stream/context parameter");
RETURN_FALSE;
}
@@ -1186,7 +1186,7 @@ PHP_FUNCTION(stream_get_line)
}
if (max_length < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater than or equal to zero.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater than or equal to zero");
RETURN_FALSE;
}
if (!max_length) {
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 49cc6d76c..c1e898ea2 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.67 2007/08/05 14:47:42 iliaa Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.70 2007/10/04 13:31:11 jani Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -511,22 +511,22 @@ static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_
/* Error, try to be as helpful as possible:
(a range ending/starting with '.' won't be captured here) */
if (end-len >= input) { /* there was no 'left' char */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the left of '..'.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the left of '..'");
result = FAILURE;
continue;
}
if (input+2 >= end) { /* there is no 'right' char */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the right of '..'.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, no character to the right of '..'");
result = FAILURE;
continue;
}
if (input[-1] > input[2]) { /* wrong order */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, '..'-range needs to be incrementing.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range, '..'-range needs to be incrementing");
result = FAILURE;
continue;
}
/* FIXME: better error (a..b..c is the only left possibility?) */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid '..'-range");
result = FAILURE;
continue;
} else {
@@ -659,7 +659,7 @@ PHP_FUNCTION(wordwrap)
}
if (linelength == 0 && docut) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't force cut when width is zero.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't force cut when width is zero");
RETURN_FALSE;
}
@@ -861,7 +861,7 @@ PHP_FUNCTION(explode)
}
if (! Z_STRLEN_PP(delim)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
RETURN_FALSE;
}
@@ -988,7 +988,7 @@ PHP_FUNCTION(implode)
if (argc == 1) {
if (Z_TYPE_PP(arg1) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument to implode must be an array.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument must be an array");
return;
}
@@ -1008,7 +1008,7 @@ PHP_FUNCTION(implode)
convert_to_string_ex(arg1);
delim = *arg1;
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad arguments.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments passed");
return;
}
}
@@ -1544,7 +1544,7 @@ PHP_FUNCTION(stristr)
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
efree(haystack_orig);
RETURN_FALSE;
}
@@ -1592,7 +1592,7 @@ PHP_FUNCTION(strstr)
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
RETURN_FALSE;
}
@@ -1645,13 +1645,13 @@ PHP_FUNCTION(strpos)
}
if (offset < 0 || offset > Z_STRLEN_PP(haystack)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
RETURN_FALSE;
}
@@ -1695,7 +1695,7 @@ PHP_FUNCTION(stripos)
}
if (offset < 0 || offset > haystack_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
@@ -1725,7 +1725,7 @@ PHP_FUNCTION(stripos)
needle_char[0] = tolower((char) Z_DVAL_P(needle));
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "needle is not a string or an integer.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "needle is not a string or an integer");
efree(haystack_dup);
RETURN_FALSE;
break;
@@ -2038,7 +2038,7 @@ PHP_FUNCTION(chunk_split)
}
if (chunklen <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Chunk length should be greater than zero.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Chunk length should be greater than zero");
RETURN_FALSE;
}
@@ -2181,8 +2181,7 @@ PHP_FUNCTION(substr_replace)
if (Z_TYPE_PP(str) == IS_STRING) {
if (
- (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY)
- ||
+ (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY) ||
(argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len))
) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array ");
@@ -2195,7 +2194,6 @@ PHP_FUNCTION(substr_replace)
}
}
}
-
if (Z_TYPE_PP(str) != IS_ARRAY) {
if (Z_TYPE_PP(from) != IS_ARRAY) {
@@ -2253,7 +2251,7 @@ PHP_FUNCTION(substr_replace)
result[result_len] = '\0';
RETURN_STRINGL(result, result_len, 0);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented");
RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1);
}
} else { /* str is array of strings */
@@ -2646,7 +2644,7 @@ PHP_FUNCTION(strtr)
}
if (ac == 2 && Z_TYPE_PP(from) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument is not an array.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument is not an array");
RETURN_FALSE;
}
@@ -3951,7 +3949,7 @@ PHP_FUNCTION(setlocale)
cat = Z_LVAL_PP(pcategory);
} else { /* FIXME: The following behaviour should be removed. */
char *category;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passing locale category name as string is deprecated. Use the LC_* -constants instead.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passing locale category name as string is deprecated. Use the LC_* -constants instead");
convert_to_string_ex(pcategory);
category = Z_STRVAL_P(*pcategory);
@@ -3972,7 +3970,7 @@ PHP_FUNCTION(setlocale)
else if (!strcasecmp ("LC_TIME", category))
cat = LC_TIME;
else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME.", category);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME", category);
efree(args);
RETURN_FALSE;
}
@@ -4000,8 +3998,12 @@ PHP_FUNCTION(setlocale)
loc = NULL;
} else {
loc = Z_STRVAL_PP(plocale);
+ if (Z_STRLEN_PP(plocale) >= 255) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long");
+ break;
+ }
}
-
+
retval = setlocale (cat, loc);
zend_update_current_locale();
if (retval) {
@@ -4407,7 +4409,7 @@ PHP_FUNCTION(str_repeat)
convert_to_long_ex(mult);
if (Z_LVAL_PP(mult) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument has to be greater than or equal to 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument has to be greater than or equal to 0");
return;
}
@@ -4471,7 +4473,7 @@ PHP_FUNCTION(count_chars)
mymode = Z_LVAL_PP(mode);
if (mymode < 0 || mymode > 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown mode.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown mode");
RETURN_FALSE;
}
}
@@ -4662,7 +4664,7 @@ PHP_FUNCTION(substr_count)
convert_to_string_ex(needle);
if (Z_STRLEN_PP(needle) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty substring.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty substring");
RETURN_FALSE;
}
@@ -4672,12 +4674,12 @@ PHP_FUNCTION(substr_count)
if (ac > 2) {
convert_to_long_ex(offset);
if (Z_LVAL_PP(offset) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset should be greater than or equal to 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset should be greater than or equal to 0");
RETURN_FALSE;
}
if (Z_LVAL_PP(offset) > Z_STRLEN_PP(haystack)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value %ld exceeds string length.", Z_LVAL_PP(offset));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value %ld exceeds string length", Z_LVAL_PP(offset));
RETURN_FALSE;
}
p += Z_LVAL_PP(offset);
@@ -4685,11 +4687,11 @@ PHP_FUNCTION(substr_count)
if (ac == 4) {
convert_to_long_ex(length);
if (Z_LVAL_PP(length) <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length should be greater than 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length should be greater than 0");
RETURN_FALSE;
}
if (Z_LVAL_PP(length) > (Z_STRLEN_PP(haystack) - Z_LVAL_PP(offset))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string length.", Z_LVAL_PP(length));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string length", Z_LVAL_PP(length));
RETURN_FALSE;
}
endp = p + Z_LVAL_PP(length);
@@ -4755,7 +4757,7 @@ PHP_FUNCTION(str_pad)
if (ZEND_NUM_ARGS() > 2) {
convert_to_string_ex(pad_string);
if (Z_STRLEN_PP(pad_string) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding string cannot be empty.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding string cannot be empty");
return;
}
pad_str_val = Z_STRVAL_PP(pad_string);
@@ -4765,7 +4767,7 @@ PHP_FUNCTION(str_pad)
convert_to_long_ex(pad_type);
pad_type_val = Z_LVAL_PP(pad_type);
if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
return;
}
}
@@ -5049,7 +5051,7 @@ PHP_FUNCTION(str_split)
}
if (split_length <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length of each segment must be greater than zero.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length of each segment must be greater than zero");
RETURN_FALSE;
}
@@ -5087,7 +5089,7 @@ PHP_FUNCTION(strpbrk)
}
if (!char_list_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The character list cannot be empty.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The character list cannot be empty");
RETURN_FALSE;
}
@@ -5123,12 +5125,12 @@ PHP_FUNCTION(substr_compare)
offset = (offset < 0) ? 0 : offset;
}
- if(offset > s1_len) {
+ if (offset > s1_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length");
RETURN_FALSE;
}
- if(len > s1_len - offset) {
+ if (len > s1_len - offset) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length cannot exceed initial string length");
RETURN_FALSE;
}
diff --git a/ext/standard/tests/array/array_fill_basic.phpt b/ext/standard/tests/array/array_fill_basic.phpt
new file mode 100644
index 000000000..415bbf606
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_basic.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test array_fill() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_fill() : basic functionality ***\n";
+
+// calling the array_fill with all possible valid values for 'val' argument
+
+$start_key = 0 ;
+$num = 2;
+$heredoc = <<<HERE_DOC
+Hello
+HERE_DOC;
+
+// array of possible valid values for 'val' arugment
+$values = array (
+
+ /* 1 */ NULL,
+ 0,
+ 1,
+ /* 4 */ 1.5,
+ 'hi',
+ "hi",
+ /* 7 */ $heredoc
+
+);
+
+$counter = 1;
+for($i = 0; $i < count($values); $i ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $values[$i];
+
+ var_dump( array_fill($start_key, $num, $val) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : basic functionality ***
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ float(1.5)
+ [1]=>
+ float(1.5)
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(2) "hi"
+ [1]=>
+ string(2) "hi"
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ string(2) "hi"
+ [1]=>
+ string(2) "hi"
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(5) "Hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt
new file mode 100644
index 000000000..9992009f0
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_error.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test array_fill() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+
+echo "*** Testing array_fill() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing array_fill() function with Zero arguments --\n";
+var_dump( array_fill() );
+
+// More than expected number of arguments
+echo "-- Testing array_fill() function with more than expected no. of arguments --\n";
+$start_key = 0;
+$num = 2;
+$val = 1;
+$extra_arg = 10;
+var_dump( array_fill($start_key, $num,$val, $extra_arg) );
+
+// Less than the expected number of arguments
+echo "-- Testing array_fill() function with less than expected no. of arguments --\n";
+$start_key = 0;
+$num = 2;
+var_dump( array_fill($start_key, $num) );
+
+//calling array_fill with negative values for 'num' parameter
+$num = -1;
+var_dump( array_fill($start_key, $num, $val) );
+
+//callin array_fill with 'num' equal to zero value
+$num = 0;
+var_dump( array_fill($start_key, $num, $val) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : error conditions ***
+-- Testing array_fill() function with Zero arguments --
+
+Warning: Wrong parameter count for array_fill() in %s on line %d
+NULL
+-- Testing array_fill() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_fill() in %s on line %d
+NULL
+-- Testing array_fill() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_fill() in %s on line %d
+NULL
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_fill_object.phpt b/ext/standard/tests/array/array_fill_object.phpt
new file mode 100644
index 000000000..0714962c1
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_object.phpt
@@ -0,0 +1,432 @@
+--TEST--
+Test array_fill() function : usage variations - various object values for 'val' argument
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing various object values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+// class without a member
+class Test
+{
+}
+
+//class with public, static, constant members and consturctor to initialize the public member
+class Test1
+{
+ const test1_constant = "test1";
+ public static $test1_static = 0;
+ public $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1, $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test1
+class Child_test1 extends Test1
+{
+ public $member2;
+
+ function __construct($value1, $value2, $value3)
+ {
+ parent::__construct($value1, $value2);
+ $this->member2 = $value3;
+ }
+}
+
+//class with private, static, constant members and constructor to initialize the private member
+class Test2
+{
+ const test2_constant = "test2";
+ public static $test2_static = 0;
+ private $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1,$value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test2
+class Child_test2 extends Test2
+{
+ private $member1;
+
+ function __construct($value1, $value2, $value3)
+ {
+ parent::__construct($value1, $value2);
+ $this->member1 = $value3;
+ }
+}
+
+// class with protected, static, constant members and consturctor to initialize the protected member
+class Test3
+{
+ const test3_constant = "test3";
+ public static $test3_static = 0;
+ protected $member1;
+ var $var1 = 30;
+ var $var2;
+
+ function __construct($value1, $value2)
+ {
+ $this->member1 = $value1;
+ $this->var2 = $value2;
+ }
+}
+
+// child class which inherits parent class test3
+class Child_test3 extends Test3
+{
+ protected $member1;
+
+ function __construct($value1, $value2, $value3)
+ {
+ parent::__construct($value1, $value2);
+ $this->member1 = $value3;
+ }
+}
+
+// class with public, private, protected members, static, constant members and constructor to initialize all the members
+class Test4
+{
+ const test4_constant = "test4";
+ public static $test4_static = 0;
+ public $member1;
+ private $member2;
+ protected $member3;
+
+ function __construct($value1, $value2, $value3)
+ {
+ $this->member1 = $value1;
+ $this->member2 = $value2;
+ $this->member3 = $value3;
+ }
+}
+
+// child class which inherits parent class test4
+class Child_test4 extends Test4
+{
+ var $var1;
+
+ function __construct($value1, $value2, $value3, $value4)
+ {
+ parent::__construct($value1, $value2, $value3);
+ $this->var1 = $value4;
+ }
+}
+
+// abstract class with public, private, protected members
+abstract class AbstractClass
+{
+ public $member1;
+ private $member2;
+ protected $member3;
+ var $var1 = 30;
+
+ abstract protected function display();
+}
+
+// implement abstract 'AbstractClass' class
+class ConcreteClass1 extends AbstractClass
+{
+ protected function display()
+ {
+ echo "class name is ConcreteClass1 \n";
+ }
+}
+
+
+// declarationn of the interface 'iTemplate'
+interface iTemplate
+{
+ public function display();
+}
+
+// implement the interface 'iTemplate'
+class Template1 implements iTemplate
+{
+ public function display()
+ {
+ echo "class name is Template1\n";
+ }
+}
+
+//array of object values for 'val' argument
+$objects = array(
+
+ /* 1 */ new Test(),
+ new Test1(100 , 101),
+ new Child_test1(100 , 101 , 102),
+ new Test2(100 , 101),
+ /* 5 */ new Child_test2(100 , 101 , 102),
+ new Test3(100 , 101),
+ new Child_test3(100 , 101 , 102),
+ new Test4( 100 , 101 , 102),
+ new Child_test4(100 , 101 , 102 , 103),
+ new ConcreteClass1(),
+ /* 11 */ new Template1()
+);
+
+// loop through each element of the array for 'val' argument
+// check the working of array_fill()
+echo "--- Testing array_fill() with different object values for 'val' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($objects); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $objects[$index];
+
+ var_dump( array_fill($start_key, $num, $val) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different object values for 'val' argument ---
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ object(Test)#%d (0) {
+ }
+ [1]=>
+ object(Test)#%d (0) {
+ }
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ object(Test1)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test1)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ object(Child_test1)#%d (4) {
+ ["member2"]=>
+ int(102)
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Child_test1)#%d (4) {
+ ["member2"]=>
+ int(102)
+ ["member1"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ object(Test2)#%d (3) {
+ ["member1:private"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test2)#%d (3) {
+ ["member1:private"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ object(Child_test2)#%d (4) {
+ ["member1:private"]=>
+ int(102)
+ ["member1:private"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Child_test2)#%d (4) {
+ ["member1:private"]=>
+ int(102)
+ ["member1:private"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ object(Test3)#%d (3) {
+ ["member1:protected"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Test3)#%d (3) {
+ ["member1:protected"]=>
+ int(100)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ object(Child_test3)#%d (3) {
+ ["member1:protected"]=>
+ int(102)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+ [1]=>
+ object(Child_test3)#%d (3) {
+ ["member1:protected"]=>
+ int(102)
+ ["var1"]=>
+ int(30)
+ ["var2"]=>
+ int(101)
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ object(Test4)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["member2:private"]=>
+ int(101)
+ ["member3:protected"]=>
+ int(102)
+ }
+ [1]=>
+ object(Test4)#%d (3) {
+ ["member1"]=>
+ int(100)
+ ["member2:private"]=>
+ int(101)
+ ["member3:protected"]=>
+ int(102)
+ }
+}
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ object(Child_test4)#%d (4) {
+ ["var1"]=>
+ int(103)
+ ["member1"]=>
+ int(100)
+ ["member2:private"]=>
+ int(101)
+ ["member3:protected"]=>
+ int(102)
+ }
+ [1]=>
+ object(Child_test4)#%d (4) {
+ ["var1"]=>
+ int(103)
+ ["member1"]=>
+ int(100)
+ ["member2:private"]=>
+ int(101)
+ ["member3:protected"]=>
+ int(102)
+ }
+}
+-- Iteration 10 --
+array(2) {
+ [0]=>
+ object(ConcreteClass1)#%d (4) {
+ ["member1"]=>
+ NULL
+ ["member2:private"]=>
+ NULL
+ ["member3:protected"]=>
+ NULL
+ ["var1"]=>
+ int(30)
+ }
+ [1]=>
+ object(ConcreteClass1)#%d (4) {
+ ["member1"]=>
+ NULL
+ ["member2:private"]=>
+ NULL
+ ["member3:protected"]=>
+ NULL
+ ["var1"]=>
+ int(30)
+ }
+}
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ object(Template1)#%d (0) {
+ }
+ [1]=>
+ object(Template1)#%d (0) {
+ }
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_fill_variation1.phpt b/ext/standard/tests/array/array_fill_variation1.phpt
new file mode 100644
index 000000000..ea1ade796
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_variation1.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test array_fill() function : usage variations - unexpected values for 'start_key' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected value for 'start_key' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$num = 2;
+$val = 100;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'start_key' argument
+$values = array(
+
+ // float values
+ /* 1 */ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.34567890006E-10,
+ .5,
+
+ // array values
+ /* 6 */ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null values
+ /* 11 */ NULL,
+ null,
+
+ // boolean values
+ /* 13 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ /* 17 */ "",
+ '',
+
+ // string values
+ /* 19 */ "string",
+ 'string',
+
+ // objects
+ /* 21 */ new test(),
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var,
+
+ // resource variable
+ /* 24 */ $fp
+);
+
+// loop through each element of the array for start_key
+// check the working of array_fill()
+echo "--- Testing array_fill() with different values for 'start_key' arg ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $start_key = $values[$index];
+
+ var_dump( array_fill($start_key,$num,$val) );
+
+ $counter ++;
+}
+
+// close the resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different values for 'start_key' arg ---
+-- Iteration 1 --
+array(2) {
+ [10]=>
+ int(100)
+ [11]=>
+ int(100)
+}
+-- Iteration 2 --
+array(2) {
+ [-10]=>
+ int(100)
+ [0]=>
+ int(100)
+}
+-- Iteration 3 --
+array(2) {
+ [-1097262584]=>
+ int(100)
+ [0]=>
+ int(100)
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 6 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 17 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 19 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 20 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 21 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_fill_variation1_64bit.phpt b/ext/standard/tests/array/array_fill_variation1_64bit.phpt
new file mode 100644
index 000000000..193945bcd
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_variation1_64bit.phpt
@@ -0,0 +1,235 @@
+--TEST--
+Test array_fill() function : usage variations - unexpected values for 'start_key' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : proto array array_fill(int start_key, int num, mixed val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected value for 'start_key' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$num = 2;
+$val = 100;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'start_key' argument
+$values = array(
+
+ // float values
+ /* 1 */ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.34567890006E-10,
+ .5,
+
+ // array values
+ /* 6 */ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null values
+ /* 11 */ NULL,
+ null,
+
+ // boolean values
+ /* 13 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ /* 17 */ "",
+ '',
+
+ // string values
+ /* 19 */ "string",
+ 'string',
+
+ // objects
+ /* 21 */ new test(),
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var,
+
+ // resource variable
+ /* 24 */ $fp
+);
+
+// loop through each element of the array for start_key
+// check the working of array_fill()
+echo "--- Testing array_fill() with different values for 'start_key' arg ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $start_key = $values[$index];
+
+ var_dump( array_fill($start_key,$num,$val) );
+
+ $counter ++;
+}
+
+// close the resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different values for 'start_key' arg ---
+-- Iteration 1 --
+array(2) {
+ [10]=>
+ int(100)
+ [11]=>
+ int(100)
+}
+-- Iteration 2 --
+array(2) {
+ [-10]=>
+ int(100)
+ [0]=>
+ int(100)
+}
+-- Iteration 3 --
+array(2) {
+ [123456789000]=>
+ int(100)
+ [123456789001]=>
+ int(100)
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 6 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 17 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 18 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 19 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 20 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 21 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: array_fill(): Wrong data type for start key in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_fill_variation2.phpt b/ext/standard/tests/array/array_fill_variation2.phpt
new file mode 100644
index 000000000..9eb635fde
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_variation2.phpt
@@ -0,0 +1,213 @@
+--TEST--
+Test array_fill() function : usage variations - unexpected values for 'num' argument
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected values for 'num' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted (if any)
+$start_key = 0;
+$val = 100;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'num' argument
+$values = array(
+
+ // float values
+ /* 1 */ 2.5,
+ -2.5,
+ 0.5e1,
+ 0.5E-1,
+ .5,
+
+ // array values
+ /* 6 */ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null values
+ /* 11 */ NULL,
+ null,
+
+ // boolean values
+ /* 13 */ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ /* 17 */ "",
+ '',
+
+ // string values
+ /* 19 */ "string",
+ 'string',
+
+ // objects
+ /* 21 */ new test(),
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ /* 23 */ @$unset_var,
+
+);
+
+// loop through each element of the array for num
+// check the working of array_fill
+echo "--- Testing array_fill() with different values for 'num' arg ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $num = $values[$index];
+
+ var_dump( array_fill($start_key, $num, $val) );
+
+ $counter ++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different values for 'num' arg ---
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+}
+-- Iteration 2 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 3 --
+array(5) {
+ [0]=>
+ int(100)
+ [1]=>
+ int(100)
+ [2]=>
+ int(100)
+ [3]=>
+ int(100)
+ [4]=>
+ int(100)
+}
+-- Iteration 4 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 8 --
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 10 --
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 11 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 13 --
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 14 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 16 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Notice: Object of class test could not be converted to int in %s on line %d
+array(1) {
+ [0]=>
+ int(100)
+}
+-- Iteration 22 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_fill(): Number of elements must be positive in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_fill_variation3.phpt b/ext/standard/tests/array/array_fill_variation3.phpt
new file mode 100644
index 000000000..fbb22d869
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_variation3.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Test array_fill() function : usage variations - unexpected values for 'val' argument
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different unexpected values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "testObject";
+ }
+}
+
+
+//array of different values for 'val' argument
+$values = array(
+ // empty string
+ /* 1 */ "",
+ '',
+ // objects
+ /* 3 */ new test(),
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ /* 5 */ @$unset_var,
+);
+
+// loop through each element of the array for 'val' argument
+// check the working of array_fill()
+echo "--- Testing array_fill() with different values for 'val' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $values[$index];
+
+ var_dump( array_fill($start_key, $num, $val) );
+
+ $counter++;
+}
+
+echo"Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different values for 'val' argument ---
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ object(test)#%d (1) {
+ ["t"]=>
+ int(10)
+ }
+ [1]=>
+ object(test)#%d (1) {
+ ["t"]=>
+ int(10)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_fill_variation4.phpt b/ext/standard/tests/array/array_fill_variation4.phpt
new file mode 100644
index 000000000..247761db3
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_variation4.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test array_fill() function : usage variations - using return value of array_fill as 'val' arugment
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/* passing array_fill() as the 'val' argument in array_fill() function */
+
+echo "*** Testing array_fill() : variation ***\n";
+
+$start_key = 0;
+$num = 2;
+$heredoc = <<<HERE_DOC
+Hello
+HERE_DOC;
+
+// array of possible valid values for 'val' arugment
+$values = array (
+
+ /* 1 */ NULL,
+ 0,
+ 1,
+ /* 4 */ 1.0,
+ 'hi',
+ "hi",
+ /* 7 */ $heredoc
+);
+
+echo "*** Filling 2 dimensional array with all basic valid values ***\n";
+$counter = 1;
+for($i =0; $i < count($values); $i ++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $values[$i];
+
+ var_dump( array_fill($start_key, $num, array_fill($start_key, $num, $val)) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : variation ***
+*** Filling 2 dimensional array with all basic valid values ***
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ }
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ }
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1)
+ }
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(2) "hi"
+ [1]=>
+ string(2) "hi"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(2) "hi"
+ [1]=>
+ string(2) "hi"
+ }
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(2) "hi"
+ [1]=>
+ string(2) "hi"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(2) "hi"
+ [1]=>
+ string(2) "hi"
+ }
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(5) "Hello"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(5) "Hello"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_fill_variation5.phpt b/ext/standard/tests/array/array_fill_variation5.phpt
new file mode 100644
index 000000000..6260c36bd
--- /dev/null
+++ b/ext/standard/tests/array/array_fill_variation5.phpt
@@ -0,0 +1,291 @@
+--TEST--
+Test array_fill() function : usage variations - different types of array values for 'val' argument
+--FILE--
+<?php
+/* Prototype : array array_fill(int $start_key, int $num, mixed $val)
+ * Description: Create an array containing num elements starting with index start_key each initialized to val
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * testing array_fill() by passing different types of array values for 'val' argument
+ */
+
+echo "*** Testing array_fill() : usage variations ***\n";
+
+// Initialise function arguments not being substituted
+$start_key = 0;
+$num = 2;
+
+
+//array of different types of array values for 'val' argument
+$values = array(
+
+ /* 1 */ array(),
+ array(1 , 2 , 3 , 4),
+ array(1 => "Hi" , 2 => "Hello"),
+ array("Saffron" , "White" , "Green"),
+ /* 5 */ array('color' => 'red' , 'item' => 'pen'),
+ array( 'color' => 'red' , 2 => 'green ' ),
+ array("colour" => "red" , "item" => "pen"),
+ array( TRUE => "red" , FALSE => "green" ),
+ array( true => "red" , FALSE => "green" ),
+ /* 10 */ array( 1 => "Hi" , "color" => "red" , 'item' => 'pen'),
+ array( NULL => "Hi", '1' => "Hello" , "1" => "Green"),
+ array( ""=>1, "color" => "green"),
+ /* 13 */ array('Saffron' , 'White' , 'Green')
+);
+
+// loop through each element of the values array for 'val' argument
+// check the working of array_fill()
+echo "--- Testing array_fill() with different types of array values for 'val' argument ---\n";
+$counter = 1;
+for($i = 0; $i < count($values); $i++)
+{
+ echo "-- Iteration $counter --\n";
+ $val = $values[$i];
+
+ var_dump( array_fill($start_key, $num, $val) );
+
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_fill() : usage variations ***
+--- Testing array_fill() with different types of array values for 'val' argument ---
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(0) {
+ }
+}
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(2) "Hi"
+ [2]=>
+ string(5) "Hello"
+ }
+ [1]=>
+ array(2) {
+ [1]=>
+ string(2) "Hi"
+ [2]=>
+ string(5) "Hello"
+ }
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(7) "Saffron"
+ [1]=>
+ string(5) "White"
+ [2]=>
+ string(5) "Green"
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(7) "Saffron"
+ [1]=>
+ string(5) "White"
+ [2]=>
+ string(5) "Green"
+ }
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [1]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ [2]=>
+ string(6) "green "
+ }
+ [1]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ [2]=>
+ string(6) "green "
+ }
+}
+-- Iteration 7 --
+array(2) {
+ [0]=>
+ array(2) {
+ ["colour"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [1]=>
+ array(2) {
+ ["colour"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+}
+-- Iteration 8 --
+array(2) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(3) "red"
+ [0]=>
+ string(5) "green"
+ }
+ [1]=>
+ array(2) {
+ [1]=>
+ string(3) "red"
+ [0]=>
+ string(5) "green"
+ }
+}
+-- Iteration 9 --
+array(2) {
+ [0]=>
+ array(2) {
+ [1]=>
+ string(3) "red"
+ [0]=>
+ string(5) "green"
+ }
+ [1]=>
+ array(2) {
+ [1]=>
+ string(3) "red"
+ [0]=>
+ string(5) "green"
+ }
+}
+-- Iteration 10 --
+array(2) {
+ [0]=>
+ array(3) {
+ [1]=>
+ string(2) "Hi"
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [1]=>
+ array(3) {
+ [1]=>
+ string(2) "Hi"
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+}
+-- Iteration 11 --
+array(2) {
+ [0]=>
+ array(2) {
+ [""]=>
+ string(2) "Hi"
+ [1]=>
+ string(5) "Green"
+ }
+ [1]=>
+ array(2) {
+ [""]=>
+ string(2) "Hi"
+ [1]=>
+ string(5) "Green"
+ }
+}
+-- Iteration 12 --
+array(2) {
+ [0]=>
+ array(2) {
+ [""]=>
+ int(1)
+ ["color"]=>
+ string(5) "green"
+ }
+ [1]=>
+ array(2) {
+ [""]=>
+ int(1)
+ ["color"]=>
+ string(5) "green"
+ }
+}
+-- Iteration 13 --
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(7) "Saffron"
+ [1]=>
+ string(5) "White"
+ [2]=>
+ string(5) "Green"
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ string(7) "Saffron"
+ [1]=>
+ string(5) "White"
+ [2]=>
+ string(5) "Green"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_basic.phpt b/ext/standard/tests/array/array_filter_basic.phpt
new file mode 100644
index 000000000..daec07bac
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test array_filter() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+
+echo "*** Testing array_filter() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$input = array(1, 2, 3, 0, -1); // 0 will be considered as FALSE and removed in default callback
+
+/* Callback function
+ * Prototype : bool even(array $input)
+ * Parameters : $input - input array each element of which will be checked in function even()
+ * Return type : boolean - true if element is even and false otherwise
+ * Description : This function takes array as parameter and checks for each element of array.
+ * It returns true if the element is even number else returns false
+ */
+function even($input)
+{
+ return ($input % 2 == 0);
+}
+
+// with all possible arguments
+var_dump( array_filter($input,"even") );
+
+// with default arguments
+var_dump( array_filter($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : basic functionality ***
+array(2) {
+ [1]=>
+ int(2)
+ [3]=>
+ int(0)
+}
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [4]=>
+ int(-1)
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_error.phpt b/ext/standard/tests/array/array_filter_error.phpt
new file mode 100644
index 000000000..03165b6f4
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test array_filter() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_filter() : error conditions ***\n";
+
+// zero arguments
+echo "-- Testing array_filter() function with Zero arguments --";
+var_dump( array_filter() );
+
+$input = array(0, 1, 2, 3, 5);
+/* callback function
+ * Prototype : bool odd(array $input)
+ * Parameters : $input - array for which each elements should be checked into the function
+ * Return Type : bool - true if element is odd and returns false otherwise
+ * Description : Function takes array as input and checks for its each elements.
+*/
+function odd($input)
+{
+ return ($input % 2 != 0);
+}
+$extra_arg = 10;
+
+// with one more than the expected number of arguments
+echo "-- Testing array_filter() function with more than expected no. of arguments --";
+var_dump( array_filter($input, "odd", $extra_arg) );
+
+// with incorrect callback function
+echo "-- Testing array_filter() function with incorrect callback --";
+var_dump( array_filter($input, "even") );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : error conditions ***
+-- Testing array_filter() function with Zero arguments --
+Warning: Wrong parameter count for array_filter() in %s on line %d
+NULL
+-- Testing array_filter() function with more than expected no. of arguments --
+Warning: Wrong parameter count for array_filter() in %s on line %d
+NULL
+-- Testing array_filter() function with incorrect callback --
+Warning: array_filter(): The second argument, 'even', should be a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_filter_object.phpt b/ext/standard/tests/array/array_filter_object.phpt
new file mode 100644
index 000000000..4d49e8530
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_object.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test array_filter() function : object functionality
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/* This file uses 'input' array with different types of objects and passes
+ * it to array_filter() to test object functionality
+ * i.e. object of simple class with members and functions
+ * object of empty class
+ * object of child class extending abstract class
+ * object of class containing static member
+ */
+
+echo "*** Testing array_filter() : object functionality ***\n";
+
+// simple class with members - variable and method
+class SimpleClass
+{
+ public $var1 = 10;
+ public function check() {
+ return $var1;
+ }
+}
+
+// class without members
+class EmptyClass
+{
+}
+
+// abstract class
+abstract class AbstractClass
+{
+ protected $var2 = 5;
+ abstract function emptyMethod();
+}
+
+// class deriving above abstract class
+class ChildClass extends AbstractClass
+{
+ private $var3;
+ public function emptyMethod() {
+ echo "defined in child";
+ }
+}
+
+// class with final method
+class FinalClass
+{
+ private $var4;
+ final function finalMethod() {
+ echo 'This can not be overloaded';
+ }
+}
+
+// class with static members
+class StaticClass
+{
+ static $var5 = 5;
+ public static function staticMethod() {
+ echo 'this is static method';
+ }
+}
+
+// Callback function which returns always true
+function always_true($input)
+{
+ return true;
+}
+
+// Callback function which returns always false
+function always_false($input)
+{
+ return false;
+}
+
+// 'input' array containing objects as elements
+$input = array(
+ new SimpleClass(),
+ new EmptyClass(),
+ new ChildClass(),
+ new FinalClass(),
+ new StaticClass()
+);
+
+
+// with default callback
+var_dump( array_filter($input) );
+
+// with always_true callback function
+var_dump( array_filter($input, "always_true") );
+
+// with always_false callback function
+var_dump( array_filter($input, "always_false") );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : object functionality ***
+array(5) {
+ [0]=>
+ object(SimpleClass)#%d (1) {
+ ["var1"]=>
+ int(10)
+ }
+ [1]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [2]=>
+ object(ChildClass)#%d (2) {
+ ["var3:private"]=>
+ NULL
+ ["var2:protected"]=>
+ int(5)
+ }
+ [3]=>
+ object(FinalClass)#%d (1) {
+ ["var4:private"]=>
+ NULL
+ }
+ [4]=>
+ object(StaticClass)#%d (0) {
+ }
+}
+array(5) {
+ [0]=>
+ object(SimpleClass)#%d (1) {
+ ["var1"]=>
+ int(10)
+ }
+ [1]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [2]=>
+ object(ChildClass)#%d (2) {
+ ["var3:private"]=>
+ NULL
+ ["var2:protected"]=>
+ int(5)
+ }
+ [3]=>
+ object(FinalClass)#%d (1) {
+ ["var4:private"]=>
+ NULL
+ }
+ [4]=>
+ object(StaticClass)#%d (0) {
+ }
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation1.phpt b/ext/standard/tests/array/array_filter_variation1.phpt
new file mode 100644
index 000000000..f8a3ca273
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation1.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test array_filter() function : usage variations - Unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/* Testing different scalar and non-scalar values for 'input' argument
+*/
+echo "*** Testing array_filter() : usage variations - unexpected values for 'input'***\n";
+
+/* Callback function
+ * Prototype : bool always_true(array $input)
+ * Parameters : array for which each elements needs to be used in function
+ * Return value : Returns true for each element
+ * Discription : function applied to each element of the passed array and returns true
+ */
+function always_true($input)
+{
+ return true;
+}
+
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+// resource variable
+$fp = fopen(__FILE__, 'r');
+
+// different values for 'input' argument
+$input_values = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new MyClass(),
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+// loop through each element of the array for input
+for($count = 0; $count < count($input_values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( array_filter($input_values[$count],"always_true") );
+};
+
+// closing resource
+fclose($fp);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - unexpected values for 'input'***
+-- Iteration 1 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: array_filter(): The first argument should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_filter_variation2.phpt b/ext/standard/tests/array/array_filter_variation2.phpt
new file mode 100644
index 000000000..323cc9364
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test array_filter() function : usage variations - Unexpected values for 'callback' function argument
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/* Testing different scalar non-scalar values in place of 'callback' argument
+*/
+echo "*** Testing array_filter() : usage variations - unexpected values for 'callback' function***\n";
+
+// Initialise variables
+$input = array('value1', 'value2', 'value3', 'value4');
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+// resource variable
+$fp = fopen(__FILE__, 'r');
+
+// different scalar/non-scalar values inplace of 'callback'
+$values = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+
+ // object data
+/*25*/ new MyClass(),
+
+ // resource data
+ $fp,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+/*28*/ @$unset_var,
+);
+
+// loop through each element of the 'values' for callback
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --";
+ var_dump( array_filter($input, $values[$count]) );
+};
+
+// closing resource
+fclose($fp);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - unexpected values for 'callback' function***
+-- Iteration 1 --
+Warning: array_filter(): The second argument, '0', should be a valid callback in %s on line %d
+NULL
+-- Iteration 2 --
+Warning: array_filter(): The second argument, '1', should be a valid callback in %s on line %d
+NULL
+-- Iteration 3 --
+Warning: array_filter(): The second argument, '12345', should be a valid callback in %s on line %d
+NULL
+-- Iteration 4 --
+Warning: array_filter(): The second argument, '-2345', should be a valid callback in %s on line %d
+NULL
+-- Iteration 5 --
+Warning: array_filter(): The second argument, '10.5', should be a valid callback in %s on line %d
+NULL
+-- Iteration 6 --
+Warning: array_filter(): The second argument, '-10.5', should be a valid callback in %s on line %d
+NULL
+-- Iteration 7 --
+Warning: array_filter(): The second argument, '123456789000', should be a valid callback in %s on line %d
+NULL
+-- Iteration 8 --
+Warning: array_filter(): The second argument, '1.23456789E-9', should be a valid callback in %s on line %d
+NULL
+-- Iteration 9 --
+Warning: array_filter(): The second argument, '0.5', should be a valid callback in %s on line %d
+NULL
+-- Iteration 10 --
+Warning: array_filter(): The second argument, 'Array', should be a valid callback in %s on line %d
+NULL
+-- Iteration 11 --
+Warning: array_filter(): The second argument, 'Array', should be a valid callback in %s on line %d
+NULL
+-- Iteration 12 --
+Warning: array_filter(): The second argument, 'Array', should be a valid callback in %s on line %d
+NULL
+-- Iteration 13 --
+Warning: array_filter(): The second argument, 'Array', should be a valid callback in %s on line %d
+NULL
+-- Iteration 14 --
+Warning: array_filter(): The second argument, 'Array', should be a valid callback in %s on line %d
+NULL
+-- Iteration 15 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 16 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 17 --
+Warning: array_filter(): The second argument, '1', should be a valid callback in %s on line %d
+NULL
+-- Iteration 18 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 19 --
+Warning: array_filter(): The second argument, '1', should be a valid callback in %s on line %d
+NULL
+-- Iteration 20 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 21 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 22 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 23 --
+Warning: array_filter(): The second argument, 'string', should be a valid callback in %s on line %d
+NULL
+-- Iteration 24 --
+Warning: array_filter(): The second argument, 'string', should be a valid callback in %s on line %d
+NULL
+-- Iteration 25 --
+Warning: array_filter(): The second argument, 'object', should be a valid callback in %s on line %d
+NULL
+-- Iteration 26 --
+Warning: array_filter(): The second argument, %s, should be a valid callback in %s on line %d
+NULL
+-- Iteration 27 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+-- Iteration 28 --
+Warning: array_filter(): The second argument, '', should be a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_filter_variation3.phpt b/ext/standard/tests/array/array_filter_variation3.phpt
new file mode 100644
index 000000000..e22697a97
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation3.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test array_filter() function : usage variations - Different types of array for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of array as 'input' argument.
+*/
+
+// callback function returning always false
+function always_false($input)
+{
+ return false;
+}
+
+// callback function returning always true
+function always_true($input)
+{
+ return true;
+}
+
+echo "*** Testing array_filter() : usage variations - different types of array for 'input' argument***\n";
+
+// different types of 'input' array
+$input_values = array(
+ array(0, 1, 2, -1, 034, 0X4A), // integer values
+ array(0.0, 1.2, 1.2e3, 1.2e-3), // float values
+ array('value1', "value2", '', " ", ""), // string values
+ array(true, false, TRUE, FALSE), // bool values
+ array(null, NULL), // null values
+ array(1 => 'one', 'zero' => 0, -2 => "value"), //associative array
+ array("one" => 1, null => 'null', 5.2 => "float", true => 1, "" => 'empty'), // associative array with different keys
+ array(1 => 'one', 2, "key" => 'value') // combinition of associative and non-associative array
+
+);
+
+// loop through each element of 'input' with default callback
+for($count = 0; $count < count($input_values); $count++)
+{
+ echo "-- Iteration ".($count + 1). " --\n";
+ var_dump( array_filter($input_values[$count]) );
+ var_dump( array_filter($input_values[$count], 'always_true') );
+ var_dump( array_filter($input_values[$count], 'always_false') );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - different types of array for 'input' argument***
+-- Iteration 1 --
+array(5) {
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(-1)
+ [4]=>
+ int(28)
+ [5]=>
+ int(74)
+}
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(-1)
+ [4]=>
+ int(28)
+ [5]=>
+ int(74)
+}
+array(0) {
+}
+-- Iteration 2 --
+array(3) {
+ [1]=>
+ float(1.2)
+ [2]=>
+ float(1200)
+ [3]=>
+ float(0.0012)
+}
+array(4) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(1.2)
+ [2]=>
+ float(1200)
+ [3]=>
+ float(0.0012)
+}
+array(0) {
+}
+-- Iteration 3 --
+array(3) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ [3]=>
+ string(1) " "
+}
+array(5) {
+ [0]=>
+ string(6) "value1"
+ [1]=>
+ string(6) "value2"
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(1) " "
+ [4]=>
+ string(0) ""
+}
+array(0) {
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ bool(true)
+ [2]=>
+ bool(true)
+}
+array(4) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(false)
+}
+array(0) {
+}
+-- Iteration 5 --
+array(0) {
+}
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+array(0) {
+}
+-- Iteration 6 --
+array(2) {
+ [1]=>
+ string(3) "one"
+ [-2]=>
+ string(5) "value"
+}
+array(3) {
+ [1]=>
+ string(3) "one"
+ ["zero"]=>
+ int(0)
+ [-2]=>
+ string(5) "value"
+}
+array(0) {
+}
+-- Iteration 7 --
+array(4) {
+ ["one"]=>
+ int(1)
+ [""]=>
+ string(5) "empty"
+ [5]=>
+ string(5) "float"
+ [1]=>
+ int(1)
+}
+array(4) {
+ ["one"]=>
+ int(1)
+ [""]=>
+ string(5) "empty"
+ [5]=>
+ string(5) "float"
+ [1]=>
+ int(1)
+}
+array(0) {
+}
+-- Iteration 8 --
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["key"]=>
+ string(5) "value"
+}
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ int(2)
+ ["key"]=>
+ string(5) "value"
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation4.phpt b/ext/standard/tests/array/array_filter_variation4.phpt
new file mode 100644
index 000000000..61f40b6e8
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation4.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test array_filter() function : usage variations - Different types of 'callback' function
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of callback functions to array_filter()
+* with parameter and return
+* with paramter and without return
+* without parameter and with return
+* without parameter and without return
+*/
+
+echo "*** Testing array_filter() : usage variation - different 'callback' functions***\n";
+
+// Initialize variables
+$input = array(0, -1, 2, 3.4E-3, 'hello', "value", "key" => 4, 'null' => NULL);
+
+// callback function without parameters and with return value
+function callback1()
+{
+ return 1;
+}
+echo "-- Callback function without parameter and with return --\n";
+var_dump( array_filter($input, "callback1") );
+
+// callback function with parameter and without return value
+function callback2($input)
+{
+}
+echo "-- Callback funciton with parameter and without return --\n";
+var_dump( array_filter($input, "callback2") );
+
+
+// callback function without parameter and without return value
+function callback3()
+{
+}
+echo "-- Callback function without parameter and return --\n";
+var_dump( array_filter($input, "callback3") );
+
+// callback function with parameter and with return value
+function callback4($input)
+{
+ if($input > 0 ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+echo "-- Callback function with parameter and return --\n";
+var_dump( array_filter($input, "callback4") );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variation - different 'callback' functions***
+-- Callback function without parameter and with return --
+array(8) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(-1)
+ [2]=>
+ int(2)
+ [3]=>
+ float(0.0034)
+ [4]=>
+ string(5) "hello"
+ [5]=>
+ string(5) "value"
+ ["key"]=>
+ int(4)
+ ["null"]=>
+ NULL
+}
+-- Callback funciton with parameter and without return --
+array(0) {
+}
+-- Callback function without parameter and return --
+array(0) {
+}
+-- Callback function with parameter and return --
+array(3) {
+ [2]=>
+ int(2)
+ [3]=>
+ float(0.0034)
+ ["key"]=>
+ int(4)
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation5.phpt b/ext/standard/tests/array/array_filter_variation5.phpt
new file mode 100644
index 000000000..66b140a22
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation5.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test array_filter() function : usage variations - 'input' argument with different false entries
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* With default callback function argument, array_filter() removes elements which are interpreted as false
+* Here Testing all the false array element possibilities
+*/
+
+// callback function always_true
+function always_true($input)
+{
+ return true;
+}
+
+// callback function always_false
+function always_false($input)
+{
+ return false;
+}
+
+echo "*** Testing array_filter() : usage variations - different false elements in 'input' ***\n";
+
+// unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// empty heredoc string
+$empty_heredoc =<<<EOT
+EOT;
+
+// input array with different false elements
+$input = array(
+ false,
+ False,
+ '',
+ "",
+ 0,
+ 0.0,
+ null,
+ NULL,
+ "0",
+ '0',
+ array(),
+ !1,
+ 1==2,
+ $empty_heredoc,
+ @$unset_var,
+ @$undefined_var,
+);
+
+// With default callback function
+var_dump( array_filter($input) );
+
+// With callback function which returns always true
+var_dump( array_filter($input, 'always_true') );
+
+// With callback function which returns always false
+var_dump( array_filter($input, 'always_false') );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - different false elements in 'input' ***
+array(0) {
+}
+array(16) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ string(0) ""
+ [3]=>
+ string(0) ""
+ [4]=>
+ int(0)
+ [5]=>
+ float(0)
+ [6]=>
+ NULL
+ [7]=>
+ NULL
+ [8]=>
+ string(1) "0"
+ [9]=>
+ string(1) "0"
+ [10]=>
+ array(0) {
+ }
+ [11]=>
+ bool(false)
+ [12]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+ [14]=>
+ NULL
+ [15]=>
+ NULL
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation6.phpt b/ext/standard/tests/array/array_filter_variation6.phpt
new file mode 100644
index 000000000..1020c28aa
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation6.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test array_filter() function : usage variations - 'input' array containing references
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing 'input' array which contains elements as reference to other data
+*/
+
+echo "*** Testing array_filter() : usage variations - 'input' containing references ***\n";
+
+// Callback function
+/* Prototype : bool callback(array $input)
+ * Parameter : $input - array of which each element need to be checked in function
+ * Return Type : returns true or false
+ * Description : This function checks each element of an input array if element > 5 then
+ * returns true else returns false
+ */
+function callback($input)
+{
+ if($input > 5) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+// initializing variables
+$value1 = array(1, 2, 8);
+$value2 = array(5, 6, 4);
+$input = array(&$value1, 10, &$value2, 'value');
+
+// with 'callback' argument
+var_dump( array_filter($input, 'callback') );
+
+// with default 'callback' argument
+var_dump( array_filter($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - 'input' containing references ***
+array(3) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(8)
+ }
+ [1]=>
+ int(10)
+ [2]=>
+ &array(3) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+ [2]=>
+ int(4)
+ }
+}
+array(4) {
+ [0]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(8)
+ }
+ [1]=>
+ int(10)
+ [2]=>
+ &array(3) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(6)
+ [2]=>
+ int(4)
+ }
+ [3]=>
+ string(5) "value"
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation7.phpt b/ext/standard/tests/array/array_filter_variation7.phpt
new file mode 100644
index 000000000..e34d9133e
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation7.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test array_filter() function : usage variations - anonymous callback functions
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different anonymous callback functions with passed by value and reference arguments,
+*/
+
+echo "*** Testing array_filter() : usage variations - Anonymous callback functions ***\n";
+
+$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
+
+// anonymous callback function
+echo "Anonymous callback function with regular parameter and statement\n";
+var_dump( array_filter($input, create_function('$input', 'return ($input > 1);') ) );
+
+// anonymous callback function with reference
+echo "Anonymous callback function with reference parameter\n";
+var_dump( array_filter($input, create_function('&$input', 'return ($input < 1);') ) );
+
+// anonymous callback function with null argument
+echo "Anonymous callback funciton with null argument\n";
+var_dump( array_filter($input, create_function(null, 'return true;') ) );
+
+// anonymous callback function with argument and null statement
+echo "Anonymous callback function with regular argument and null statement\n";
+var_dump( array_filter($input, create_function('$input', null) ) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - Anonymous callback functions ***
+Anonymous callback function with regular parameter and statement
+array(3) {
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+}
+Anonymous callback function with reference parameter
+array(4) {
+ [0]=>
+ int(0)
+ [2]=>
+ int(-1)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+}
+Anonymous callback funciton with null argument
+array(8) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+}
+Anonymous callback function with regular argument and null statement
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation8.phpt b/ext/standard/tests/array/array_filter_variation8.phpt
new file mode 100644
index 000000000..4440b3324
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation8.phpt
@@ -0,0 +1,151 @@
+--TEST--
+Test array_filter() function : usage variations - Callback function with different return values
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* callback functions are expected to return bool value for array_filter()
+* here testing callback functions for return values other than bool
+*/
+
+echo "*** Testing array_filter() : usage variations - callback function with different return values***\n";
+
+$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null, true);
+
+// callback functions
+// int as return value
+function callback1($input)
+{
+ return 5;
+}
+echo "callback function with int return value\n";
+var_dump( array_filter($input, 'callback1') );
+
+// float as return value
+function callback2($input)
+{
+ return 3.4;
+}
+echo "callback function with float return value\n";
+var_dump( array_filter($input, 'callback2') );
+
+// string as return value
+function callback3($input)
+{
+ return 'value';
+}
+echo "callback function with string return value\n";
+var_dump( array_filter($input, 'callback3') );
+
+// null as return value
+function callback4($input)
+{
+ return null;
+}
+echo "callback function with null return value\n";
+var_dump( array_filter($input, 'callback4') );
+
+// array as return value
+function callback5($input)
+{
+ return array(8);
+}
+echo "callback function with array as return value\n";
+var_dump( array_filter($input, 'callback5') );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - callback function with different return values***
+callback function with int return value
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+ [8]=>
+ bool(true)
+}
+callback function with float return value
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+ [8]=>
+ bool(true)
+}
+callback function with string return value
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+ [8]=>
+ bool(true)
+}
+callback function with null return value
+array(0) {
+}
+callback function with array as return value
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+ [8]=>
+ bool(true)
+}
+Done
diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt
new file mode 100644
index 000000000..c6db57c36
--- /dev/null
+++ b/ext/standard/tests/array/array_filter_variation9.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test array_filter() function : usage variations - built-in functions as 'callback' argument
+--FILE--
+<?php
+/* Prototype : array array_filter(array $input [, callback $callback])
+ * Description: Filters elements from the array via the callback.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing built-in functions and different language constructs as 'callback' argument
+*/
+
+echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
+
+$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
+
+// using built-in function 'is_int' as 'callback'
+var_dump( array_filter($input, 'is_int') );
+
+// using built-in function 'chr' as 'callback'
+var_dump( array_filter($input, 'chr') );
+
+// using language construct 'echo' as 'callback'
+var_dump( array_filter($input, 'echo') );
+
+// using language construct 'exit' as 'callback'
+var_dump( array_filter($input, 'exit') );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+}
+array(8) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(-1)
+ [3]=>
+ int(10)
+ [4]=>
+ int(100)
+ [5]=>
+ int(1000)
+ [6]=>
+ string(5) "Hello"
+ [7]=>
+ NULL
+}
+
+Warning: array_filter(): The second argument, 'echo', should be a valid callback in %s on line %d
+NULL
+
+Warning: array_filter(): The second argument, 'exit', should be a valid callback in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_flip_basic.phpt b/ext/standard/tests/array/array_flip_basic.phpt
new file mode 100644
index 000000000..08a63fb66
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_basic.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test array_flip() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> value flipped
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_flip() : basic functionality ***\n";
+
+// array with default keys - numeric values
+$input = array(1, 2);
+var_dump( array_flip($input) );
+
+// array with default keys - string values
+$input = array('value1', "value2");
+var_dump( array_flip($input) );
+
+// associative arrays - key as string
+$input = array('key1' => 1, "key2" => 2);
+var_dump( array_flip($input) );
+
+// associative arrays - key as numeric
+$input = array(1 => 'one', 2 => "two");
+var_dump( array_flip($input) );
+
+// combination of associative and non-associative array
+$input = array(1 => 'one','two', 3 => 'three', 4, "five" => 5);
+var_dump( array_flip($input) );
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_flip() : basic functionality ***
+array(2) {
+ [1]=>
+ int(0)
+ [2]=>
+ int(1)
+}
+array(2) {
+ ["value1"]=>
+ int(0)
+ ["value2"]=>
+ int(1)
+}
+array(2) {
+ [1]=>
+ string(4) "key1"
+ [2]=>
+ string(4) "key2"
+}
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(5) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ string(4) "five"
+}
+Done
diff --git a/ext/standard/tests/array/array_flip_error.phpt b/ext/standard/tests/array/array_flip_error.phpt
new file mode 100644
index 000000000..64339d76d
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test array_flip() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> value flipped
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_flip() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing array_flip() function with Zero arguments --\n";
+var_dump( array_flip() );
+
+//one more than the expected number of arguments
+echo "-- Testing array_flip() function with more than expected no. of arguments --\n";
+$input = array(1 => 'one', 2 => 'two');
+$extra_arg = 10;
+var_dump( array_flip($input, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_flip() : error conditions ***
+-- Testing array_flip() function with Zero arguments --
+
+Warning: Wrong parameter count for array_flip() in %s on line %d
+NULL
+-- Testing array_flip() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_flip() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_flip_variation1.phpt b/ext/standard/tests/array/array_flip_variation1.phpt
new file mode 100644
index 000000000..804280360
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation1.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test array_flip() function : usage variations - unexpected values for 'input' argument
+--FILE--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> value flipped
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_flip() : usage variations - unexpected values for 'input' ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//class definition for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__,'r');
+
+//array of values for 'input' argument
+$values = array(
+ // int data
+ /*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ /*5*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // null data
+ /*10*/ NULL,
+ null,
+
+ // boolean data
+ /*12*/ true,
+ false,
+ TRUE,
+ /*15*/ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ /*20*/ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ /*23*/ $fp
+);
+
+// loop through each element of $values for 'input' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1). " --\n";
+ var_dump( array_flip($values[$count]) );
+};
+
+//closing resource
+fclose($fp);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_flip() : usage variations - unexpected values for 'input' ***
+-- Iteration 1 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 20 --
+array(0) {
+}
+-- Iteration 21 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: array_flip(): The argument should be an array in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_flip_variation2.phpt b/ext/standard/tests/array/array_flip_variation2.phpt
new file mode 100644
index 000000000..bd8233054
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation2.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_flip_variation3.phpt b/ext/standard/tests/array/array_flip_variation3.phpt
new file mode 100644
index 000000000..376bdebb4
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_flip_variation4.phpt b/ext/standard/tests/array/array_flip_variation4.phpt
new file mode 100644
index 000000000..44d670f7f
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation4.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test array_flip() function : usage variations - 'input' argument with different invalid values for keys
+--FILE--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> value flipped
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Trying different invalid values for 'input' array argument
+*/
+
+echo "*** Testing array_flip() : different invalid values in 'input' array argument ***\n";
+
+// class definition for object data
+class MyClass
+{
+ public function __toString()
+ {
+ return 'object';
+ }
+}
+$obj = new MyClass();
+
+// resource data
+$fp = fopen(__FILE__, 'r');
+
+$input = array(
+ // float values
+ 'float_value1' => 1.2,
+ 'float_value2' => 0.5,
+ 'float_value3' => 3.4E3,
+ 'float_value4' => 5.6E-6,
+
+ // bool values
+ 'bool_value1' => true,
+ 'bool_value2' => false,
+ 'bool_value3' => TRUE,
+ 'bool_value4' => FALSE,
+
+ // null values
+ 'null_value1' => null,
+
+ // array value
+ 'array_value' => array(1),
+
+ // object value
+ 'obj_value' => $obj,
+
+ // resource value
+ 'resource_value' => $fp,
+);
+
+var_dump( array_flip($input) );
+
+// closing resource
+fclose($fp);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_flip() : different invalid values in 'input' array argument ***
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+
+Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_flip_variation5.phpt b/ext/standard/tests/array/array_flip_variation5.phpt
new file mode 100644
index 000000000..29222a12c
--- /dev/null
+++ b/ext/standard/tests/array/array_flip_variation5.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test array_flip() function : usage variations - 'input' argument with repeatitive keys and values
+--FILE--
+<?php
+/* Prototype : array array_flip(array $input)
+ * Description: Return array with key <-> value flipped
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Using different types of repeatitive keys as well as values for 'input' array
+*/
+
+echo "*** Testing array_flip() : 'input' array with repeatitive keys/values ***\n";
+
+// array with numeric key repeatition
+$input = array(1 => 'value', 2 => 'VALUE', 1 => "VaLuE", 3.4 => 4, 3.4 => 5);
+var_dump( array_flip($input) );
+
+// array with string key repeatition
+$input = array("key" => 1, "two" => 'TWO', 'three' => 3, 'key' => "FOUR");
+var_dump( array_flip($input) );
+
+// array with bool key repeatition
+$input = array(true => 1, false => 0, TRUE => -1);
+var_dump( array_flip($input) );
+
+// array with null key repeatition
+$input = array(null => "Hello", NULL => 0);
+var_dump( array_flip($input) );
+
+// array with numeric value repeatition
+$input = array('one' => 1, 'two' => 2, 3 => 1, "index" => 1);
+var_dump( array_flip($input) );
+
+//array with string value repeatition
+$input = array('key1' => "value1", "key2" => '2', 'key3' => 'value1');
+var_dump( array_flip($input) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing array_flip() : 'input' array with repeatitive keys/values ***
+array(3) {
+ ["VaLuE"]=>
+ int(1)
+ ["VALUE"]=>
+ int(2)
+ [5]=>
+ int(3)
+}
+array(3) {
+ ["FOUR"]=>
+ string(3) "key"
+ ["TWO"]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+}
+array(2) {
+ [-1]=>
+ int(1)
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ string(0) ""
+}
+array(2) {
+ [1]=>
+ string(5) "index"
+ [2]=>
+ string(3) "two"
+}
+array(2) {
+ ["value1"]=>
+ string(4) "key3"
+ [2]=>
+ string(4) "key2"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_basic.phpt b/ext/standard/tests/array/array_intersect_assoc_basic.phpt
new file mode 100644
index 000000000..bf0f2195a
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_basic.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test array_intersect_assoc() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect_assoc() by passing different arrays for the arguments.
+* Function is tested by passing associative array as well as array with default keys.
+*/
+
+echo "*** Testing array_intersect_assoc() : basic functionality ***\n";
+
+// array with default keys
+$arr_default_keys = array(1, 2, "hello", 'world');
+
+// associative array
+$arr_associative = array("one" => 1, "two" => 2);
+
+// default key array for both $arr1 and $arr2 argument
+var_dump( array_intersect_assoc($arr_default_keys, $arr_default_keys) );
+
+// default key array for $arr1 and associative array for $arr2 argument
+var_dump( array_intersect_assoc($arr_default_keys, $arr_associative) );
+
+// associative array for $arr1 and default key array for $arr2
+var_dump( array_intersect_assoc($arr_associative, $arr_default_keys) );
+
+// associative array for both $arr1 and $arr2 argument
+var_dump( array_intersect_assoc($arr_associative, $arr_associative) );
+
+// more arrays to be intersected
+$arr3 = array(2, 3, 4);
+var_dump( array_intersect_assoc($arr_default_keys, $arr_associative, $arr3) );
+var_dump( array_intersect_assoc($arr_associative, $arr_default_keys, $arr3, $arr_associative) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : basic functionality ***
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+}
+array(0) {
+}
+array(0) {
+}
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt
new file mode 100644
index 000000000..98b6e9317
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test array_intersect_assoc() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_intersect_assoc() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_intersect_assoc() function with Zero arguments --\n";
+var_dump( array_intersect_assoc() );
+
+// Testing array_intersect_assoc with one less than the expected number of arguments
+echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_intersect_assoc($arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : error conditions ***
+
+-- Testing array_intersect_assoc() function with Zero arguments --
+
+Warning: Wrong parameter count for array_intersect_assoc() in %s on line %d
+NULL
+
+-- Testing array_intersect_assoc() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_intersect_assoc() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
new file mode 100644
index 000000000..713ed82f9
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
@@ -0,0 +1,281 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - unexpected values for 'arr1' argument(Bug#43196)
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect_assoc() function by passing values to $arr1 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr2 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing non-array values to \$arr1 argument ***\n";
+
+// array to be passsed to $arr2 as default argument
+$arr2 = array(1, 2);
+
+// additional array to be passed for intersection
+$arr3 = array(1, 2, "one" => 1, "two" => 2);
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr1 argument
+$arrays = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($unexpected_value, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments
+ var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : Passing non-array values to $arr1 argument ***
+
+-- Iteration 1 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #1 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation10.phpt b/ext/standard/tests/array/array_intersect_assoc_variation10.phpt
new file mode 100644
index 000000000..9bce974a9
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation10.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect_assoc() by passing array with
+* binary values for $arr1 and $arr2 argument.
+*/
+
+echo "*** Testing array_intersect_assoc() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+// simple array
+$arr_normal = array("hello", "world");
+
+// array with binary value for $arr1 argument
+var_dump( array_intersect_assoc($arr_binary, $arr_normal) );
+
+// array with binary value for $arr2 argument
+var_dump( array_intersect_assoc($arr_normal, $arr_binary) );
+
+// array with binary value for both $arr1 and $arr2 argument
+var_dump( array_intersect_assoc($arr_binary, $arr_binary) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : binary safe checking ***
+array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+}
+array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+}
+array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
new file mode 100644
index 000000000..e82e7cfec
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
@@ -0,0 +1,282 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - unexpected values for 'arr2' argument(Bug#43196)
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect_assoc() function by passing values to $arr2 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing non-array values to \$arr2 argument ***\n";
+
+// array to be passsed to $arr1 as default argument
+$arr1 = array(1, 2);
+
+// additional array to be passed for intersection
+$arr3 = array(1, 2, "one" => 1, "two" => 2);
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr2 argument
+$arrays = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1,$unexpected_value) );
+
+ // Calling array_intersect_assoc() with more arguments
+ var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : Passing non-array values to $arr2 argument ***
+
+-- Iteration 1 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect_assoc(): Argument #2 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation3.phpt b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt
new file mode 100644
index 000000000..50be08059
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt
@@ -0,0 +1,243 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - different arrays for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr1 argument and testing whether
+* array_intersect_assoc() behaves in an expected way with the other arguments passed to the function
+* The $arr2 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing different types of arrays to \$arr1 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr1 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// arrays to be passed to $arr1 argument
+$arrays = array (
+/*1*/ array(1, 2), // with default keys and numeric values
+ array(1.1, 2.2), // with default keys & float values
+ array(false,true), // with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // with NULL
+ array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings
+ array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings
+ array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+
+// array to be passsed to $arr2 argument
+$arr2 = array (
+ 1, 1.1, 2.2, "hello", "one", NULL, 2,
+ 'world', true,5 => false, 1 => 'aaaa\r', "aaaa\r",
+ 'h3' => $diff_whitespaces, $numeric_string,
+ "one" => "ten", 4 => "four", "two" => 2,
+ '', null => "null", '' => 'emptys', "emptyd" => "",
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : Passing different types of arrays to $arr1 argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+-- Iteration 2 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 3 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 5 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 6 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 7 --
+array(1) {
+ [1]=>
+ string(6) "aaaa\r"
+}
+array(1) {
+ [1]=>
+ string(6) "aaaa\r"
+}
+-- Iteration 8 --
+array(1) {
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+array(1) {
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+-- Iteration 9 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 10 --
+array(1) {
+ ["two"]=>
+ int(2)
+}
+array(1) {
+ ["two"]=>
+ int(2)
+}
+-- Iteration 11 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 12 --
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+-- Iteration 13 --
+array(1) {
+ [4]=>
+ string(4) "four"
+}
+array(1) {
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 14 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 15 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 16 --
+array(2) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+}
+array(2) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(1) {
+ [5]=>
+ bool(false)
+}
+array(1) {
+ [5]=>
+ bool(false)
+}
+-- Iteration 18 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 19 --
+array(0) {
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation4.phpt b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt
new file mode 100644
index 000000000..ed2e3d951
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt
@@ -0,0 +1,254 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - different arrays for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr2 argument and testing whether
+* array_intersect_assoc() behaves in an expected way with the other arguments passed to the function.
+* The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : Passing different types of arrays to \$arr2 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr2 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// array to be passsed to $arr1 argument
+$arr1 = array (
+ 1, 1.1, 1.3, 1 => true, "hello", "one", NULL, 2,
+ 'world', true, false, 3 => "b\tbbb", "aaaa\r",
+ $numeric_string, "h3" => $diff_whitespaces, "true" => true,
+ "one" => "ten", 4 => "four", "two" => 2, 6 => "six",
+ '', null => "null", '' => 'emptys'
+);
+
+// arrays to be passed to $arr2 argument
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 1.2, 1.3), // array with default keys & float values
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // array with NULL
+ array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings
+ array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings
+ array($blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // array with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 6 => "six"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : Passing different types of arrays to $arr2 argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+-- Iteration 2 --
+array(1) {
+ [2]=>
+ float(1.3)
+}
+array(1) {
+ [2]=>
+ float(1.3)
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ bool(true)
+}
+array(1) {
+ [1]=>
+ bool(true)
+}
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 5 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 6 --
+array(1) {
+ [3]=>
+ string(5) "b bbb"
+}
+array(1) {
+ [3]=>
+ string(5) "b bbb"
+}
+-- Iteration 7 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 8 --
+array(1) {
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+array(1) {
+ ["h3"]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+-- Iteration 9 --
+array(1) {
+ [6]=>
+ string(3) "six"
+}
+array(1) {
+ [6]=>
+ string(3) "six"
+}
+-- Iteration 10 --
+array(1) {
+ ["two"]=>
+ int(2)
+}
+array(1) {
+ ["two"]=>
+ int(2)
+}
+-- Iteration 11 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 12 --
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+-- Iteration 13 --
+array(1) {
+ [4]=>
+ string(4) "four"
+}
+array(1) {
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 14 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 15 --
+array(1) {
+ ["true"]=>
+ bool(true)
+}
+array(1) {
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 16 --
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+array(1) {
+ [""]=>
+ string(6) "emptys"
+}
+-- Iteration 17 --
+array(1) {
+ [5]=>
+ NULL
+}
+array(1) {
+ [5]=>
+ NULL
+}
+-- Iteration 18 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 19 --
+array(0) {
+}
+array(0) {
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
new file mode 100644
index 000000000..b85dd7cee
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - assoc array with diff keys for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible keys to $arr1 argument.
+ * The $arr2 argument passed is a fixed array
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed keys
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// array to be passsed to $arr2 argument
+$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
+ "\tHello" => 111, 2.2, 'color', "Hello world" => "string",
+ "pen\n" => 33, new classA() => 11, 133 => "int");
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : assoc array with diff keys to $arr1 argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 3 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 5 --
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+-- Iteration 6 --
+array(2) {
+ [4]=>
+ string(2) "f3"
+ [33333333]=>
+ string(2) "f4"
+}
+array(2) {
+ [4]=>
+ string(2) "f3"
+ [33333333]=>
+ string(2) "f4"
+}
+-- Iteration 7 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 8 --
+array(2) {
+ [" Hello"]=>
+ int(111)
+ ["pen
+"]=>
+ int(33)
+}
+array(2) {
+ [" Hello"]=>
+ int(111)
+ ["pen
+"]=>
+ int(33)
+}
+-- Iteration 9 --
+array(1) {
+ ["Hello world"]=>
+ string(6) "string"
+}
+array(1) {
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+array(1) {
+ [133]=>
+ string(3) "int"
+}
+array(1) {
+ [133]=>
+ string(3) "int"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
new file mode 100644
index 000000000..ed96d3276
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - assoc array with diff keys for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible keys to $arr2 argument.
+ * The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff keys to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed keys
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// array to be passsed to $arr1 argument
+$arr1 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
+ "\tHello" => 111, 2.2, 'color', "Hello world" => "string",
+ "pen\n" => 33, new classA() => 11, 133 => "int");
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : assoc array with diff keys to $arr2 argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 3 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 5 --
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+-- Iteration 6 --
+array(2) {
+ [4]=>
+ string(2) "f3"
+ [33333333]=>
+ string(2) "f4"
+}
+array(2) {
+ [4]=>
+ string(2) "f3"
+ [33333333]=>
+ string(2) "f4"
+}
+-- Iteration 7 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 8 --
+array(2) {
+ [" Hello"]=>
+ int(111)
+ ["pen
+"]=>
+ int(33)
+}
+array(2) {
+ [" Hello"]=>
+ int(111)
+ ["pen
+"]=>
+ int(33)
+}
+-- Iteration 9 --
+array(1) {
+ ["Hello world"]=>
+ string(6) "string"
+}
+array(1) {
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+array(1) {
+ [133]=>
+ string(3) "int"
+}
+array(1) {
+ [133]=>
+ string(3) "int"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt
new file mode 100644
index 000000000..ba2f79a7e
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt
@@ -0,0 +1,212 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - assoc array with diff values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible values to $arr1 argument.
+ * The $arr2 argument passed is a fixed array
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff values to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// array to be passsed to $arr2 argument
+$arr2 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2,
+ "f4" => 33333333.333, 111 => "\tHello", 3.3 => 'pen\n', '\v\fworld',
+ "heredoc" => "Hello world", 11 => new classA(), "resource" => $fp,
+ "int" => 133, 222 => "fruit");
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : assoc array with diff values to $arr1 argument ***
+-- Iteration 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ int(1)
+}
+array(1) {
+ [1]=>
+ int(1)
+}
+-- Iteration 4 --
+array(1) {
+ ["two"]=>
+ int(2)
+}
+array(1) {
+ ["two"]=>
+ int(2)
+}
+-- Iteration 5 --
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+array(2) {
+ ["f1"]=>
+ float(1.2)
+ ["f4"]=>
+ float(33333333.333)
+}
+array(2) {
+ ["f1"]=>
+ float(1.2)
+ ["f4"]=>
+ float(33333333.333)
+}
+-- Iteration 7 --
+array(1) {
+ [111]=>
+ string(6) " Hello"
+}
+array(1) {
+ [111]=>
+ string(6) " Hello"
+}
+-- Iteration 8 --
+array(1) {
+ [3]=>
+ string(5) "pen\n"
+}
+array(1) {
+ [3]=>
+ string(5) "pen\n"
+}
+-- Iteration 9 --
+array(1) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+array(1) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 10 --
+array(2) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+array(2) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+-- Iteration 11 --
+array(4) {
+ [222]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+array(4) {
+ [222]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt
new file mode 100644
index 000000000..6ec8fb08d
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt
@@ -0,0 +1,212 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - assoc array with diff values for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect_assoc() by passing different
+ * associative arrays having different possible values to $arr2 argument.
+ * The $arr1 argument passed is a fixed array.
+*/
+
+echo "*** Testing array_intersect_assoc() : assoc array with diff values to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// array to be passsed to $arr1 argument
+$arr1 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2,
+ "f4" => 33333333.333, 111 => "\tHello", 3.3 => 'pen\n', '\v\fworld',
+ "heredoc" => "Hello world", 11 => new classA(), "resource" => $fp,
+ "int" => 133, 222 => "fruit");
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect_assoc() with default arguments
+ var_dump( array_intersect_assoc($arr1, $arr2) );
+
+ // Calling array_intersect_assoc() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : assoc array with diff values to $arr2 argument ***
+-- Iteration 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 3 --
+array(1) {
+ [1]=>
+ int(1)
+}
+array(1) {
+ [1]=>
+ int(1)
+}
+-- Iteration 4 --
+array(1) {
+ ["two"]=>
+ int(2)
+}
+array(1) {
+ ["two"]=>
+ int(2)
+}
+-- Iteration 5 --
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+array(2) {
+ ["f1"]=>
+ float(1.2)
+ ["f4"]=>
+ float(33333333.333)
+}
+array(2) {
+ ["f1"]=>
+ float(1.2)
+ ["f4"]=>
+ float(33333333.333)
+}
+-- Iteration 7 --
+array(1) {
+ [111]=>
+ string(6) " Hello"
+}
+array(1) {
+ [111]=>
+ string(6) " Hello"
+}
+-- Iteration 8 --
+array(1) {
+ [3]=>
+ string(5) "pen\n"
+}
+array(1) {
+ [3]=>
+ string(5) "pen\n"
+}
+-- Iteration 9 --
+array(1) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+array(1) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 10 --
+array(2) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+array(2) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+-- Iteration 11 --
+array(4) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ [222]=>
+ string(5) "fruit"
+}
+array(4) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ [222]=>
+ string(5) "fruit"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation9.phpt b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
new file mode 100644
index 000000000..456109b1c
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test array_intersect_assoc() function : usage variations - two dimensional arrays for $arr1 and $arr2 arguments
+--FILE--
+<?php
+/* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
+ * Keys are used to do more restrictive check
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect_assoc() by passing 2-D arrays
+* to both $arr1 and $arr2 argument.
+* Optional argument takes the same value as that of $arr1
+*/
+
+echo "*** Testing array_intersect_assoc() : passing two dimensional array to both \$arr1 and \$arr2 arguments ***\n";
+
+// two dimensional arrays for $arr1 and $arr2 argument
+$arr1 = array (
+
+ // arrays with default keys
+ array(1, 2, "hello", 'world'),
+ array(1, 2, 3, 4),
+
+ // arrays with explicit keys
+ array(1 => "one", 2 => "two", 3 => "three"),
+ array("ten" => 10, "twenty" => 20.00, "thirty" => 30)
+);
+
+$arr2 = array (
+ array(1, 2, 3, 4),
+ array(1 => "one", 2 => "two", 3 => "three")
+);
+
+/* Passing the entire array as argument to $arr1 and $arr2 */
+// Calling array_intersect_assoc() with default arguments
+echo "-- Passing the entire 2-D array to \$arr1 and \$arr2 --\n";
+echo "- With default arguments -\n";
+var_dump( array_intersect_assoc($arr1, $arr2) );
+
+// Calling array_intersect_assoc() with more arguments
+// additional argument passed is the same as $arr1
+echo "- With more arguments -\n";
+var_dump( array_intersect_assoc($arr1, $arr2, $arr1) );
+
+/* Passing the sub-array as argument to $arr1 and $arr2 */
+// Calling array_intersect_assoc() with default arguments
+echo "-- Passing the sub-array to \$arr1 and \$arr2 --\n";
+echo "- With default arguments -\n";
+var_dump( array_intersect_assoc($arr1[0], $arr2[0]) );
+
+// Calling array_intersect_assoc() with more arguments
+// additional argument passed is the same as $arr1
+echo "- With more arguments -\n";
+var_dump( array_intersect_assoc($arr1[0], $arr2[0], $arr1[0]) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect_assoc() : passing two dimensional array to both $arr1 and $arr2 arguments ***
+-- Passing the entire 2-D array to $arr1 and $arr2 --
+- With default arguments -
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+}
+- With more arguments -
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+}
+-- Passing the sub-array to $arr1 and $arr2 --
+- With default arguments -
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+- With more arguments -
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_basic.phpt b/ext/standard/tests/array/array_intersect_basic.phpt
new file mode 100644
index 000000000..fde5782c9
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_basic.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test array_intersect() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect() by passing different arrays for the arguments.
+* Function is tested by passing associative array as well as array with default keys.
+*/
+
+echo "*** Testing array_intersect() : basic functionality ***\n";
+
+// array with default keys
+$arr_default_keys = array(1, 2, "hello", 'world');
+
+// associative array
+$arr_associative = array("one" => 1, "two" => 2);
+
+// default key array for both $arr1 and $arr2 argument
+var_dump( array_intersect($arr_default_keys, $arr_default_keys) );
+
+// default key array for $arr1 and associative array for $arr2 argument
+var_dump( array_intersect($arr_default_keys, $arr_associative) );
+
+// associative array for $arr1 and default key array for $arr2
+var_dump( array_intersect($arr_associative, $arr_default_keys) );
+
+// associative array for both $arr1 and $arr2 argument
+var_dump( array_intersect($arr_associative, $arr_associative) );
+
+// more arrays to be intersected
+$arr3 = array(2, 3, 4);
+var_dump( array_intersect($arr_default_keys, $arr_associative, $arr3) );
+var_dump( array_intersect($arr_associative, $arr_default_keys, $arr3, $arr_associative) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : basic functionality ***
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+}
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(1) {
+ [1]=>
+ int(2)
+}
+array(1) {
+ ["two"]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt
new file mode 100644
index 000000000..5161a1c7e
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test array_intersect() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_intersect() : error conditions ***\n";
+
+// Testing array_intersect() with zero arguments
+echo "\n-- Testing array_intersect() function with Zero arguments --\n";
+var_dump( array_intersect() );
+
+// Testing array_intersect() with one less than the expected number of arguments
+echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n";
+$arr1 = array(1, 2);
+var_dump( array_intersect($arr1) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : error conditions ***
+
+-- Testing array_intersect() function with Zero arguments --
+
+Warning: Wrong parameter count for array_intersect() in %s on line %d
+NULL
+
+-- Testing array_intersect() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_intersect() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt
new file mode 100644
index 000000000..ca203ff46
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation1.phpt
@@ -0,0 +1,280 @@
+--TEST--
+Test array_intersect() function : usage variations - unexpected values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect() function by passing values to $arr1 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr2 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing non-array values to \$arr1 argument ***\n";
+
+// array to be passsed to $arr2 as default argument
+$arr2 = array(1, 2);
+
+// array to be passed to optional argument
+$arr3 = array(1, 2, "one" => 1, "two" => 2);
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr1 argument
+$arrays = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($unexpected_value,$arr2) );
+
+ // Calling array_intersect() with more arguments
+ var_dump( array_intersect($unexpected_value, $arr2, $arr3) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : Passing non-array values to $arr1 argument ***
+
+-- Iterator 1 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 2 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 3 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 4 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 5 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 6 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 7 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 8 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 9 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 10 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 11 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 12 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 13 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 14 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 15 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 16 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 17 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 18 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 19 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 20 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 21 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 22 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 23 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+-- Iterator 24 --
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #1 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation10.phpt b/ext/standard/tests/array/array_intersect_variation10.phpt
new file mode 100644
index 000000000..e193f97d4
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation10.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test array_intersect() function : usage variations - binary safe checking
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect() by passing array with
+* binary values for $arr1 and $arr2 argument.
+*/
+
+echo "*** Testing array_intersect() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+// simple array
+$arr_normal = array("hello", "world");
+
+// array with binary value for $arr1 argument
+var_dump( array_intersect($arr_binary, $arr_normal) );
+
+// array with binary value for $arr2 argument
+var_dump( array_intersect($arr_normal, $arr_binary) );
+
+// array with binary value for both $arr1 and $arr2 argument
+var_dump( array_intersect($arr_binary, $arr_binary) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : binary safe checking ***
+array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+}
+array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+}
+array(2) {
+ [0]=>
+ string(5) "hello"
+ [1]=>
+ string(5) "world"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt
new file mode 100644
index 000000000..b690fc995
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation2.phpt
@@ -0,0 +1,281 @@
+--TEST--
+Test array_intersect() function : usage variations - unexpected values for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing array_intersect() function by passing values to $arr2 argument other than arrays
+* and see that function emits proper warning messages wherever expected.
+* The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing non-array values to \$arr2 argument ***\n";
+
+// array to be passsed to $arr1 as default argument
+$arr1 = array(1, 2);
+
+// arrays to be passed to optional argument
+$arr3 = array(1, 2, "one" => 1, "two" => 2);
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arr2 argument
+$arrays = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $unexpected_value) {
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1,$unexpected_value) );
+
+ // Calling array_intersect() with more arguments
+ var_dump( array_intersect($arr1, $unexpected_value, $arr3) );
+
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : Passing non-array values to $arr2 argument ***
+
+-- Iterator 1 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 2 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 3 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 4 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 5 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 6 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 7 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 8 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 9 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 10 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 11 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 12 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 13 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 14 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 15 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 16 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 17 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 18 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 19 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 20 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 21 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 22 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 23 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+-- Iterator 24 --
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+
+Warning: array_intersect(): Argument #2 is not an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation3.phpt b/ext/standard/tests/array/array_intersect_variation3.phpt
new file mode 100644
index 000000000..b2b7d8ac0
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation3.phpt
@@ -0,0 +1,342 @@
+--TEST--
+Test array_intersect() function : usage variations - different arrays for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr1 argument and testing whether
+* array_intersect() behaves in expected way with the other arguments passed to the function
+* The $arr2 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing different types of arrays to \$arr1 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr1 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// arrays to be passed to $arr1 argument
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 2.2), // array with default keys & float values
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // array with NULL
+ array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings
+ array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings
+ array($blank_line, $multiline_string, $diff_whitespaces, $numeric_string), // array with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+
+// array to be passsed to $arr2 argument
+$arr2 = array (
+ 1, 1.1, "hello", "one", NULL, 2,
+ 'world', true, false, false => 5, 'aaaa\r', "aaaa\r",
+ $numeric_string, $diff_whitespaces,
+ "one" => "ten", 4 => "four", "two" => 2, 2 => "two",
+ '', null => "null", '' => 'emptys'
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iterator $iterator --\n";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1, $arr2) );
+
+ // Calling array_intersect() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : Passing different types of arrays to $arr1 argument ***
+-- Iterator 1 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iterator 2 --
+array(1) {
+ [0]=>
+ float(1.1)
+}
+array(1) {
+ [0]=>
+ float(1.1)
+}
+-- Iterator 3 --
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(true)
+}
+-- Iterator 4 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 5 --
+array(1) {
+ [0]=>
+ NULL
+}
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iterator 6 --
+array(1) {
+ [1]=>
+ string(5) "aaaa "
+}
+array(1) {
+ [1]=>
+ string(5) "aaaa "
+}
+-- Iterator 7 --
+array(1) {
+ [1]=>
+ string(6) "aaaa\r"
+}
+array(1) {
+ [1]=>
+ string(6) "aaaa\r"
+}
+-- Iterator 8 --
+array(2) {
+ [2]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [3]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+}
+array(2) {
+ [2]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [3]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+}
+-- Iterator 9 --
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+-- Iterator 10 --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+-- Iterator 11 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 12 --
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+-- Iterator 13 --
+array(3) {
+ ["one"]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iterator 14 --
+array(2) {
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+array(2) {
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- Iterator 15 --
+array(2) {
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+array(2) {
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iterator 16 --
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+array(3) {
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- Iterator 17 --
+array(6) {
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+array(6) {
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+-- Iterator 18 --
+array(1) {
+ [0]=>
+ int(5)
+}
+array(1) {
+ [0]=>
+ int(5)
+}
+-- Iterator 19 --
+array(0) {
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation4.phpt b/ext/standard/tests/array/array_intersect_variation4.phpt
new file mode 100644
index 000000000..4f1d6f3dd
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation4.phpt
@@ -0,0 +1,349 @@
+--TEST--
+Test array_intersect() function : usage variations - different arrays for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Passing different types of arrays to $arr2 argument and testing whether
+* array_intersect() behaves in expected way with the other arguments passed to the function.
+* The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : Passing different types of arrays to \$arr2 argument ***\n";
+
+/* Different heredoc strings passed as argument to $arr2 */
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with quoted strings and numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// array to be passsed to $arr1 argument
+$arr1 = array (
+ 1, 1.1, "hello", "one", NULL, 2,
+ 'world', true, false, false => 5, 'aaaa\r', "aaaa\r",
+ $numeric_string, $diff_whitespaces,
+ "one" => "ten", 4 => "four", "two" => 2, 2 => "two",
+ '', null => "null", '' => 'emptys'
+);
+
+// arrays to be passed to $arr2 argument
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 2.2), // array with default keys & float values
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+/*5*/ array(NULL), // array with NULL
+ array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // array with double quoted strings
+ array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // array with single quoted strings
+ array($blank_line, $multiline_string, $diff_whitespaces, $numeric_string), // array with heredocs
+
+ // associative arrays
+/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "-- Iteration $iterator --\n";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1, $arr2) );
+
+ // Calling array_intersect() with more arguments
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : Passing different types of arrays to $arr2 argument ***
+-- Iteration 1 --
+array(3) {
+ [5]=>
+ int(2)
+ [7]=>
+ bool(true)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ [5]=>
+ int(2)
+ [7]=>
+ bool(true)
+ ["two"]=>
+ int(2)
+}
+-- Iteration 2 --
+array(1) {
+ [1]=>
+ float(1.1)
+}
+array(1) {
+ [1]=>
+ float(1.1)
+}
+-- Iteration 3 --
+array(3) {
+ [7]=>
+ bool(true)
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+array(3) {
+ [7]=>
+ bool(true)
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+-- Iteration 4 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 5 --
+array(2) {
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+array(2) {
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+-- Iteration 6 --
+array(1) {
+ [10]=>
+ string(5) "aaaa "
+}
+array(1) {
+ [10]=>
+ string(5) "aaaa "
+}
+-- Iteration 7 --
+array(1) {
+ [9]=>
+ string(6) "aaaa\r"
+}
+array(1) {
+ [9]=>
+ string(6) "aaaa\r"
+}
+-- Iteration 8 --
+array(2) {
+ [11]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+ [12]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+array(2) {
+ [11]=>
+ string(90) "11 < 12. 123 >22
+'single quoted string'
+"double quoted string"
+2222 != 1111. 0000 = 0000
+"
+ [12]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+}
+-- Iteration 9 --
+array(2) {
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(3) "one"
+}
+array(2) {
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(3) "one"
+}
+-- Iteration 10 --
+array(3) {
+ [5]=>
+ int(2)
+ [7]=>
+ bool(true)
+ ["two"]=>
+ int(2)
+}
+array(3) {
+ [5]=>
+ int(2)
+ [7]=>
+ bool(true)
+ ["two"]=>
+ int(2)
+}
+-- Iteration 11 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 12 --
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+array(1) {
+ ["one"]=>
+ string(3) "ten"
+}
+-- Iteration 13 --
+array(3) {
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+ [7]=>
+ bool(true)
+}
+array(3) {
+ [2]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+ [7]=>
+ bool(true)
+}
+-- Iteration 14 --
+array(2) {
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+array(2) {
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+-- Iteration 15 --
+array(3) {
+ [7]=>
+ bool(true)
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+array(3) {
+ [7]=>
+ bool(true)
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+-- Iteration 16 --
+array(3) {
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+ [""]=>
+ string(6) "emptys"
+}
+array(3) {
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+ [""]=>
+ string(6) "emptys"
+}
+-- Iteration 17 --
+array(3) {
+ [7]=>
+ bool(true)
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+array(3) {
+ [7]=>
+ bool(true)
+ [8]=>
+ bool(false)
+ [13]=>
+ string(0) ""
+}
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ int(5)
+}
+array(1) {
+ [0]=>
+ int(5)
+}
+-- Iteration 19 --
+array(0) {
+}
+array(0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt
new file mode 100644
index 000000000..7f36ee3f2
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation5.phpt
@@ -0,0 +1,214 @@
+--TEST--
+Test array_intersect() function : usage variations - assoc array with diff keys for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible keys to $arr1 argument.
+ * The $arr2 argument is a fixed array
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff keys to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed keys
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// array to be passsed to $arr2 argument
+$arr2 = array(1, "float", "f4", "hello", 2.2, 'color', "string", "pen\n", 11);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iterator $iterator --\n";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1, $arr2) );
+
+ // Calling array_intersect() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : assoc array with diff keys to $arr1 argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iterator 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 2 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 3 --
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+-- Iterator 4 --
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+-- Iterator 5 --
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+-- Iterator 6 --
+array(1) {
+ [33333333]=>
+ string(2) "f4"
+}
+array(1) {
+ [33333333]=>
+ string(2) "f4"
+}
+-- Iterator 7 --
+array(2) {
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+}
+array(2) {
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+}
+-- Iterator 8 --
+array(2) {
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+}
+array(2) {
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+}
+-- Iterator 9 --
+array(2) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+array(2) {
+ [0]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iterator 10 --
+array(1) {
+ [""]=>
+ string(5) "hello"
+}
+array(1) {
+ [""]=>
+ string(5) "hello"
+}
+-- Iterator 11 --
+array(3) {
+ ["hello"]=>
+ int(1)
+ ["fruit"]=>
+ float(2.2)
+ [444]=>
+ string(5) "float"
+}
+array(3) {
+ ["hello"]=>
+ int(1)
+ ["fruit"]=>
+ float(2.2)
+ [444]=>
+ string(5) "float"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt
new file mode 100644
index 000000000..cecde34db
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation6.phpt
@@ -0,0 +1,214 @@
+--TEST--
+Test array_intersect() function : usage variations - assoc array with diff keys for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible keys to $arr2 argument.
+ * The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff keys to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed keys
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// array to be passsed to $arr1 argument
+$arr1 = array(1, "float", "f4", "hello", 2.2, 'color', "string", "pen\n", 11);
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "-- Iterator $iterator --\n";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1, $arr2) );
+
+ // Calling array_intersect() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : assoc array with diff keys to $arr2 argument ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iterator 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 2 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 3 --
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+-- Iterator 4 --
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+-- Iterator 5 --
+array(1) {
+ [1]=>
+ string(5) "float"
+}
+array(1) {
+ [1]=>
+ string(5) "float"
+}
+-- Iterator 6 --
+array(1) {
+ [2]=>
+ string(2) "f4"
+}
+array(1) {
+ [2]=>
+ string(2) "f4"
+}
+-- Iterator 7 --
+array(2) {
+ [4]=>
+ float(2.2)
+ [5]=>
+ string(5) "color"
+}
+array(2) {
+ [4]=>
+ float(2.2)
+ [5]=>
+ string(5) "color"
+}
+-- Iterator 8 --
+array(2) {
+ [4]=>
+ float(2.2)
+ [5]=>
+ string(5) "color"
+}
+array(2) {
+ [4]=>
+ float(2.2)
+ [5]=>
+ string(5) "color"
+}
+-- Iterator 9 --
+array(2) {
+ [3]=>
+ string(5) "hello"
+ [6]=>
+ string(6) "string"
+}
+array(2) {
+ [3]=>
+ string(5) "hello"
+ [6]=>
+ string(6) "string"
+}
+-- Iterator 10 --
+array(1) {
+ [3]=>
+ string(5) "hello"
+}
+array(1) {
+ [3]=>
+ string(5) "hello"
+}
+-- Iterator 11 --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(5) "float"
+ [4]=>
+ float(2.2)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(5) "float"
+ [4]=>
+ float(2.2)
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation7.phpt b/ext/standard/tests/array/array_intersect_variation7.phpt
new file mode 100644
index 000000000..da1088c5e
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation7.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test array_intersect() function : usage variations - assoc array with diff values for 'arr1' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible values to $arr1 argument.
+ * The $arr2 argument is a fixed array
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff values to \$arr1 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr1 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// array to be passsed to $arr2 argument
+$arr2 = array(1, 2, 1.2, 2.3333, "col\tor", '\v\fworld', $fp,
+ "Hello world", $heredoc, new classA(), 444.432, "fruit");
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $arr1) {
+ echo "-- Iterator $iterator --\n";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1, $arr2) );
+
+ // Calling array_intersect() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : assoc array with diff values to $arr1 argument ***
+-- Iterator 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 2 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 3 --
+array(1) {
+ [1]=>
+ int(1)
+}
+array(1) {
+ [1]=>
+ int(1)
+}
+-- Iterator 4 --
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+-- Iterator 5 --
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+-- Iterator 6 --
+array(1) {
+ ["f1"]=>
+ float(1.2)
+}
+array(1) {
+ ["f1"]=>
+ float(1.2)
+}
+-- Iterator 7 --
+array(1) {
+ ["red"]=>
+ string(6) "col or"
+}
+array(1) {
+ ["red"]=>
+ string(6) "col or"
+}
+-- Iterator 8 --
+array(1) {
+ [2]=>
+ string(9) "\v\fworld"
+}
+array(1) {
+ [2]=>
+ string(9) "\v\fworld"
+}
+-- Iterator 9 --
+array(1) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+array(1) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iterator 10 --
+array(2) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+array(2) {
+ [11]=>
+ object(classA)#%d (0) {
+ }
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+-- Iterator 11 --
+array(5) {
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [222]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["float"]=>
+ float(444.432)
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+array(5) {
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [222]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["float"]=>
+ float(444.432)
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation8.phpt b/ext/standard/tests/array/array_intersect_variation8.phpt
new file mode 100644
index 000000000..91eae49aa
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation8.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test array_intersect() function : usage variations - assoc array with diff values for 'arr2' argument
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_intersect() by passing different
+ * associative arrays having different possible values to $arr2 argument.
+ * The $arr1 argument is a fixed array.
+*/
+
+echo "*** Testing array_intersect() : assoc array with diff values to \$arr2 argument ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// different variations of associative arrays to be passed to $arr2 argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit",
+ 'resource' => $fp, "int" => 133, "float" => 444.432,
+ "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// array to be passsed to $arr1 argument
+$arr1 = array(1, 2, 1.2, 2.3333, "col\tor", '\v\fworld', $fp,
+ "Hello world", $heredoc, new classA(), 444.432, "fruit");
+
+// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+$iterator = 1;
+foreach($arrays as $arr2) {
+ echo "-- Iterator $iterator --\n";
+
+ // Calling array_intersect() with default arguments
+ var_dump( array_intersect($arr1, $arr2) );
+
+ // Calling array_intersect() with more arguments.
+ // additional argument passed is the same as $arr1 argument
+ var_dump( array_intersect($arr1, $arr2, $arr1) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : assoc array with diff values to $arr2 argument ***
+-- Iterator 1 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 2 --
+array(0) {
+}
+array(0) {
+}
+-- Iterator 3 --
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+-- Iterator 4 --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+-- Iterator 5 --
+array(1) {
+ [3]=>
+ float(2.3333)
+}
+array(1) {
+ [3]=>
+ float(2.3333)
+}
+-- Iterator 6 --
+array(1) {
+ [2]=>
+ float(1.2)
+}
+array(1) {
+ [2]=>
+ float(1.2)
+}
+-- Iterator 7 --
+array(1) {
+ [4]=>
+ string(6) "col or"
+}
+array(1) {
+ [4]=>
+ string(6) "col or"
+}
+-- Iterator 8 --
+array(1) {
+ [5]=>
+ string(9) "\v\fworld"
+}
+array(1) {
+ [5]=>
+ string(9) "\v\fworld"
+}
+-- Iterator 9 --
+array(2) {
+ [7]=>
+ string(11) "Hello world"
+ [8]=>
+ string(11) "Hello world"
+}
+array(2) {
+ [7]=>
+ string(11) "Hello world"
+ [8]=>
+ string(11) "Hello world"
+}
+-- Iterator 10 --
+array(2) {
+ [6]=>
+ resource(%d) of type (stream)
+ [9]=>
+ object(classA)#%d (0) {
+ }
+}
+array(2) {
+ [6]=>
+ resource(%d) of type (stream)
+ [9]=>
+ object(classA)#%d (0) {
+ }
+}
+-- Iterator 11 --
+array(6) {
+ [6]=>
+ resource(%d) of type (stream)
+ [7]=>
+ string(11) "Hello world"
+ [8]=>
+ string(11) "Hello world"
+ [9]=>
+ object(classA)#%d (0) {
+ }
+ [10]=>
+ float(444.432)
+ [11]=>
+ string(5) "fruit"
+}
+array(6) {
+ [6]=>
+ resource(%d) of type (stream)
+ [7]=>
+ string(11) "Hello world"
+ [8]=>
+ string(11) "Hello world"
+ [9]=>
+ object(classA)#%d (0) {
+ }
+ [10]=>
+ float(444.432)
+ [11]=>
+ string(5) "fruit"
+}
+Done
diff --git a/ext/standard/tests/array/array_intersect_variation9.phpt b/ext/standard/tests/array/array_intersect_variation9.phpt
new file mode 100644
index 000000000..ac3c887f3
--- /dev/null
+++ b/ext/standard/tests/array/array_intersect_variation9.phpt
@@ -0,0 +1,163 @@
+--TEST--
+Test array_intersect() function : usage variations - two dimensional arrays for $arr1 and $arr2 arguments
+--FILE--
+<?php
+/* Prototype : array array_intersect(array $arr1, array $arr2 [, array $...])
+ * Description: Returns the entries of arr1 that have values which are present in all the other arguments
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_intersect() by passing 2-D arrays
+* to both $arr1 and $arr2 argument.
+* Optional argument takes the same value as that of $arr1
+*/
+
+echo "*** Testing array_intersect() : passing two dimensional array to both \$arr1 and \$arr2 arguments ***\n";
+
+// two dimensional arrays for $arr1 and $arr2 argument
+$arr1 = array (
+
+ // arrays with default keys
+ array(1, 2, "hello", 'world'),
+ array(1, 2, 3, 4),
+
+ // arrays with explicit keys
+ array(1 => "one", 2 => "two", 3 => "three"),
+ array("ten" => 10, "twenty" => 20.00, "thirty" => 30)
+);
+
+$arr2 = array (
+ array(1, 2, 3, 4),
+ array(1 => "one", 2 => "two", 3 => "three")
+);
+
+/* Passing the entire array as argument to $arr1 and $arr2 */
+// Calling array_intersect() with default arguments
+echo "-- Passing the entire 2-D array to \$arr1 and \$arr2 --\n";
+echo "- With default arguments -\n";
+var_dump( array_intersect($arr1, $arr2) );
+
+// Calling array_intersect() with more arguments
+// additional argument passed is the same as $arr1
+echo "- With more arguments -\n";
+var_dump( array_intersect($arr1, $arr2, $arr1) );
+
+/* Passing the sub-array as argument to $arr1 and $arr2 */
+// Calling array_intersect() with default arguments
+echo "-- Passing the sub-array to \$arr1 and \$arr2 --\n";
+echo "- With default arguments -\n";
+var_dump( array_intersect($arr1[0], $arr2[0]) );
+
+// Calling array_intersect() with more arguments
+// additional argument passed is the same as $arr1
+echo "- With more arguments -\n";
+var_dump( array_intersect($arr1[0], $arr2[0], $arr1[0]) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_intersect() : passing two dimensional array to both $arr1 and $arr2 arguments ***
+-- Passing the entire 2-D array to $arr1 and $arr2 --
+- With default arguments -
+array(4) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+ [2]=>
+ array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ }
+ [3]=>
+ array(3) {
+ ["ten"]=>
+ int(10)
+ ["twenty"]=>
+ float(20)
+ ["thirty"]=>
+ int(30)
+ }
+}
+- With more arguments -
+array(4) {
+ [0]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "hello"
+ [3]=>
+ string(5) "world"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ }
+ [2]=>
+ array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+ }
+ [3]=>
+ array(3) {
+ ["ten"]=>
+ int(10)
+ ["twenty"]=>
+ float(20)
+ ["thirty"]=>
+ int(30)
+ }
+}
+-- Passing the sub-array to $arr1 and $arr2 --
+- With default arguments -
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+- With more arguments -
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_map_001.phpt b/ext/standard/tests/array/array_map_001.phpt
new file mode 100644
index 000000000..646eb7695
--- /dev/null
+++ b/ext/standard/tests/array/array_map_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+array_map() and exceptions in the callback
+--FILE--
+<?php
+
+$a = array(1,2,3);
+
+function foo() {
+ throw new exception(1);
+}
+
+try {
+ array_map("foo", $a, array(2,3));
+} catch (Exception $e) {
+ var_dump("exception caught!");
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: array_map(): An error occurred while invoking the map callback in %s on line %d
+string(17) "exception caught!"
+Done
diff --git a/ext/standard/tests/array/array_rand_basic1.phpt b/ext/standard/tests/array/array_rand_basic1.phpt
new file mode 100644
index 000000000..0a8c2d88f
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_basic1.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test array_rand() function : basic functionality - array with default keys
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Test array_rand() when array with default keys is passed to 'input' argument
+*/
+
+echo "*** Testing array_rand() : array with default keys ***\n";
+
+
+// Initialise the 'input' and 'num_req' variables
+$input = array(10, 20, 30, 40, 50, 60, 70);
+$num_req = 6;
+
+// Calling array_rand() with optional argument
+echo"\n-- with all default and optional arguments --\n";
+var_dump( array_rand($input,$num_req) );
+
+// Calling array_rand() with default arguments
+echo"\n-- with default argument --\n";
+var_dump( array_rand($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : array with default keys ***
+
+-- with all default and optional arguments --
+array(%d) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+}
+
+-- with default argument --
+int(%d)
+Done
diff --git a/ext/standard/tests/array/array_rand_basic2.phpt b/ext/standard/tests/array/array_rand_basic2.phpt
new file mode 100644
index 000000000..154fcb55a
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_basic2.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test array_rand() function : basic functionality - with associative array for 'input' argument
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Test array_rand() when associative array is passed to 'input' argument
+*/
+
+echo "*** Testing array_rand() : with associative array ***\n";
+
+
+// Initialise the 'input' and 'num_req' variables
+$input = array(
+ 'one' => 1, 'two' => 2, 'three' => 3,
+ 'FoUr' => 'four', '#5' => 5, 'SIX' => 'six',
+ "seven" => 7, "#8" => "eight", "nine" => "NINE"
+);
+
+$num_req = 6;
+
+// Calling array_rand() with optional argument
+echo"\n-- with all default and optional arguments --\n";
+var_dump( array_rand($input,$num_req) );
+
+// Calling array_rand() with default arguments
+echo"\n-- with default argument --\n";
+var_dump( array_rand($input) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : with associative array ***
+
+-- with all default and optional arguments --
+array(6) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+ [3]=>
+ string(%d) "%s"
+ [4]=>
+ string(%d) "%s"
+ [5]=>
+ string(%d) "%s"
+}
+
+-- with default argument --
+string(%d) "%s"
+Done
diff --git a/ext/standard/tests/array/array_rand_error.phpt b/ext/standard/tests/array/array_rand_error.phpt
new file mode 100644
index 000000000..bdbbfdb01
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test array_rand() function : error conditions
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array input [, int num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_rand() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_rand() function with Zero arguments --\n";
+var_dump( array_rand() );
+
+//Test array_rand with one more than the expected number of arguments
+echo "\n-- Testing array_rand() function with more than expected no. of arguments --\n";
+$input = array(1, 2);
+$num_req = 10;
+$extra_arg = 10;
+var_dump( array_rand($input,$num_req, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : error conditions ***
+
+-- Testing array_rand() function with Zero arguments --
+
+Warning: Wrong parameter count for array_rand() in %s on line %d
+NULL
+
+-- Testing array_rand() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_rand() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_rand_variation1.phpt b/ext/standard/tests/array/array_rand_variation1.phpt
new file mode 100644
index 000000000..3b1561076
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_variation1.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test array_rand() function : usage variations - unexpected values for 'input' parameter
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array input [, int num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test array_rand() with different types of values other than arrays passed to the 'input' parameter
+* to see that function works with unexpeced data and generates warning message as required.
+*/
+
+echo "*** Testing array_rand() : unexpected values for 'input' parameter ***\n";
+
+// Initialise function arguments
+$num_req = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "object";
+ }
+}
+
+//array of different values for 'input' parameter
+$values = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new test(),
+
+ // resource data
+/*21*/ $fp,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+);
+
+/* loop through each element of the array to test array_rand() function
+ * for different values for 'input' argument
+*/
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_rand($value,$num_req) );
+ $count++;
+};
+
+// closing the resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : unexpected values for 'input' parameter ***
+
+-- Iteration 1 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: array_rand(): First argument has to be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_rand_variation2.phpt b/ext/standard/tests/array/array_rand_variation2.phpt
new file mode 100644
index 000000000..e97a7186f
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_variation2.phpt
@@ -0,0 +1,214 @@
+--TEST--
+Test array_rand() function : usage variations - unexpected values for 'num_req' parameter
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array input [, int num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test array_rand() with different types of values other than int passed to 'num_req' argument
+* to see that function works with unexpeced data and generates warning message as required.
+*/
+
+echo "*** Testing array_rand() : unexpected values for 'num_req' parameter ***\n";
+
+// Initialise function arguments
+$input = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "3object";
+ }
+}
+
+//array of values to iterate over
+$values = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new test(),
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+);
+
+
+// loop through each element of the array for different values for 'num_req' argument
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( array_rand($input,$value) );
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : unexpected values for 'num_req' parameter ***
+
+-- Iteration 1 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 2 --
+int(%d)
+
+-- Iteration 3 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 4 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 5 --
+array(10) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+ [9]=>
+ int(%d)
+}
+
+-- Iteration 6 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 12 --
+int(%d)
+
+-- Iteration 13 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 14 --
+int(%d)
+
+-- Iteration 15 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 16 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Notice: Object of class test could not be converted to int in %s on line %d
+int(%d)
+
+-- Iteration 21 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_rand_variation3.phpt b/ext/standard/tests/array/array_rand_variation3.phpt
new file mode 100644
index 000000000..62ab6b8db
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_variation3.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test array_rand() function : usage variation - with MultiDimensional array
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() function when multi-dimensional array
+* is passed to 'input' argument
+*/
+
+echo "*** Testing array_rand() : with multi-dimensional array ***\n";
+
+// initialise the multi-dimensional array
+$input = array(
+ // array with int values
+/*1*/ array(1, 2, 0, -0, -1, -2),
+
+ // array with float values
+ array(1.23, -1.23, 0.34, -0.34, 0e2, 2e-3, -2e2, -40e-2),
+
+ // array with single quoted strings
+/*3*/ array('one', '123numbers', 'hello\tworld', 'hello world\0', '12.34floatnum'),
+
+ // array with double quoted strings
+ array("one","123numbers", "hello\tworld", "hello world\0", "12.34floatnum"),
+
+ // array with bool values
+/*5*/ array(true, TRUE, FALSE, false, TrUe, FaLsE),
+
+ // array with hexa values
+ array(0x123, -0x123, 0xabc, 0xABC, 0xab),
+
+ // array with null values
+/*7*/ array(null, NULL, "\0", Null, NuLl)
+
+);
+
+// initialise 'num_req' variable
+$num_req = 3;
+
+// calling array_rand() function with multi-dimensional array
+var_dump( array_rand($input, $num_req) );
+
+// looping to test array_rand() with each sub-array in the multi-dimensional array
+echo "\n*** Testing array_rand() with arrays having different types of values ***\n";
+$counter = 1;
+foreach($input as $arr) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( array_rand($arr) ); // with default arguments
+ var_dump( array_rand($arr, 3) ); // with default as well as optional arguments
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : with multi-dimensional array ***
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+*** Testing array_rand() with arrays having different types of values ***
+
+-- Iteration 1 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 2 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 3 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 4 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 5 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 6 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 7 --
+int(%d)
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+Done
diff --git a/ext/standard/tests/array/array_rand_variation4.phpt b/ext/standard/tests/array/array_rand_variation4.phpt
new file mode 100644
index 000000000..9eb7edcd5
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_variation4.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test array_rand() function : usage variation - with associative arrays for 'input' parameter
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() function when associative array is passed to
+* the 'input' parameter in the function call
+*/
+
+echo "*** Testing array_rand() : with associative arrays ***\n";
+
+// initialise associative arrays
+$asso_arrays = array(
+
+ // array with numeric keys
+/*1*/ array(1 => 'one', 2 => 2, 1234567890 => 'big', -1 => 'negative key',
+ 2.3 => 'float key', 0 => "zero key", 0.2 => 'decimal key',
+ 2e2 => 'exp key1', -2e3 => 'negative exp key'),
+
+ // array with string keys
+ array('one' => 1, "two" => 2.0, "three" => 'three',
+ '12twelve' => 12.00, "" => 'empty string', " " => "space key"),
+
+ // array with hexa values as keys
+/*3*/ array(0xabc => 2748, 0x12f => '303', 0xff => "255", -0xff => "-255"),
+
+ // array with octal values as keys
+ array(0123 => 83, 0129 => 10, 010 => "8", -0348 => "-28", 0012 => '10'),
+
+ // array with bool values as keys
+ array(TRUE => '1', true => true, TrUe => "TRUE",
+ FALSE => '0', false => false, FaLsE => "FALSE"),
+
+ // array with special chars as keys
+/*6*/ array('##' => "key1", '&$r' => 'key2', '!' => "key3", '<>' =>'key4',
+ "NULL" => 'key5', "\n" => 'newline as key',
+ "\t" => "tab as key", "'" => 'single quote as key',
+ '"' => 'double quote as key', "\0" => "null char as key")
+);
+
+/* looping to test array_rand() function with different arrays having
+ * different types of keys
+*/
+$counter = 1;
+foreach($asso_arrays as $input) {
+ echo "\n-- Iteration $counter --\n";
+
+ // with default argument
+ echo"\nWith default argument\n";
+ var_dump( array_rand($input) );
+
+ // with default and optional arguments
+ echo"\nWith num_req = 1\n";
+ var_dump( array_rand($input, 1) ); // with $num_req=1
+ echo"\nWith num_req = 2\n";
+ var_dump( array_rand($input, 2) ); // with $num_req=2
+
+ $counter++;
+} // end of for loop
+
+
+echo "Done";
+?>
+--EXPECTREGEX--
+\*\*\* Testing array_rand\(\) : with associative arrays \*\*\*
+
+-- Iteration 1 --
+
+With default argument
+int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\)
+
+With num_req = 1
+int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\)
+
+With num_req = 2
+array\(2\) {
+ \[0\]=>
+ int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\)
+ \[1\]=>
+ int\([012-][12.e]*[23e]*[34]*[5]*[6]*[7]*[8]*[9]*[0]*\)
+}
+
+-- Iteration 2 --
+
+With default argument
+string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*"
+
+With num_req = 1
+string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*"
+
+With num_req = 2
+array\(2\) {
+ \[0\]=>
+ string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*"
+ \[1\]=>
+ string\([0-9]*\) "[ot1 ]*[hnw2]*[eort]*[ew]*[e]*[l]*[v]*[e]*"
+}
+
+-- Iteration 3 --
+
+With default argument
+int\([23-]*[2570]*[345]*[58]*\)
+
+With num_req = 1
+int\([23-]*[2570]*[345]*[58]*\)
+
+With num_req = 2
+array\(2\) {
+ \[0\]=>
+ int\([23-]*[2570]*[345]*[58]*\)
+ \[1\]=>
+ int\([23-]*[2570]*[345]*[58]*\)
+}
+
+-- Iteration 4 --
+
+With default argument
+int\([18-]*[023]*[8]*\)
+
+With num_req = 1
+int\([18-]*[023]*[8]*\)
+
+With num_req = 2
+array\(2\) {
+ \[0\]=>
+ int\([18-]*[023]*[8]*\)
+ \[1\]=>
+ int\([18-]*[023]*[8]*\)
+}
+
+-- Iteration 5 --
+
+With default argument
+int\([01]\)
+
+With num_req = 1
+int\([01]\)
+
+With num_req = 2
+array\(2\) {
+ \[0\]=>
+ int\([01]\)
+ \[1\]=>
+ int\([01]\)
+}
+
+-- Iteration 6 --
+
+With default argument
+string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*"
+
+With num_req = 1
+string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*"
+
+With num_req = 2
+array\(2\) {
+ \[0\]=>
+ string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*"
+ \[1\]=>
+ string\([0-9]*\) "[#&!N <\n\t'"\0]*[U#$>]*[rL]*[L]*"
+}
+Done
diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt
new file mode 100644
index 000000000..e578d8125
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_variation5.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test array_rand() function : usage variation - invalid values for 'req_num' parameter
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() function when associative array and
+* various invalid values are passed to the 'input' and 'req_num'
+* parameters respectively
+*/
+
+echo "*** Testing array_rand() : with invalid values for 'req_num' ***\n";
+
+// initialise associative arrays
+$input = array(
+ 1 => 'one', 2.2 => 'float key', 0.9 => 'decimal key',
+ 2e2 => 'exp key1', 2000e-3 => 'negative exp key',
+ 0xabc => 2748, 0x12f => '303', 0xff => "255",
+ 0123 => 83, 0129 => 10, 010 => "8"
+);
+
+// Testing array_rand() function with various invalid 'req_num' values
+// with valid num_req values
+echo"\n-- With default num_req value --\n";
+var_dump( array_rand($input) ); // with default $num_req value
+echo"\n-- With num_req = 1 --\n";
+var_dump( array_rand($input, 1) ); // with valid $num_req value
+
+// with invalid num_req value
+echo"\n-- With num_req = 0 --\n";
+var_dump( array_rand($input, 0) ); // with $num_req=0
+echo"\n-- With num_req = -1 --\n";
+var_dump( array_rand($input, -1) ); // with $num_req=-1
+echo"\n-- With num_req = -2 --\n";
+var_dump( array_rand($input, -2) ); // with $num_req=-2
+echo"\n-- With num_req more than number of members in 'input' array --\n";
+var_dump( array_rand($input, 13) ); // with $num_req=13
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_rand() : with invalid values for 'req_num' ***
+
+-- With default num_req value --
+int(%d)
+
+-- With num_req = 1 --
+int(%d)
+
+-- With num_req = 0 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- With num_req = -1 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- With num_req = -2 --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+
+-- With num_req more than number of members in 'input' array --
+
+Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_rand_variation6.phpt b/ext/standard/tests/array/array_rand_variation6.phpt
new file mode 100644
index 000000000..887a18d4a
--- /dev/null
+++ b/ext/standard/tests/array/array_rand_variation6.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test array_rand() function : usage variation - with heredoc string as key in the 'input' array
+--FILE--
+<?php
+/* Prototype : mixed array_rand(array $input [, int $num_req])
+ * Description: Return key/keys for random entry/entries in the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of array_rand() when keys of the 'input' array is heredoc string
+*/
+
+echo "*** Testing array_rand() : with keys of input array as heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$input = array(
+ $empty_heredoc => "heredoc1",
+ $heredoc_with_newline => "heredoc2",
+ $heredoc_with_characters => "heredoc3",
+ $heredoc_with_newline_and_tabs => "heredoc3",
+ $heredoc_with_alphanumerics => "heredoc4",
+ $heredoc_with_embedded_nulls => "heredoc5"
+);
+
+// Test array_rand() function with different valid 'req_num' values
+echo "\n-- with default parameters --\n";
+var_dump( array_rand($input) );
+
+echo "\n-- with num_req = 1 --\n";
+var_dump( array_rand($input, 1) );
+
+echo "\n-- with num_req = 3 --\n";
+var_dump( array_rand($input, 3) );
+
+echo "\n-- with num_req = 6 --\n";
+var_dump( array_rand($input, 6) );
+
+
+echo "Done";
+?>
+--EXPECTREGEX--
+\*\*\* Testing array_rand\(\) : with keys of input array as heredoc strings \*\*\*
+
+-- with default parameters --
+string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+
+-- with num_req = 1 --
+string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+
+-- with num_req = 3 --
+array\(3\) {
+ \[0\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[1\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[2\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+}
+
+-- with num_req = 6 --
+array\(6\) {
+ \[0\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[1\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[2\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[3\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[4\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+ \[5\]=>
+ string\([0-9]*\) "[a-z \n \t \0 0-9 ]*"
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_basic1.phpt b/ext/standard/tests/array/array_reverse_basic1.phpt
new file mode 100644
index 000000000..f41e0a3f4
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_basic1.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test array_reverse() function : basic functionality - simple array for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_reverse() by giving a simple array for $array argument
+*/
+
+echo "*** Testing array_reverse() : basic functionality ***\n";
+
+// Initialise the array
+$array = array("a", "green", "red", 'blue', 10, 13.33);
+
+// Calling array_reverse() with default arguments
+var_dump( array_reverse($array) );
+
+// Calling array_reverse() with all possible arguments
+var_dump( array_reverse($array, true) ); // expects the keys to be preserved
+var_dump( array_reverse($array, false) ); // expects the keys not to be preserved
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : basic functionality ***
+array(6) {
+ [0]=>
+ float(13.33)
+ [1]=>
+ int(10)
+ [2]=>
+ string(4) "blue"
+ [3]=>
+ string(3) "red"
+ [4]=>
+ string(5) "green"
+ [5]=>
+ string(1) "a"
+}
+array(6) {
+ [5]=>
+ float(13.33)
+ [4]=>
+ int(10)
+ [3]=>
+ string(4) "blue"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+ [0]=>
+ string(1) "a"
+}
+array(6) {
+ [0]=>
+ float(13.33)
+ [1]=>
+ int(10)
+ [2]=>
+ string(4) "blue"
+ [3]=>
+ string(3) "red"
+ [4]=>
+ string(5) "green"
+ [5]=>
+ string(1) "a"
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_basic2.phpt b/ext/standard/tests/array/array_reverse_basic2.phpt
new file mode 100644
index 000000000..9f41f0b48
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_basic2.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test array_reverse() function : basic functionality - associative array for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_reverse() with associative array for $array argument
+*/
+
+echo "*** Testing array_reverse() : basic functionality ***\n";
+
+// Initialise the array
+$array = array("a" => "hello", 123 => "number", 'string' => 'blue', "10" => 13.33);
+
+// Calling array_reverse() with default arguments
+var_dump( array_reverse($array) );
+
+// Calling array_reverse() with all possible arguments
+var_dump( array_reverse($array, true) ); // expects the keys to be preserved
+var_dump( array_reverse($array, false) ); // expects the keys not to be preserved
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : basic functionality ***
+array(4) {
+ [0]=>
+ float(13.33)
+ ["string"]=>
+ string(4) "blue"
+ [1]=>
+ string(6) "number"
+ ["a"]=>
+ string(5) "hello"
+}
+array(4) {
+ [10]=>
+ float(13.33)
+ ["string"]=>
+ string(4) "blue"
+ [123]=>
+ string(6) "number"
+ ["a"]=>
+ string(5) "hello"
+}
+array(4) {
+ [0]=>
+ float(13.33)
+ ["string"]=>
+ string(4) "blue"
+ [1]=>
+ string(6) "number"
+ ["a"]=>
+ string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_error.phpt b/ext/standard/tests/array/array_reverse_error.phpt
new file mode 100644
index 000000000..8ec42bfa8
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test array_reverse() function : error conditions
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_reverse() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing array_reverse() function with Zero arguments --\n";
+var_dump( array_reverse() );
+
+// more than the expected number of arguments
+echo "\n-- Testing array_diff() function with more than expected no. of arguments --\n";
+$array = array(1, 2, 3, 4, 5, 6);
+$extra_arg = 10;
+var_dump( array_reverse($array, true, $extra_arg) );
+var_dump( array_reverse($array, false, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : error conditions ***
+
+-- Testing array_reverse() function with Zero arguments --
+
+Warning: Wrong parameter count for array_reverse() in %s on line %d
+NULL
+
+-- Testing array_diff() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for array_reverse() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_reverse() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation1.phpt b/ext/standard/tests/array/array_reverse_variation1.phpt
new file mode 100644
index 000000000..ea0c22222
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_variation1.phpt
@@ -0,0 +1,340 @@
+--TEST--
+Test array_reverse() function : usage variations - unexpected values for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_reverse() : usage variations - unexpected values for 'array' argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//get a heredoc string
+$heredoc_string = <<<EOT
+Hello world\t\n
+EOT;
+
+//array of values to iterate over
+$arrays = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+ 'Hello world',
+ "Hello world",
+ $heredoc_string,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+
+);
+
+// loop through each element of the array $arrays to check the behavior of array_reverse()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "\n-- Iteration $iterator --";
+ // with default argument
+ var_dump( array_reverse($array) );
+ // with all possible arguments
+ var_dump( array_reverse($array, true) );
+ var_dump( array_reverse($array, false) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : usage variations - unexpected values for 'array' argument ***
+
+-- Iteration 1 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 2 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 3 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 4 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 5 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 6 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 7 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 8 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 9 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 10 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 11 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 12 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 13 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 14 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 15 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 16 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 17 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 18 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 19 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 20 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 21 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 22 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 23 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+-- Iteration 24 --
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_reverse(): The argument should be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation2.phpt b/ext/standard/tests/array/array_reverse_variation2.phpt
new file mode 100644
index 000000000..1f036a3e8
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_variation2.phpt
@@ -0,0 +1,491 @@
+--TEST--
+Test array_reverse() function : usage variations - unexpected values for 'preserve_keys' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing the functionality of array_reverse() by giving unexpected values for $preserve_keys argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+// Initialise the array
+$array = array("a" => "green", "red", "blue", "red", "orange", "pink");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//array of values to iterate over
+$preserve_keys = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/
+ "",
+ '',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+
+);
+
+// loop through each element of the array $preserve_keys to check the behavior of array_reverse()
+$iterator = 1;
+foreach($preserve_keys as $preserve_key) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( array_reverse($array, $preserve_key) );
+ $iterator++;
+};
+
+// close the file resouce used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : usage variations ***
+-- Iteration 1 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 2 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 3 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 4 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 5 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 6 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 7 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 8 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 9 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 10 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 11 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 12 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 13 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 14 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 15 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 16 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 17 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 18 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 19 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 20 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 21 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 22 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 23 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 24 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 25 --
+array(6) {
+ [0]=>
+ string(4) "pink"
+ [1]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [3]=>
+ string(4) "blue"
+ [4]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+-- Iteration 26 --
+array(6) {
+ [4]=>
+ string(4) "pink"
+ [3]=>
+ string(6) "orange"
+ [2]=>
+ string(3) "red"
+ [1]=>
+ string(4) "blue"
+ [0]=>
+ string(3) "red"
+ ["a"]=>
+ string(5) "green"
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation3.phpt b/ext/standard/tests/array/array_reverse_variation3.phpt
new file mode 100644
index 000000000..10298428f
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_variation3.phpt
@@ -0,0 +1,602 @@
+--TEST--
+Test array_reverse() function : usage variations - different array values for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_reverse() by giving
+ * different array values for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 2.2), // array with default keys & float values
+ array( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+/*8*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through the various elements of $arrays to test array_reverse()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ // with default argument
+ echo "- with default argument -\n";
+ var_dump( array_reverse($array) );
+ // with all possible arguments
+ echo "- with \$preserve keys = true -\n";
+ var_dump( array_reverse($array, true) );
+ echo "- with \$preserve_keys = false -\n";
+ var_dump( array_reverse($array, false) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : usage variations ***
+-- Iteration 1 --
+- with default argument -
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(1)
+}
+- with $preserve keys = true -
+array(2) {
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+- with $preserve_keys = false -
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(1)
+}
+-- Iteration 2 --
+- with default argument -
+array(2) {
+ [0]=>
+ float(2.2)
+ [1]=>
+ float(1.1)
+}
+- with $preserve keys = true -
+array(2) {
+ [1]=>
+ float(2.2)
+ [0]=>
+ float(1.1)
+}
+- with $preserve_keys = false -
+array(2) {
+ [0]=>
+ float(2.2)
+ [1]=>
+ float(1.1)
+}
+-- Iteration 3 --
+- with default argument -
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+- with $preserve keys = true -
+array(2) {
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [0]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+- with $preserve_keys = false -
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+}
+-- Iteration 4 --
+- with default argument -
+array(2) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+}
+- with $preserve keys = true -
+array(2) {
+ [1]=>
+ bool(true)
+ [0]=>
+ bool(false)
+}
+- with $preserve_keys = false -
+array(2) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+}
+-- Iteration 5 --
+- with default argument -
+array(0) {
+}
+- with $preserve keys = true -
+array(0) {
+}
+- with $preserve_keys = false -
+array(0) {
+}
+-- Iteration 6 --
+- with default argument -
+array(1) {
+ [0]=>
+ NULL
+}
+- with $preserve keys = true -
+array(1) {
+ [0]=>
+ NULL
+}
+- with $preserve_keys = false -
+array(1) {
+ [0]=>
+ NULL
+}
+-- Iteration 7 --
+- with default argument -
+array(6) {
+ [0]=>
+ string(5) "ccccc"
+ [1]=>
+ string(1) "c"
+ [2]=>
+ string(4) "bbbb"
+ [3]=>
+ string(1) "b"
+ [4]=>
+ string(4) "aaaa"
+ [5]=>
+ string(1) "a"
+}
+- with $preserve keys = true -
+array(6) {
+ [5]=>
+ string(5) "ccccc"
+ [4]=>
+ string(1) "c"
+ [3]=>
+ string(4) "bbbb"
+ [2]=>
+ string(1) "b"
+ [1]=>
+ string(4) "aaaa"
+ [0]=>
+ string(1) "a"
+}
+- with $preserve_keys = false -
+array(6) {
+ [0]=>
+ string(5) "ccccc"
+ [1]=>
+ string(1) "c"
+ [2]=>
+ string(4) "bbbb"
+ [3]=>
+ string(1) "b"
+ [4]=>
+ string(4) "aaaa"
+ [5]=>
+ string(1) "a"
+}
+-- Iteration 8 --
+- with default argument -
+array(3) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+}
+- with $preserve keys = true -
+array(3) {
+ [3]=>
+ string(5) "three"
+ [2]=>
+ string(3) "two"
+ [1]=>
+ string(3) "one"
+}
+- with $preserve_keys = false -
+array(3) {
+ [0]=>
+ string(5) "three"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(3) "one"
+}
+-- Iteration 9 --
+- with default argument -
+array(3) {
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(1)
+}
+- with $preserve keys = true -
+array(3) {
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(1)
+}
+- with $preserve_keys = false -
+array(3) {
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(1)
+}
+-- Iteration 10 --
+- with default argument -
+array(4) {
+ [0]=>
+ int(30)
+ [1]=>
+ int(40)
+ [2]=>
+ int(20)
+ [3]=>
+ int(10)
+}
+- with $preserve keys = true -
+array(4) {
+ [3]=>
+ int(30)
+ [4]=>
+ int(40)
+ [2]=>
+ int(20)
+ [1]=>
+ int(10)
+}
+- with $preserve_keys = false -
+array(4) {
+ [0]=>
+ int(30)
+ [1]=>
+ int(40)
+ [2]=>
+ int(20)
+ [3]=>
+ int(10)
+}
+-- Iteration 11 --
+- with default argument -
+array(3) {
+ ["three"]=>
+ string(6) "thirty"
+ ["two"]=>
+ string(6) "twenty"
+ ["one"]=>
+ string(3) "ten"
+}
+- with $preserve keys = true -
+array(3) {
+ ["three"]=>
+ string(6) "thirty"
+ ["two"]=>
+ string(6) "twenty"
+ ["one"]=>
+ string(3) "ten"
+}
+- with $preserve_keys = false -
+array(3) {
+ ["three"]=>
+ string(6) "thirty"
+ ["two"]=>
+ string(6) "twenty"
+ ["one"]=>
+ string(3) "ten"
+}
+-- Iteration 12 --
+- with default argument -
+array(3) {
+ [0]=>
+ string(4) "four"
+ [1]=>
+ string(3) "two"
+ ["one"]=>
+ int(1)
+}
+- with $preserve keys = true -
+array(3) {
+ [4]=>
+ string(4) "four"
+ [2]=>
+ string(3) "two"
+ ["one"]=>
+ int(1)
+}
+- with $preserve_keys = false -
+array(3) {
+ [0]=>
+ string(4) "four"
+ [1]=>
+ string(3) "two"
+ ["one"]=>
+ int(1)
+}
+-- Iteration 13 --
+- with default argument -
+array(3) {
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [""]=>
+ string(4) "null"
+}
+- with $preserve keys = true -
+array(3) {
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [""]=>
+ string(4) "null"
+}
+- with $preserve_keys = false -
+array(3) {
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [""]=>
+ string(4) "null"
+}
+-- Iteration 14 --
+- with default argument -
+array(4) {
+ ["true"]=>
+ bool(true)
+ ["false"]=>
+ bool(false)
+ [0]=>
+ string(5) "false"
+ [1]=>
+ string(4) "true"
+}
+- with $preserve keys = true -
+array(4) {
+ ["true"]=>
+ bool(true)
+ ["false"]=>
+ bool(false)
+ [0]=>
+ string(5) "false"
+ [1]=>
+ string(4) "true"
+}
+- with $preserve_keys = false -
+array(4) {
+ ["true"]=>
+ bool(true)
+ ["false"]=>
+ bool(false)
+ [0]=>
+ string(5) "false"
+ [1]=>
+ string(4) "true"
+}
+-- Iteration 15 --
+- with default argument -
+array(3) {
+ ["emptys"]=>
+ string(0) ""
+ ["emptyd"]=>
+ string(0) ""
+ [""]=>
+ string(6) "emptys"
+}
+- with $preserve keys = true -
+array(3) {
+ ["emptys"]=>
+ string(0) ""
+ ["emptyd"]=>
+ string(0) ""
+ [""]=>
+ string(6) "emptys"
+}
+- with $preserve_keys = false -
+array(3) {
+ ["emptys"]=>
+ string(0) ""
+ ["emptyd"]=>
+ string(0) ""
+ [""]=>
+ string(6) "emptys"
+}
+-- Iteration 16 --
+- with default argument -
+array(6) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+}
+- with $preserve keys = true -
+array(6) {
+ [6]=>
+ bool(true)
+ [5]=>
+ bool(false)
+ [4]=>
+ NULL
+ [3]=>
+ NULL
+ [2]=>
+ string(0) ""
+ [1]=>
+ string(0) ""
+}
+- with $preserve_keys = false -
+array(6) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ string(0) ""
+ [5]=>
+ string(0) ""
+}
+-- Iteration 17 --
+- with default argument -
+array(3) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(5)
+ [""]=>
+ int(4)
+}
+- with $preserve keys = true -
+array(3) {
+ [1]=>
+ int(6)
+ [0]=>
+ int(5)
+ [""]=>
+ int(4)
+}
+- with $preserve_keys = false -
+array(3) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(5)
+ [""]=>
+ int(4)
+}
+-- Iteration 18 --
+- with default argument -
+array(3) {
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(20)
+ ["One"]=>
+ int(10)
+}
+- with $preserve keys = true -
+array(3) {
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(20)
+ ["One"]=>
+ int(10)
+}
+- with $preserve_keys = false -
+array(3) {
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(20)
+ ["One"]=>
+ int(10)
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt
new file mode 100644
index 000000000..e3f0254f5
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_variation4.phpt
@@ -0,0 +1,377 @@
+--TEST--
+Test array_reverse() function : usage variations - assoc. array with diff. keys for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_reverse() by giving associative arrays with different
+ * keys for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing the array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"),
+
+ // arrays with string keys
+ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33),
+/*8*/ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed values
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// loop through the various elements of $arrays to test array_reverse()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ // with default argument
+ echo "- default argument -\n";
+ var_dump( array_reverse($array) );
+ // with $preserve_keys argument
+ echo "- \$preserve keys = true -\n";
+ var_dump( array_reverse($array, true) );
+ echo "- \$preserve_keys = false -\n";
+ var_dump( array_reverse($array, false) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : usage variations ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+- default argument -
+array(0) {
+}
+- $preserve keys = true -
+array(0) {
+}
+- $preserve_keys = false -
+array(0) {
+}
+-- Iteration 2 --
+- default argument -
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+- $preserve keys = true -
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+- $preserve_keys = false -
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 3 --
+- default argument -
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+- $preserve keys = true -
+array(1) {
+ [1]=>
+ string(1) "1"
+}
+- $preserve_keys = false -
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 4 --
+- default argument -
+array(4) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(1) "3"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(1) "1"
+}
+- $preserve keys = true -
+array(4) {
+ [4]=>
+ string(1) "4"
+ [3]=>
+ string(1) "3"
+ [2]=>
+ string(1) "2"
+ [1]=>
+ string(1) "1"
+}
+- $preserve_keys = false -
+array(4) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(1) "3"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(1) "1"
+}
+-- Iteration 5 --
+- default argument -
+array(1) {
+ [0]=>
+ string(5) "float"
+}
+- $preserve keys = true -
+array(1) {
+ [2]=>
+ string(5) "float"
+}
+- $preserve_keys = false -
+array(1) {
+ [0]=>
+ string(5) "float"
+}
+-- Iteration 6 --
+- default argument -
+array(4) {
+ [0]=>
+ string(2) "f4"
+ [1]=>
+ string(2) "f3"
+ [2]=>
+ string(2) "f2"
+ [3]=>
+ string(2) "f1"
+}
+- $preserve keys = true -
+array(4) {
+ [33333333]=>
+ string(2) "f4"
+ [4]=>
+ string(2) "f3"
+ [3]=>
+ string(2) "f2"
+ [1]=>
+ string(2) "f1"
+}
+- $preserve_keys = false -
+array(4) {
+ [0]=>
+ string(2) "f4"
+ [1]=>
+ string(2) "f3"
+ [2]=>
+ string(2) "f2"
+ [3]=>
+ string(2) "f1"
+}
+-- Iteration 7 --
+- default argument -
+array(4) {
+ ["pen
+"]=>
+ int(33)
+ [" world"]=>
+ float(2.2)
+ ["re d"]=>
+ string(5) "color"
+ [" Hello"]=>
+ int(111)
+}
+- $preserve keys = true -
+array(4) {
+ ["pen
+"]=>
+ int(33)
+ [" world"]=>
+ float(2.2)
+ ["re d"]=>
+ string(5) "color"
+ [" Hello"]=>
+ int(111)
+}
+- $preserve_keys = false -
+array(4) {
+ ["pen
+"]=>
+ int(33)
+ [" world"]=>
+ float(2.2)
+ ["re d"]=>
+ string(5) "color"
+ [" Hello"]=>
+ int(111)
+}
+-- Iteration 8 --
+- default argument -
+array(4) {
+ ["pen
+"]=>
+ int(33)
+ [" world"]=>
+ float(2.2)
+ ["re d"]=>
+ string(5) "color"
+ [" Hello"]=>
+ int(111)
+}
+- $preserve keys = true -
+array(4) {
+ ["pen
+"]=>
+ int(33)
+ [" world"]=>
+ float(2.2)
+ ["re d"]=>
+ string(5) "color"
+ [" Hello"]=>
+ int(111)
+}
+- $preserve_keys = false -
+array(4) {
+ ["pen
+"]=>
+ int(33)
+ [" world"]=>
+ float(2.2)
+ ["re d"]=>
+ string(5) "color"
+ [" Hello"]=>
+ int(111)
+}
+-- Iteration 9 --
+- default argument -
+array(2) {
+ ["Hello world"]=>
+ string(6) "string"
+ [0]=>
+ string(5) "hello"
+}
+- $preserve keys = true -
+array(2) {
+ ["Hello world"]=>
+ string(6) "string"
+ [0]=>
+ string(5) "hello"
+}
+- $preserve_keys = false -
+array(2) {
+ ["Hello world"]=>
+ string(6) "string"
+ [0]=>
+ string(5) "hello"
+}
+-- Iteration 10 --
+- default argument -
+array(1) {
+ [""]=>
+ string(5) "hello"
+}
+- $preserve keys = true -
+array(1) {
+ [""]=>
+ string(5) "hello"
+}
+- $preserve_keys = false -
+array(1) {
+ [""]=>
+ string(5) "hello"
+}
+-- Iteration 11 --
+- default argument -
+array(6) {
+ ["Hello world"]=>
+ string(7) "heredoc"
+ [""]=>
+ string(5) "unset"
+ [0]=>
+ string(5) "float"
+ [1]=>
+ string(3) "int"
+ ["fruit"]=>
+ float(2.2)
+ ["hello"]=>
+ int(1)
+}
+- $preserve keys = true -
+array(6) {
+ ["Hello world"]=>
+ string(7) "heredoc"
+ [""]=>
+ string(5) "unset"
+ [444]=>
+ string(5) "float"
+ [133]=>
+ string(3) "int"
+ ["fruit"]=>
+ float(2.2)
+ ["hello"]=>
+ int(1)
+}
+- $preserve_keys = false -
+array(6) {
+ ["Hello world"]=>
+ string(7) "heredoc"
+ [""]=>
+ string(5) "unset"
+ [0]=>
+ string(5) "float"
+ [1]=>
+ string(3) "int"
+ ["fruit"]=>
+ float(2.2)
+ ["hello"]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation5.phpt b/ext/standard/tests/array/array_reverse_variation5.phpt
new file mode 100644
index 000000000..2d22be035
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_variation5.phpt
@@ -0,0 +1,397 @@
+--TEST--
+Test array_reverse() function : usage variations - assoc. array with diff. value for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_reverse() by giving associative arrays with different
+ * values for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing the array
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333),
+
+ // arrays with string values
+ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", 'resource' => $fp, "int" => 133, "float" => 444.432, "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// loop through the various elements of $arrays to test array_reverse()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+ // with default argument
+ echo "- default argument -\n";
+ var_dump( array_reverse($array) );
+ // with $preserve_keys argument
+ echo "- \$preserve keys = true -\n";
+ var_dump( array_reverse($array, true) );
+ echo "- \$preserve_keys = false -\n";
+ var_dump( array_reverse($array, false) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : usage variations ***
+-- Iteration 1 --
+- default argument -
+array(0) {
+}
+- $preserve keys = true -
+array(0) {
+}
+- $preserve_keys = false -
+array(0) {
+}
+-- Iteration 2 --
+- default argument -
+array(1) {
+ [0]=>
+ int(0)
+}
+- $preserve keys = true -
+array(1) {
+ [0]=>
+ int(0)
+}
+- $preserve_keys = false -
+array(1) {
+ [0]=>
+ int(0)
+}
+-- Iteration 3 --
+- default argument -
+array(1) {
+ [0]=>
+ int(1)
+}
+- $preserve keys = true -
+array(1) {
+ [1]=>
+ int(1)
+}
+- $preserve_keys = false -
+array(1) {
+ [0]=>
+ int(1)
+}
+-- Iteration 4 --
+- default argument -
+array(4) {
+ [0]=>
+ int(4)
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(1)
+}
+- $preserve keys = true -
+array(4) {
+ [4]=>
+ int(4)
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(1)
+}
+- $preserve_keys = false -
+array(4) {
+ [0]=>
+ int(4)
+ ["three"]=>
+ int(3)
+ ["two"]=>
+ int(2)
+ ["one"]=>
+ int(1)
+}
+-- Iteration 5 --
+- default argument -
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+- $preserve keys = true -
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+- $preserve_keys = false -
+array(1) {
+ ["float"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+- default argument -
+array(4) {
+ ["f4"]=>
+ float(33333333.333333)
+ [0]=>
+ float(4.8999992284)
+ ["f2"]=>
+ float(3.33)
+ ["f1"]=>
+ float(1.2)
+}
+- $preserve keys = true -
+array(4) {
+ ["f4"]=>
+ float(33333333.333333)
+ [3]=>
+ float(4.8999992284)
+ ["f2"]=>
+ float(3.33)
+ ["f1"]=>
+ float(1.2)
+}
+- $preserve_keys = false -
+array(4) {
+ ["f4"]=>
+ float(33333333.333333)
+ [0]=>
+ float(4.8999992284)
+ ["f2"]=>
+ float(3.33)
+ ["f1"]=>
+ float(1.2)
+}
+-- Iteration 7 --
+- default argument -
+array(4) {
+ [0]=>
+ string(4) "pen
+"
+ [1]=>
+ string(7) " world"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(6) " Hello"
+}
+- $preserve keys = true -
+array(4) {
+ [3]=>
+ string(4) "pen
+"
+ [2]=>
+ string(7) " world"
+ ["red"]=>
+ string(6) "col or"
+ [111]=>
+ string(6) " Hello"
+}
+- $preserve_keys = false -
+array(4) {
+ [0]=>
+ string(4) "pen
+"
+ [1]=>
+ string(7) " world"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(6) " Hello"
+}
+-- Iteration 8 --
+- default argument -
+array(4) {
+ [0]=>
+ string(5) "pen\n"
+ [1]=>
+ string(9) "\v\fworld"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(7) "\tHello"
+}
+- $preserve keys = true -
+array(4) {
+ [3]=>
+ string(5) "pen\n"
+ [2]=>
+ string(9) "\v\fworld"
+ ["red"]=>
+ string(7) "col\tor"
+ [111]=>
+ string(7) "\tHello"
+}
+- $preserve_keys = false -
+array(4) {
+ [0]=>
+ string(5) "pen\n"
+ [1]=>
+ string(9) "\v\fworld"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(7) "\tHello"
+}
+-- Iteration 9 --
+- default argument -
+array(2) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ [0]=>
+ string(5) "hello"
+}
+- $preserve keys = true -
+array(2) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ [1]=>
+ string(5) "hello"
+}
+- $preserve_keys = false -
+array(2) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ [0]=>
+ string(5) "hello"
+}
+-- Iteration 10 --
+- default argument -
+array(3) {
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["unset"]=>
+ NULL
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+- $preserve keys = true -
+array(3) {
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["unset"]=>
+ NULL
+ [11]=>
+ object(classA)#%d (0) {
+ }
+}
+- $preserve_keys = false -
+array(3) {
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["unset"]=>
+ NULL
+ [0]=>
+ object(classA)#%d (0) {
+ }
+}
+-- Iteration 11 --
+- default argument -
+array(8) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ ["unset"]=>
+ NULL
+ ["float"]=>
+ float(444.432)
+ ["int"]=>
+ int(133)
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [0]=>
+ string(5) "fruit"
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ string(5) "hello"
+}
+- $preserve keys = true -
+array(8) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ ["unset"]=>
+ NULL
+ ["float"]=>
+ float(444.432)
+ ["int"]=>
+ int(133)
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [222]=>
+ string(5) "fruit"
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [1]=>
+ string(5) "hello"
+}
+- $preserve_keys = false -
+array(8) {
+ ["heredoc"]=>
+ string(11) "Hello world"
+ ["unset"]=>
+ NULL
+ ["float"]=>
+ float(444.432)
+ ["int"]=>
+ int(133)
+ ["resource"]=>
+ resource(%d) of type (stream)
+ [0]=>
+ string(5) "fruit"
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ [2]=>
+ string(5) "hello"
+}
+Done
diff --git a/ext/standard/tests/array/array_reverse_variation6.phpt b/ext/standard/tests/array/array_reverse_variation6.phpt
new file mode 100644
index 000000000..ae1e195ca
--- /dev/null
+++ b/ext/standard/tests/array/array_reverse_variation6.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Test array_reverse() function : usage variations - two dimensional arrays for 'array' argument
+--FILE--
+<?php
+/* Prototype : array array_reverse(array $array [, bool $preserve_keys])
+ * Description: Return input as a new array with the order of the entries reversed
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing the functionality of array_reverse() by giving 2-D arrays for $array argument
+*/
+
+echo "*** Testing array_reverse() : usage variations ***\n";
+
+// Initializing the 2-d arrays
+$two_dimensional_array = array(
+
+ // associative array
+ array('color' => 'red', 'item' => 'pen', 'place' => 'LA'),
+
+ // numeric array
+ array(1, 2, 3, 4, 5),
+
+ // combination of numeric and associative arrays
+ array('a' => 'green', 'red', 'brown', 33, 88, 'orange', 'item' => 'ball')
+);
+
+// calling array_reverse() with various types of 2-d arrays
+// with default arguments
+echo "-- with default argument --\n";
+var_dump( array_reverse($two_dimensional_array) ); // whole array
+var_dump( array_reverse($two_dimensional_array[1]) ); // sub array
+
+// with $preserve_keys argument
+echo "-- with all possible arguments --\n";
+// whole array
+var_dump( array_reverse($two_dimensional_array, true) );
+var_dump( array_reverse($two_dimensional_array, false) );
+// sub array
+var_dump( array_reverse($two_dimensional_array[1], true) );
+var_dump( array_reverse($two_dimensional_array[1], false) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_reverse() : usage variations ***
+-- with default argument --
+array(3) {
+ [0]=>
+ array(7) {
+ ["a"]=>
+ string(5) "green"
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "brown"
+ [2]=>
+ int(33)
+ [3]=>
+ int(88)
+ [4]=>
+ string(6) "orange"
+ ["item"]=>
+ string(4) "ball"
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+ [2]=>
+ array(3) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+ }
+}
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(4)
+ [2]=>
+ int(3)
+ [3]=>
+ int(2)
+ [4]=>
+ int(1)
+}
+-- with all possible arguments --
+array(3) {
+ [2]=>
+ array(7) {
+ ["a"]=>
+ string(5) "green"
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "brown"
+ [2]=>
+ int(33)
+ [3]=>
+ int(88)
+ [4]=>
+ string(6) "orange"
+ ["item"]=>
+ string(4) "ball"
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+ [0]=>
+ array(3) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+ }
+}
+array(3) {
+ [0]=>
+ array(7) {
+ ["a"]=>
+ string(5) "green"
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "brown"
+ [2]=>
+ int(33)
+ [3]=>
+ int(88)
+ [4]=>
+ string(6) "orange"
+ ["item"]=>
+ string(4) "ball"
+ }
+ [1]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+ [2]=>
+ array(3) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+ }
+}
+array(5) {
+ [4]=>
+ int(5)
+ [3]=>
+ int(4)
+ [2]=>
+ int(3)
+ [1]=>
+ int(2)
+ [0]=>
+ int(1)
+}
+array(5) {
+ [0]=>
+ int(5)
+ [1]=>
+ int(4)
+ [2]=>
+ int(3)
+ [3]=>
+ int(2)
+ [4]=>
+ int(1)
+}
+Done
diff --git a/ext/standard/tests/array/array_search_errors.phpt b/ext/standard/tests/array/array_search_errors.phpt
index d02b9bc95..8f13497bb 100644
--- a/ext/standard/tests/array/array_search_errors.phpt
+++ b/ext/standard/tests/array/array_search_errors.phpt
@@ -1,39 +1,44 @@
--TEST--
-Test array_search() and in_array() functions (errors)
+Test array_search() function - error conditions
--FILE--
<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
-echo "\n*** Testing error conditions of in_array() ***\n";
+echo "*** Testing error conditions of array_search() ***\n";
/* zero argument */
-var_dump( in_array() );
+var_dump( array_search() );
-/* unexpected no.of arguments in in_array() */
+/* unexpected no.of arguments in array_search() */
$var = array("mon", "tues", "wed", "thurs");
-var_dump( in_array(1, $var, 0, "test") );
-var_dump( in_array("test") );
+var_dump( array_search(1, $var, 0, "test") );
+var_dump( array_search("test") );
-/* unexpected second argument in in_array() */
+/* unexpected second argument in array_search() */
$var="test";
-var_dump( in_array("test", $var) );
-var_dump( in_array(1, 123) );
+var_dump( array_search("test", $var) );
+var_dump( array_search(1, 123) );
echo "Done\n";
?>
--EXPECTF--
-*** Testing error conditions of in_array() ***
+*** Testing error conditions of array_search() ***
-Warning: Wrong parameter count for in_array() in %s on line %d
+Warning: Wrong parameter count for array_search() in %s on line %d
NULL
-Warning: Wrong parameter count for in_array() in %s on line %d
+Warning: Wrong parameter count for array_search() in %s on line %d
NULL
-Warning: Wrong parameter count for in_array() in %s on line %d
+Warning: Wrong parameter count for array_search() in %s on line %d
NULL
-Warning: in_array(): Wrong datatype for second argument in %s on line %d
+Warning: array_search(): Wrong datatype for second argument in %s on line %d
bool(false)
-Warning: in_array(): Wrong datatype for second argument in %s on line %d
+Warning: array_search(): Wrong datatype for second argument in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/array/array_search_variation1.phpt b/ext/standard/tests/array/array_search_variation1.phpt
index 81c954372..4674d1994 100644
--- a/ext/standard/tests/array/array_search_variation1.phpt
+++ b/ext/standard/tests/array/array_search_variation1.phpt
@@ -1,95 +1,641 @@
--TEST--
-Test array_search() and in_array() functions (variation-1)
+Test array_search() function : usage variations - different needle values
--FILE--
<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test array_search() with different possible needle values */
-/* checking loose and strict TYPE comparisons in in_array() */
-echo "\n*** Testing loose and strict TYPE comparison of in_array() ***\n";
-$misc_array = array (
- 'a',
- 'key' =>'d',
- 3,
- ".001" =>-67,
- "-.051" =>"k",
- 0.091 =>"-.08",
- "e" =>"5",
- "y" =>NULL,
- NULL =>"",
- 0,
- TRUE,
- FALSE,
- -27.39999999999,
- " ",
- "abcd\x00abcd\x00\abcd\x00abcdefghij",
- "abcd\nabcd\tabcd\rabcd\0abcd"
+echo "*** Testing array_search() with different needle values ***\n";
+$arrays = array (
+ array(0),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
+ array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
+ array(TRUE, FALSE),
+ array("", array()),
+ array("abcd\x00abcd\x00abcd"),
+ array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
);
-$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
-/* loop to do loose and strict type check of elements in
- $array_type on elements in $misc_array using in_array();
- checking PHP type comparison tables
-*/
+
+$array_compare = array (
+ 4,
+ "4",
+ 4.00,
+ "b",
+ "5",
+ -2,
+ -2.0,
+ -2.98989,
+ "-.9",
+ "True",
+ "",
+ array(),
+ NULL,
+ "ab",
+ "abcd",
+ 0.0,
+ -0,
+ "abcd\x00abcd\x00abcd"
+);
+/* loop to check if elements in $array_compare exist in $arrays
+ using array_search() */
$counter = 1;
-foreach($array_type as $type) {
- echo "-- Iteration $counter --\n";
- //loose type checking
- var_dump( in_array($type,$misc_array ) );
- //strict type checking
- var_dump( in_array($type,$misc_array,true) );
- //loose type checking
- var_dump( in_array($type,$misc_array,false) );
- $counter++;
+foreach($arrays as $array) {
+ foreach($array_compare as $compare) {
+ echo "-- Iteration $counter --\n";
+ //strict option OFF
+ var_dump(array_search($compare,$array));
+ //strict option ON
+ var_dump(array_search($compare,$array,TRUE));
+ //strict option OFF
+ var_dump(array_search($compare,$array,FALSE));
+ $counter++;
+ }
}
-
+
echo "Done\n";
?>
--EXPECTF--
-*** Testing loose and strict TYPE comparison of in_array() ***
+*** Testing array_search() with different needle values ***
-- Iteration 1 --
-bool(true)
-bool(true)
-bool(true)
+bool(false)
+bool(false)
+bool(false)
-- Iteration 2 --
-bool(true)
-bool(true)
-bool(true)
+bool(false)
+bool(false)
+bool(false)
-- Iteration 3 --
-bool(true)
bool(false)
-bool(true)
+bool(false)
+bool(false)
-- Iteration 4 --
-bool(true)
-bool(true)
-bool(true)
+int(0)
+bool(false)
+int(0)
-- Iteration 5 --
-bool(true)
bool(false)
-bool(true)
+bool(false)
+bool(false)
-- Iteration 6 --
-bool(true)
bool(false)
-bool(true)
+bool(false)
+bool(false)
-- Iteration 7 --
-bool(true)
bool(false)
-bool(true)
+bool(false)
+bool(false)
-- Iteration 8 --
-bool(true)
bool(false)
-bool(true)
+bool(false)
+bool(false)
-- Iteration 9 --
-bool(true)
-bool(true)
-bool(true)
+bool(false)
+bool(false)
+bool(false)
-- Iteration 10 --
-bool(true)
+int(0)
bool(false)
-bool(true)
+int(0)
-- Iteration 11 --
-bool(true)
+int(0)
bool(false)
-bool(true)
+int(0)
-- Iteration 12 --
-bool(true)
-bool(true)
-bool(true)
-Done
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 13 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 14 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 15 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 16 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 17 --
+int(0)
+int(0)
+int(0)
+-- Iteration 18 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 19 --
+int(4)
+int(4)
+int(4)
+-- Iteration 20 --
+int(4)
+bool(false)
+int(4)
+-- Iteration 21 --
+int(4)
+bool(false)
+int(4)
+-- Iteration 22 --
+int(5)
+int(5)
+int(5)
+-- 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 --
+string(0) ""
+bool(false)
+string(0) ""
+-- Iteration 30 --
+string(0) ""
+bool(false)
+string(0) ""
+-- Iteration 31 --
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 32 --
+int(6)
+int(6)
+int(6)
+-- Iteration 33 --
+int(7)
+int(7)
+int(7)
+-- Iteration 34 --
+string(1) "a"
+bool(false)
+string(1) "a"
+-- Iteration 35 --
+string(1) "a"
+bool(false)
+string(1) "a"
+-- Iteration 36 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 37 --
+int(0)
+int(0)
+int(0)
+-- Iteration 38 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 39 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 40 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 41 --
+int(5)
+bool(false)
+int(5)
+-- 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)
+-- Iteration 55 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 56 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 57 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 58 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 59 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 60 --
+int(1)
+int(1)
+int(1)
+-- Iteration 61 --
+int(1)
+bool(false)
+int(1)
+-- Iteration 62 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 63 --
+string(3) "-.9"
+bool(false)
+string(3) "-.9"
+-- Iteration 64 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 65 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 66 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 67 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 68 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 69 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 70 --
+int(2)
+bool(false)
+int(2)
+-- Iteration 71 --
+int(2)
+bool(false)
+int(2)
+-- Iteration 72 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 73 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 74 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 75 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 76 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 77 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 78 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 79 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 80 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 81 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 82 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 83 --
+int(1)
+bool(false)
+int(1)
+-- Iteration 84 --
+int(1)
+bool(false)
+int(1)
+-- Iteration 85 --
+int(1)
+bool(false)
+int(1)
+-- Iteration 86 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 87 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 88 --
+int(1)
+bool(false)
+int(1)
+-- Iteration 89 --
+int(1)
+bool(false)
+int(1)
+-- Iteration 90 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 91 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 92 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 93 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 94 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 95 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 96 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 97 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 98 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 99 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 100 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 101 --
+int(0)
+int(0)
+int(0)
+-- Iteration 102 --
+int(1)
+int(1)
+int(1)
+-- Iteration 103 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 104 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 105 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 106 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 107 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 108 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 109 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 110 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 111 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 112 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 113 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 114 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 115 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 116 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 117 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 118 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 119 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 120 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 121 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 122 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 123 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 124 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 125 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 126 --
+int(0)
+int(0)
+int(0)
+-- Iteration 127 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 128 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 129 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 130 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 131 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 132 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 133 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 134 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 135 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 136 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 137 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 138 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 139 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 140 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 141 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 142 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 143 --
+int(0)
+bool(false)
+int(0)
+-- Iteration 144 --
+bool(false)
+bool(false)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_search_variation2.phpt b/ext/standard/tests/array/array_search_variation2.phpt
index 10b2ea82c..da90de0cb 100644
--- a/ext/standard/tests/array/array_search_variation2.phpt
+++ b/ext/standard/tests/array/array_search_variation2.phpt
@@ -1,53 +1,102 @@
--TEST--
-Test array_search() and in_array() functions (variation-2)
+Test array_search() function : usage variations - different haystack values
--FILE--
<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
-/* checking for sub-arrays with in_array() */
-echo "\n*** Testing sub-arrays with in_array() ***\n";
-$sub_array = array (
- "one",
- array(1, 2 => "two", "three" => 3),
- 4 => "four",
- "five" => 5,
- array('', 'i')
-);
-var_dump( in_array("four", $sub_array) );
-//checking for element in a sub-array
-var_dump( in_array(3, $sub_array[1]) );
-var_dump( in_array(array('','i'), $sub_array) );
+/* Test array_search() with different possible haystack values */
-/* checking for objects in in_array() */
-echo "\n*** Testing objects with in_array() ***\n";
-class in_array_check {
- public $array_var = array(1=>"one", "two"=>2, 3=>3);
- public function foo() {
- echo "Public function\n";
- }
-}
+echo "*** Testing array_search() with different haystack values ***\n";
-$in_array_obj = new in_array_check(); //creating new object
-//error: as wrong datatype for second argument
-var_dump( in_array("array_var", $in_array_obj) );
-//error: as wrong datatype for second argument
-var_dump( in_array("foo", $in_array_obj) );
-//element found as "one" exists in array $array_var
-var_dump( in_array("one", $in_array_obj->array_var) );
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using array_search();
+ checking PHP type comparison tables
+*/
+$counter = 1;
+foreach($array_type as $type) {
+ echo "-- Iteration $counter --\n";
+ //loose type checking
+ var_dump( array_search($type,$misc_array ) );
+ //strict type checking
+ var_dump( array_search($type,$misc_array,true) );
+ //loose type checking
+ var_dump( array_search($type,$misc_array,false) );
+ $counter++;
+}
echo "Done\n";
?>
--EXPECTF--
-*** Testing sub-arrays with in_array() ***
-bool(true)
-bool(true)
-bool(true)
-
-*** Testing objects with in_array() ***
-
-Warning: in_array(): Wrong datatype for second argument in %s on line %d
+*** Testing array_search() with different haystack values ***
+-- Iteration 1 --
+int(0)
+int(3)
+int(0)
+-- Iteration 2 --
+string(1) "y"
+int(4)
+string(1) "y"
+-- Iteration 3 --
+int(3)
bool(false)
-
-Warning: in_array(): Wrong datatype for second argument in %s on line %d
+int(3)
+-- Iteration 4 --
+string(3) "key"
+int(2)
+string(3) "key"
+-- Iteration 5 --
+int(3)
+bool(false)
+int(3)
+-- Iteration 6 --
+int(3)
+bool(false)
+int(3)
+-- Iteration 7 --
+int(2)
+bool(false)
+int(2)
+-- Iteration 8 --
+int(3)
+bool(false)
+int(3)
+-- Iteration 9 --
+string(1) "y"
+string(1) "y"
+string(1) "y"
+-- Iteration 10 --
+string(1) "y"
+bool(false)
+string(1) "y"
+-- Iteration 11 --
+int(2)
bool(false)
-bool(true)
+int(2)
+-- Iteration 12 --
+string(1) "y"
+string(0) ""
+string(1) "y"
Done
diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt
index 83b607021..6213fb75f 100644
--- a/ext/standard/tests/array/array_search_variation3.phpt
+++ b/ext/standard/tests/array/array_search_variation3.phpt
@@ -1,69 +1,58 @@
--TEST--
-Test array_search() and in_array() functions (variation-3)
+Test array_search() function : usage variations - haystack as sub-array/object
--FILE--
<?php
-
-/* checking for Resources */
-echo "\n*** Testing resource type with in_array() ***\n";
-//file type resource
-$file_handle = fopen(__FILE__, "r");
-
-//directory type resource
-$dir_handle = opendir( dirname(__FILE__) );
-
-//store resources in array for comparision.
-$resources = array($file_handle, $dir_handle);
-
-// search for resouce type in the resource array
-var_dump( in_array($file_handle, $resources, true) );
-//checking for (int) type resource
-var_dump( in_array((int)$dir_handle, $resources, true) );
-
-/* Miscellenous input check */
-echo "\n*** Testing miscelleneos inputs with in_array() ***\n";
-//matching "Good" in array(0,"hello"), result:true in loose type check
-var_dump( in_array("Good", array(0,"hello")) );
-//false in strict mode
-var_dump( in_array("Good", array(0,"hello"), TRUE) );
-
-//matching integer 0 in array("this"), result:true in loose type check
-var_dump( in_array(0, array("this")) );
-// false in strict mode
-var_dump( in_array(0, array("this")),TRUE );
-
-//matching string "this" in array(0), result:true in loose type check
-var_dump( in_array("this", array(0)) );
-// false in stric mode
-var_dump( in_array("this", array(0), TRUE) );
-
-//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
-var_dump( in_array(FALSE,
- array("a"=> TRUE, "b"=> TRUE,
- array("c"=> TRUE, "d"=>TRUE)
- )
- )
- );
-
-//matching string having integer in beginning, result:true in loose type check
-var_dump( in_array('123abc', array(123)) );
-var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* checking for sub-arrays with array_search() */
+echo "*** Testing sub-arrays with array_search() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "two", "three" => 3),
+ 4 => "four",
+ "five" => 5,
+ array('', 'i')
+);
+var_dump( array_search("four", $sub_array) );
+//checking for element in a sub-array
+var_dump( array_search(3, $sub_array[1]) );
+var_dump( array_search(array('','i'), $sub_array) );
+
+/* checking for objects in array_search() */
+echo "\n*** Testing objects with array_search() ***\n";
+class array_search_check {
+ public $array_var = array(1=>"one", "two"=>2, 3=>3);
+ public function foo() {
+ echo "Public function\n";
+ }
+}
+
+$array_search_obj = new array_search_check(); //creating new object
+//error: as wrong datatype for second argument
+var_dump( array_search("array_var", $array_search_obj) );
+//error: as wrong datatype for second argument
+var_dump( array_search("foo", $array_search_obj) );
+//element found as "one" exists in array $array_var
+var_dump( array_search("one", $array_search_obj->array_var) );
echo "Done\n";
?>
--EXPECTF--
-*** Testing resource type with in_array() ***
-bool(true)
-bool(false)
+*** Testing sub-arrays with array_search() ***
+int(4)
+string(5) "three"
+int(5)
-*** Testing miscelleneos inputs with in_array() ***
-bool(true)
-bool(false)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
+*** Testing objects with array_search() ***
+
+Warning: array_search(): Wrong datatype for second argument in %s on line %d
bool(false)
-bool(true)
+
+Warning: array_search(): Wrong datatype for second argument in %s on line %d
bool(false)
+int(1)
Done
diff --git a/ext/standard/tests/array/array_search_variation4.phpt b/ext/standard/tests/array/array_search_variation4.phpt
new file mode 100644
index 000000000..6dbe3fa34
--- /dev/null
+++ b/ext/standard/tests/array/array_search_variation4.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test array_search() function : usage variations - haystack as resource/multi dimentional array
+--FILE--
+<?php
+/*
+ * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
+ * Source Code: ext/standard/array.c
+*/
+
+/* checking for Resources */
+echo "*** Testing resource type with array_search() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( array_search($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( array_search((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with array_search() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( array_search("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( array_search("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( array_search(0, array("this")) );
+// false in strict mode
+var_dump( array_search(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( array_search("this", array(0)) );
+// false in stric mode
+var_dump( array_search("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( array_search(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( array_search('123abc', array(123)) );
+var_dump( array_search('123abc', array(123), TRUE) ); // false in strict mode
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing resource type with array_search() ***
+int(0)
+bool(false)
+
+*** Testing miscelleneos inputs with array_search() ***
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(true)
+int(0)
+bool(false)
+bool(false)
+int(0)
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_splice_basic.phpt b/ext/standard/tests/array/array_splice_basic.phpt
new file mode 100644
index 000000000..e96303d13
--- /dev/null
+++ b/ext/standard/tests/array/array_splice_basic.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Test array_splice(): basic functionality
+--FILE--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "*** Testing array_splice() basic operations ***\n";
+echo "test truncation \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 2));
+var_dump ($input);
+// $input is now array("red", "green")
+
+echo "test removing entries from the middle \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 1, -1));
+var_dump ($input);
+// $input is now array("red", "yellow")
+
+echo "test substitution at end \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 1, count($input), "orange"));
+var_dump ($input);
+// $input is now array("red", "orange")
+
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, -1, 1, array("black", "maroon")));
+var_dump ($input);
+// $input is now array("red", "green",
+// "blue", "black", "maroon")
+
+echo "test insertion \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 3, 0, "purple"));
+var_dump ($input);
+// $input is now array("red", "green",
+// "blue", "purple", "yellow");
+
+
+?>
+--EXPECT--
+*** Testing array_splice() basic operations ***
+test truncation
+array(2) {
+ [0]=>
+ string(4) "blue"
+ [1]=>
+ string(6) "yellow"
+}
+array(2) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+}
+test removing entries from the middle
+array(2) {
+ [0]=>
+ string(5) "green"
+ [1]=>
+ string(4) "blue"
+}
+array(2) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(6) "yellow"
+}
+test substitution at end
+array(3) {
+ [0]=>
+ string(5) "green"
+ [1]=>
+ string(4) "blue"
+ [2]=>
+ string(6) "yellow"
+}
+array(2) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(6) "orange"
+}
+array(1) {
+ [0]=>
+ string(6) "yellow"
+}
+array(5) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+ [2]=>
+ string(4) "blue"
+ [3]=>
+ string(5) "black"
+ [4]=>
+ string(6) "maroon"
+}
+test insertion
+array(0) {
+}
+array(5) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+ [2]=>
+ string(4) "blue"
+ [3]=>
+ string(6) "purple"
+ [4]=>
+ string(6) "yellow"
+}
diff --git a/ext/standard/tests/array/array_splice_errors.phpt b/ext/standard/tests/array/array_splice_errors.phpt
new file mode 100644
index 000000000..4f3223900
--- /dev/null
+++ b/ext/standard/tests/array/array_splice_errors.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test array_splice() function : error conditions
+--FILE--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing error conditions of array_splice() ***\n";
+
+$int=1;
+$array=array(1,2);
+var_dump (array_splice());
+var_dump (array_splice($int));
+var_dump (array_splice($array));
+var_dump (array_splice($int,$int));
+$obj= new stdclass;
+var_dump (array_splice($obj,0,1));
+echo "Done\n";
+
+?>
+--EXPECTF--
+
+*** Testing error conditions of array_splice() ***
+
+Warning: Wrong parameter count for array_splice() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_splice() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_splice() in %s on line %d
+NULL
+
+Warning: array_splice(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_splice(): The first argument should be an array in %s on line %d
+NULL
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_splice_variation1.phpt b/ext/standard/tests/array/array_splice_variation1.phpt
new file mode 100644
index 000000000..45cb6f607
--- /dev/null
+++ b/ext/standard/tests/array/array_splice_variation1.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test array_splice() function : usage variations - references
+--FILE--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+
+echo "test behaviour when input array is in a reference set\n";
+
+$input_array=array (array(1,2));
+$input_array[]=&$input_array[0];
+var_dump (array_splice ($input_array[0],1,1));
+var_dump ($input_array);
+
+echo "Test behaviour of input arrays containing references \n";
+/*
+ * There are three regions to test:, before cut, the cut and after the cut.
+ * For reach we check a plain value, a reference value with integer key and a
+ * reference value with a string key.
+ */
+$numbers=array(0,1,2,3,4,5,6,7,8,9,10,11,12);
+$input_array=array(0,1,&$numbers[2],"three"=>&$numbers[3],4,&$numbers[5],"six"=>&$numbers[6],7,&$numbers[8],"nine"=>&$numbers[9]);
+var_dump (array_splice ($input_array,4,3));
+var_dump ($input_array);
+
+echo "Test behaviour of replacement array containing references \n";
+
+$three=3;
+$four=4;
+$input_array=array (0,1,2);
+$b=array(&$three,"fourkey"=>&$four);
+array_splice ($input_array,-1,1,$b);
+var_dump ($input_array);
+
+echo "Test behaviour of replacement which is part of reference set \n";
+
+$int=3;
+$input_array=array (1,2);
+$b=&$int;
+
+array_splice ($input_array,-1,1,$b);
+var_dump ($input_array);
+echo "Done\n";
+?>
+--EXPECT--
+test behaviour when input array is in a reference set
+array(1) {
+ [0]=>
+ int(2)
+}
+array(2) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ &array(1) {
+ [0]=>
+ int(1)
+ }
+}
+Test behaviour of input arrays containing references
+array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ &int(5)
+ ["six"]=>
+ &int(6)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(2)
+ ["three"]=>
+ &int(3)
+ [3]=>
+ int(7)
+ [4]=>
+ &int(8)
+ ["nine"]=>
+ &int(9)
+}
+Test behaviour of replacement array containing references
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ &int(3)
+ [3]=>
+ &int(4)
+}
+Test behaviour of replacement which is part of reference set
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(3)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_splice_variation2.phpt b/ext/standard/tests/array/array_splice_variation2.phpt
new file mode 100644
index 000000000..a7409040c
--- /dev/null
+++ b/ext/standard/tests/array/array_splice_variation2.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test array_splice() function : usage variations - additional parameters
+--FILE--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+$array=array(0,1,2);
+var_dump (array_splice($array,1,1,3,4,5,6,7,8,9));
+var_dump ($array);
+echo "Done\n";
+?>
+--EXPECTF--
+
+Warning: Wrong parameter count for array_splice() in %s on line %d
+NULL
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_splice_variation3.phpt b/ext/standard/tests/array/array_splice_variation3.phpt
new file mode 100644
index 000000000..821e06c98
--- /dev/null
+++ b/ext/standard/tests/array/array_splice_variation3.phpt
@@ -0,0 +1,856 @@
+--TEST--
+Test array_splice() function : usage variations - lengths and offsets
+--FILE--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "*** array_splice() function : usage variations - lengths and offsets\n";
+
+
+function test_splice ($offset, $length)
+{
+ echo " - No replacement\n";
+ $input_array=array(0,1,2,3,4,5);
+ var_dump (array_splice ($input_array,$offset,$length));
+ var_dump ($input_array);
+ echo " - With replacement\n";
+ $input_array=array(0,1,2,3,4,5);
+ var_dump (array_splice ($input_array,$offset,$length,array ("A","B","C")));
+ var_dump ($input_array);
+}
+
+echo "absolute offset - absolute length - cut from beginning\n";
+test_splice (0,2);
+echo "absolute offset - absolute length - cut from middle\n";
+test_splice (2,2);
+echo "absolute offset - absolute length - cut from end\n";
+test_splice (4,2);
+echo "absolute offset - absolute length - attempt to cut past end\n";
+test_splice (4,4);
+echo "absolute offset - absolute length - cut everything\n";
+test_splice (0,7);
+echo "absolute offset - absolute length - cut nothing\n";
+test_splice (3,0);
+
+echo "absolute offset - relative length - cut from beginning\n";
+test_splice (0,-4);
+
+echo "absolute offset - relative length - cut from middle\n";
+test_splice (2,-2);
+
+echo "absolute offset - relative length - attempt to cut form before beginning \n";
+test_splice (0,-7);
+
+echo "absolute offset - relative length - cut nothing\n";
+test_splice (2,-7);
+
+echo "relative offset - absolute length - cut from beginning\n";
+test_splice (-6,2);
+
+echo "relative offset - absolute length - cut from middle\n";
+test_splice (-4,2);
+echo "relative offset - absolute length - cut from end\n";
+test_splice (-2,2);
+echo "relative offset - absolute length - attempt to cut past end\n";
+test_splice (-2,4);
+echo "relative offset - absolute length - cut everything\n";
+test_splice (-6,6);
+echo "relative offset - absolute length - cut nothing\n";
+test_splice (-6,0);
+
+echo "relative offset - relative length - cut from beginning\n";
+test_splice (-6,-4);
+
+echo "relative offset - relative length - cut from middle\n";
+test_splice (-4,-2);
+
+echo "relative offset - relative length - cut nothing\n";
+test_splice (-4,-7);
+echo "Done\n";
+?>
+
+--EXPECT--
+*** array_splice() function : usage variations - lengths and offsets
+absolute offset - absolute length - cut from beginning
+ - No replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(7) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+absolute offset - absolute length - cut from middle
+ - No replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "A"
+ [3]=>
+ string(1) "B"
+ [4]=>
+ string(1) "C"
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+absolute offset - absolute length - cut from end
+ - No replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ string(1) "B"
+ [6]=>
+ string(1) "C"
+}
+absolute offset - absolute length - attempt to cut past end
+ - No replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ string(1) "B"
+ [6]=>
+ string(1) "C"
+}
+absolute offset - absolute length - cut everything
+ - No replacement
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+array(0) {
+}
+ - With replacement
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+}
+absolute offset - absolute length - cut nothing
+ - No replacement
+array(0) {
+}
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+ - With replacement
+array(0) {
+}
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(1) "A"
+ [4]=>
+ string(1) "B"
+ [5]=>
+ string(1) "C"
+ [6]=>
+ int(3)
+ [7]=>
+ int(4)
+ [8]=>
+ int(5)
+}
+absolute offset - relative length - cut from beginning
+ - No replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(7) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+absolute offset - relative length - cut from middle
+ - No replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "A"
+ [3]=>
+ string(1) "B"
+ [4]=>
+ string(1) "C"
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+absolute offset - relative length - attempt to cut form before beginning
+ - No replacement
+array(0) {
+}
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+ - With replacement
+array(0) {
+}
+array(9) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+ [3]=>
+ int(0)
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+ [6]=>
+ int(3)
+ [7]=>
+ int(4)
+ [8]=>
+ int(5)
+}
+absolute offset - relative length - cut nothing
+ - No replacement
+array(0) {
+}
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+ - With replacement
+array(0) {
+}
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "A"
+ [3]=>
+ string(1) "B"
+ [4]=>
+ string(1) "C"
+ [5]=>
+ int(2)
+ [6]=>
+ int(3)
+ [7]=>
+ int(4)
+ [8]=>
+ int(5)
+}
+relative offset - absolute length - cut from beginning
+ - No replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(7) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+relative offset - absolute length - cut from middle
+ - No replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "A"
+ [3]=>
+ string(1) "B"
+ [4]=>
+ string(1) "C"
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+relative offset - absolute length - cut from end
+ - No replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ string(1) "B"
+ [6]=>
+ string(1) "C"
+}
+relative offset - absolute length - attempt to cut past end
+ - No replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ string(1) "A"
+ [5]=>
+ string(1) "B"
+ [6]=>
+ string(1) "C"
+}
+relative offset - absolute length - cut everything
+ - No replacement
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+array(0) {
+}
+ - With replacement
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+}
+relative offset - absolute length - cut nothing
+ - No replacement
+array(0) {
+}
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+ - With replacement
+array(0) {
+}
+array(9) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+ [3]=>
+ int(0)
+ [4]=>
+ int(1)
+ [5]=>
+ int(2)
+ [6]=>
+ int(3)
+ [7]=>
+ int(4)
+ [8]=>
+ int(5)
+}
+relative offset - relative length - cut from beginning
+ - No replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(4) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+array(7) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "B"
+ [2]=>
+ string(1) "C"
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+relative offset - relative length - cut from middle
+ - No replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(4)
+ [3]=>
+ int(5)
+}
+ - With replacement
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "A"
+ [3]=>
+ string(1) "B"
+ [4]=>
+ string(1) "C"
+ [5]=>
+ int(4)
+ [6]=>
+ int(5)
+}
+relative offset - relative length - cut nothing
+ - No replacement
+array(0) {
+}
+array(6) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+ [4]=>
+ int(4)
+ [5]=>
+ int(5)
+}
+ - With replacement
+array(0) {
+}
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "A"
+ [3]=>
+ string(1) "B"
+ [4]=>
+ string(1) "C"
+ [5]=>
+ int(2)
+ [6]=>
+ int(3)
+ [7]=>
+ int(4)
+ [8]=>
+ int(5)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_splice_variation4.phpt b/ext/standard/tests/array/array_splice_variation4.phpt
new file mode 100644
index 000000000..12a4acfbd
--- /dev/null
+++ b/ext/standard/tests/array/array_splice_variation4.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test array_splice() function : usage variations - non array replacement values
+--FILE--
+<?php
+/*
+ * proto array array_splice(array input, int offset [, int length [, array replacement]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+function test_splice ($replacement)
+{
+ $input_array=array(0,1);
+ var_dump (array_splice ($input_array,2,0,$replacement));
+ var_dump ($input_array);
+}
+
+test_splice (2);
+
+test_splice (2.1);
+
+test_splice (true);
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+test_splice ($file_handle);
+echo "Done\n";
+?>
+--EXPECTF--
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.1)
+}
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ bool(true)
+}
+array(0) {
+}
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ resource(%d) of type (stream)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unshift_basic1.phpt b/ext/standard/tests/array/array_unshift_basic1.phpt
new file mode 100644
index 000000000..6bba48b9d
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_basic1.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test array_unshift() function : basic functionality - array with default keys for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_unshift() by giving array with default keys for $array argument
+*/
+
+echo "*** Testing array_unshift() : basic functionality with default key array ***\n";
+
+// Initialise the array
+$array = array(1, 2);
+
+// Calling array_unshift() with default argument
+$temp_array = $array;
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+var_dump( array_unshift($temp_array, 10) );
+
+// dump the resulting array
+var_dump($temp_array);
+
+// Calling array_unshift() with optional arguments
+$temp_array = $array;
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+var_dump( array_unshift($temp_array, 222, "hello", 12.33) );
+
+// dump the resulting array
+var_dump($temp_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : basic functionality with default key array ***
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+int(5)
+array(5) {
+ [0]=>
+ int(222)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ float(12.33)
+ [3]=>
+ int(1)
+ [4]=>
+ int(2)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unshift_basic2.phpt b/ext/standard/tests/array/array_unshift_basic2.phpt
new file mode 100644
index 000000000..e4fd2e00a
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_basic2.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test array_unshift() function : basic functionality - associative arrays for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_unshift() by giving associative arrays for $array argument
+*/
+
+echo "*** Testing array_unshift() : basic functionality with associative array ***\n";
+
+// Initialise the array
+$array = array('f' => "first", "s" => 'second', 1 => "one", 2 => 'two');
+
+// Calling array_unshift() with default argument
+$temp_array = $array;
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+var_dump( array_unshift($temp_array, 10) );
+
+// dump the resulting array
+var_dump($temp_array);
+
+// Calling array_unshift() with optional arguments
+$temp_array = $array;
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+var_dump( array_unshift($temp_array, 222, "hello", 12.33) );
+
+// dump the resulting array
+var_dump($temp_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : basic functionality with associative array ***
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+int(7)
+array(7) {
+ [0]=>
+ int(222)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ float(12.33)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unshift_error.phpt b/ext/standard/tests/array/array_unshift_error.phpt
new file mode 100644
index 000000000..3a5cd53ff
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test array_unshift() function : error conditions
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+echo "*** Testing array_unshift() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing array_unshift() function with Zero arguments --\n";
+var_dump( array_unshift() );
+
+// Testing array_unshift with one less than the expected number of arguments
+echo "\n-- Testing array_unshift() function with less than expected no. of arguments --\n";
+$array = array(1, 2);
+var_dump( array_unshift($array) );
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : error conditions ***
+
+-- Testing array_unshift() function with Zero arguments --
+
+Warning: Wrong parameter count for array_unshift() in %s on line %d
+NULL
+
+-- Testing array_unshift() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for array_unshift() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/array/array_unshift_object.phpt b/ext/standard/tests/array/array_unshift_object.phpt
new file mode 100644
index 000000000..793db83fe
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_object.phpt
@@ -0,0 +1,325 @@
+--TEST--
+Test array_unshift() function : passing object for 'var' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing
+ * an object to the $var argument
+*/
+
+echo "*** Testing array_unshift() : Passing object to \$var argument ***\n";
+
+// simple class with a variable and method
+class SimpleClass
+{
+ public $var1 = 1;
+ public function fun1() {
+ return $var1;
+ }
+}
+
+// class without members
+class EmptyClass
+{
+}
+
+// class with only one method and no variable
+class FuncClass
+{
+ function fun() {
+ echo "No variables here";
+ }
+}
+
+// abstract class
+abstract class AbstractClass
+{
+ protected $var2 = 5;
+ abstract function emptyFunction();
+}
+
+// class deriving the above abstract class
+class ChildClass extends AbstractClass
+{
+ private $var3;
+ public function emptyFunction() {
+ echo "defined in child";
+ }
+}
+
+// class with final method
+class FinalClass
+{
+ private $var4;
+ final function finalMethod() {
+ echo "This function can't be overloaded";
+ }
+}
+
+// class with static members
+class StaticClass
+{
+ static $var5 = 2;
+ public static function staticMethod() {
+ echo "This is a static method";
+ }
+}
+
+// array to be passed to $array argument
+$array = array('f' => "first", "s" => 'second', 1, 2.222);
+
+// array containing different types of objects as elements
+$vars = array(
+ new SimpleClass(),
+ new EmptyClass(),
+ new FuncClass(),
+ new ChildClass(),
+ new FinalClass(),
+ new StaticClass()
+);
+
+// loop through the various elements of $arrays to check the functionality of array_unshift
+$iterator = 1;
+foreach($vars as $var) {
+ echo "-- Iteration $iterator --\n";
+
+ /* with default argument */
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var) ); // pushes $var to $temp_array, return sizeof($temp_array)
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with more data values to be pushed */
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') ); // pushes 3 more data to $temp_array, return sizeof($temp_array)
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : Passing object to $var argument ***
+-- Iteration 1 --
+int(5)
+array(5) {
+ [0]=>
+ object(SimpleClass)#%d (1) {
+ ["var1"]=>
+ int(1)
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(SimpleClass)#%d (1) {
+ ["var1"]=>
+ int(1)
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 2 --
+int(5)
+array(5) {
+ [0]=>
+ object(EmptyClass)#%d (0) {
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(EmptyClass)#%d (0) {
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 3 --
+int(5)
+array(5) {
+ [0]=>
+ object(FuncClass)#%d (0) {
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(FuncClass)#%d (0) {
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ object(ChildClass)#%d (2) {
+ ["var3:private"]=>
+ NULL
+ ["var2:protected"]=>
+ int(5)
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(ChildClass)#%d (2) {
+ ["var3:private"]=>
+ NULL
+ ["var2:protected"]=>
+ int(5)
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 5 --
+int(5)
+array(5) {
+ [0]=>
+ object(FinalClass)#%d (1) {
+ ["var4:private"]=>
+ NULL
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(FinalClass)#%d (1) {
+ ["var4:private"]=>
+ NULL
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 6 --
+int(5)
+array(5) {
+ [0]=>
+ object(StaticClass)#%d (0) {
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(StaticClass)#%d (0) {
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation1.phpt b/ext/standard/tests/array/array_unshift_variation1.phpt
new file mode 100644
index 000000000..b1292d626
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation1.phpt
@@ -0,0 +1,338 @@
+--TEST--
+Test array_unshift() function : usage variations - unexpected values for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the behavior of array_unshift() by giving values
+ * other than array values for $array argument
+*/
+
+echo "*** Testing array_unshift() : unexpected values for \$array argument ***\n";
+
+// Initialise $var argument
+$var = 12;
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// array of unexpected values to be passed to $array argument
+$arrays = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*21*/ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $arrays to test the functionality of array_unshift()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "\n-- Iteration $iterator --";
+
+ /* with default arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+};
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : unexpected values for $array argument ***
+
+-- Iteration 1 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(0)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(0)
+
+-- Iteration 2 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(1)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(1)
+
+-- Iteration 3 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(12345)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(12345)
+
+-- Iteration 4 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(-2345)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+int(-2345)
+
+-- Iteration 5 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(10.5)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(10.5)
+
+-- Iteration 6 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(-10.5)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(-10.5)
+
+-- Iteration 7 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(123456789000)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(123456789000)
+
+-- Iteration 8 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(1.23456789E-9)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(1.23456789E-9)
+
+-- Iteration 9 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(0.5)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+float(0.5)
+
+-- Iteration 10 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+-- Iteration 11 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+-- Iteration 12 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(true)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 13 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(false)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(false)
+
+-- Iteration 14 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(true)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(true)
+
+-- Iteration 15 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(false)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+bool(false)
+
+-- Iteration 16 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(0) ""
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(0) ""
+
+-- Iteration 17 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(0) ""
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(0) ""
+
+-- Iteration 18 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(6) "string"
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(6) "string"
+
+-- Iteration 19 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(6) "string"
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(6) "string"
+
+-- Iteration 20 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(11) "hello world"
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+string(11) "hello world"
+
+-- Iteration 21 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+object(classA)#%d (0) {
+}
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+object(classA)#%d (0) {
+}
+
+-- Iteration 22 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+-- Iteration 23 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+NULL
+
+-- Iteration 24 --
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+resource(%d) of type (stream)
+
+Warning: array_unshift(): The first argument should be an array in %s on line %d
+bool(false)
+resource(%d) of type (stream)
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation2.phpt b/ext/standard/tests/array/array_unshift_variation2.phpt
new file mode 100644
index 000000000..064309b53
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation2.phpt
@@ -0,0 +1,1061 @@
+--TEST--
+Test array_unshift() function : usage variations - all possible values for 'var' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing array_unshift() by giving all the possible values for $var argument
+*/
+
+echo "*** Testing array_unshift() : all possible values for \$var argument ***\n";
+
+// array to be passed to $array argument
+$array = array('f' => "first", "s" => 'second', 1, 2.222);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// different types of values to be passed to $var argument
+$vars = array(
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // array data
+/*10*/ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+/*15*/ NULL,
+ null,
+
+ // boolean data
+/*17*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*21*/ "",
+ '',
+
+ // string data
+/*23*/ "string",
+ 'string',
+ $heredoc,
+
+ // object data
+/*26*/ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+/*29*/ $fp
+);
+
+// loop through each element of $vars to check the functionality of array_unshift()
+$iterator = 1;
+foreach($vars as $var) {
+ echo "-- Iteration $iterator --\n";
+ $temp_array = $array;
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+// close the file resource used
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : all possible values for $var argument ***
+-- Iteration 1 --
+int(5)
+array(5) {
+ [0]=>
+ int(0)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(0)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 2 --
+int(5)
+array(5) {
+ [0]=>
+ int(1)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 3 --
+int(5)
+array(5) {
+ [0]=>
+ int(12345)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(12345)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ int(-2345)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(-2345)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 5 --
+int(5)
+array(5) {
+ [0]=>
+ float(10.5)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ float(10.5)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 6 --
+int(5)
+array(5) {
+ [0]=>
+ float(-10.5)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 7 --
+int(5)
+array(5) {
+ [0]=>
+ float(123456789000)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ float(123456789000)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 8 --
+int(5)
+array(5) {
+ [0]=>
+ float(1.23456789E-9)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ float(1.23456789E-9)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 9 --
+int(5)
+array(5) {
+ [0]=>
+ float(0.5)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ float(0.5)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 10 --
+int(5)
+array(5) {
+ [0]=>
+ array(0) {
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 11 --
+int(5)
+array(5) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(0)
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 12 --
+int(5)
+array(5) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 13 --
+int(5)
+array(5) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 14 --
+int(5)
+array(5) {
+ [0]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ array(2) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 15 --
+int(5)
+array(5) {
+ [0]=>
+ NULL
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 16 --
+int(5)
+array(5) {
+ [0]=>
+ NULL
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 17 --
+int(5)
+array(5) {
+ [0]=>
+ bool(true)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ bool(true)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 18 --
+int(5)
+array(5) {
+ [0]=>
+ bool(false)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 19 --
+int(5)
+array(5) {
+ [0]=>
+ bool(true)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ bool(true)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 20 --
+int(5)
+array(5) {
+ [0]=>
+ bool(false)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ bool(false)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 21 --
+int(5)
+array(5) {
+ [0]=>
+ string(0) ""
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 22 --
+int(5)
+array(5) {
+ [0]=>
+ string(0) ""
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 23 --
+int(5)
+array(5) {
+ [0]=>
+ string(6) "string"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 24 --
+int(5)
+array(5) {
+ [0]=>
+ string(6) "string"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 25 --
+int(5)
+array(5) {
+ [0]=>
+ string(11) "hello world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(11) "hello world"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 26 --
+int(5)
+array(5) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ object(classA)#%d (0) {
+ }
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 27 --
+int(5)
+array(5) {
+ [0]=>
+ NULL
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 28 --
+int(5)
+array(5) {
+ [0]=>
+ NULL
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ NULL
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 29 --
+int(5)
+array(5) {
+ [0]=>
+ resource(%d) of type (stream)
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ resource(%d) of type (stream)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation3.phpt b/ext/standard/tests/array/array_unshift_variation3.phpt
new file mode 100644
index 000000000..286cb290b
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation3.phpt
@@ -0,0 +1,571 @@
+--TEST--
+Test array_unshift() function : usage variations - different array values for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the behavior of array_unshift() by passing different types of arrays
+ * to $array argument to which the $var arguments will be prepended
+*/
+
+echo "*** Testing array_unshift() : different arrays for \$array argument ***\n";
+
+// initialize $var argument
+$var = 10;
+
+// different arrays to be passed to $array argument
+$arrays = array (
+/*1*/ array(1, 2), // array with default keys and numeric values
+ array(1.1, 2.2), // array with default keys & float values
+ array( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+/*8*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+/*13*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// loop through the various elements of $arrays to test array_unshift()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : different arrays for $array argument ***
+-- Iteration 1 --
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ int(1)
+ [4]=>
+ int(2)
+}
+-- Iteration 2 --
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(2.2)
+}
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ float(1.1)
+ [4]=>
+ float(2.2)
+}
+-- Iteration 3 --
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ array(1) {
+ [0]=>
+ int(2)
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
+-- Iteration 4 --
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+}
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ bool(false)
+ [4]=>
+ bool(true)
+}
+-- Iteration 5 --
+int(1)
+array(1) {
+ [0]=>
+ int(10)
+}
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+}
+-- Iteration 6 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ NULL
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ NULL
+}
+-- Iteration 7 --
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(4) "aaaa"
+ [3]=>
+ string(1) "b"
+ [4]=>
+ string(4) "bbbb"
+ [5]=>
+ string(1) "c"
+ [6]=>
+ string(5) "ccccc"
+}
+int(9)
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(1) "a"
+ [4]=>
+ string(4) "aaaa"
+ [5]=>
+ string(1) "b"
+ [6]=>
+ string(4) "bbbb"
+ [7]=>
+ string(1) "c"
+ [8]=>
+ string(5) "ccccc"
+}
+-- Iteration 8 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(3) "one"
+ [4]=>
+ string(3) "two"
+ [5]=>
+ string(5) "three"
+}
+-- Iteration 9 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+}
+-- Iteration 10 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(10)
+ [2]=>
+ int(20)
+ [3]=>
+ int(40)
+ [4]=>
+ int(30)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ int(10)
+ [4]=>
+ int(20)
+ [5]=>
+ int(40)
+ [6]=>
+ int(30)
+}
+-- Iteration 11 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["one"]=>
+ string(3) "ten"
+ ["two"]=>
+ string(6) "twenty"
+ ["three"]=>
+ string(6) "thirty"
+}
+-- Iteration 12 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ ["one"]=>
+ int(1)
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(4) "four"
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["one"]=>
+ int(1)
+ [3]=>
+ string(3) "two"
+ [4]=>
+ string(4) "four"
+}
+-- Iteration 13 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [""]=>
+ string(4) "null"
+ ["NULL"]=>
+ NULL
+ ["null"]=>
+ NULL
+}
+-- Iteration 14 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(4) "true"
+ [2]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(4) "true"
+ [4]=>
+ string(5) "false"
+ ["false"]=>
+ bool(false)
+ ["true"]=>
+ bool(true)
+}
+-- Iteration 15 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [""]=>
+ string(6) "emptys"
+ ["emptyd"]=>
+ string(0) ""
+ ["emptys"]=>
+ string(0) ""
+}
+-- Iteration 16 --
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(0) ""
+ [2]=>
+ string(0) ""
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+ [5]=>
+ bool(false)
+ [6]=>
+ bool(true)
+}
+int(9)
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(0) ""
+ [4]=>
+ string(0) ""
+ [5]=>
+ NULL
+ [6]=>
+ NULL
+ [7]=>
+ bool(false)
+ [8]=>
+ bool(true)
+}
+-- Iteration 17 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [""]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [""]=>
+ int(4)
+ [3]=>
+ int(5)
+ [4]=>
+ int(6)
+}
+-- Iteration 18 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["One"]=>
+ int(10)
+ ["two"]=>
+ int(20)
+ ["three"]=>
+ int(3)
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt
new file mode 100644
index 000000000..25c9159a1
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation4.phpt
@@ -0,0 +1,390 @@
+--TEST--
+Test array_unshift() function : usage variations - assoc. array with diff. keys for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * associative arrays having different possible keys to $array argument.
+ * The $var argument passed is a fixed value
+*/
+
+echo "*** Testing array_unshift() : associative array with different keys ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA
+{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing $var argument
+$var = 10;
+
+// different variations of associative arrays to be passed to $array argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer keys
+ array(0 => "0"),
+ array(1 => "1"),
+ array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),
+
+ // arrays with float keys
+/*5*/ array(2.3333 => "float"),
+ array(1.2 => "f1", 3.33 => "f2",
+ 4.89999922839999 => "f3",
+ 33333333.333333 => "f4"),
+
+ // arrays with string keys
+/*7*/ array('\tHello' => 111, 're\td' => "color",
+ '\v\fworld' => 2.2, 'pen\n' => 33),
+ array("\tHello" => 111, "re\td" => "color",
+ "\v\fworld" => 2.2, "pen\n" => 33),
+ array("hello", $heredoc => "string"), // heredoc
+
+ // array with object, unset variable and resource variable
+ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+
+ // array with mixed keys
+/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+ $fp => 'resource', 133 => "int", 444.432 => "float",
+ @$unset_var => "unset", $heredoc => "heredoc")
+);
+
+// loop through the various elements of $arrays to test array_unshift()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : associative array with different keys ***
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+
+Warning: Illegal offset type in %s on line %d
+-- Iteration 1 --
+int(1)
+array(1) {
+ [0]=>
+ int(10)
+}
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+}
+-- Iteration 2 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(1) "0"
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(1) "0"
+}
+-- Iteration 3 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(1) "1"
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(1) "1"
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(1) "3"
+ [4]=>
+ string(1) "4"
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(1) "1"
+ [4]=>
+ string(1) "2"
+ [5]=>
+ string(1) "3"
+ [6]=>
+ string(1) "4"
+}
+-- Iteration 5 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "float"
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(5) "float"
+}
+-- Iteration 6 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(2) "f1"
+ [2]=>
+ string(2) "f2"
+ [3]=>
+ string(2) "f3"
+ [4]=>
+ string(2) "f4"
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(2) "f1"
+ [4]=>
+ string(2) "f2"
+ [5]=>
+ string(2) "f3"
+ [6]=>
+ string(2) "f4"
+}
+-- Iteration 7 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ ["\tHello"]=>
+ int(111)
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(33)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["\tHello"]=>
+ int(111)
+ ["re\td"]=>
+ string(5) "color"
+ ["\v\fworld"]=>
+ float(2.2)
+ ["pen\n"]=>
+ int(33)
+}
+-- Iteration 8 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [" Hello"]=>
+ int(111)
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(33)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [" Hello"]=>
+ int(111)
+ ["re d"]=>
+ string(5) "color"
+ [" world"]=>
+ float(2.2)
+ ["pen
+"]=>
+ int(33)
+}
+-- Iteration 9 --
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(5) "hello"
+ ["Hello world"]=>
+ string(6) "string"
+}
+-- Iteration 10 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [""]=>
+ string(5) "hello"
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [""]=>
+ string(5) "hello"
+}
+-- Iteration 11 --
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ ["hello"]=>
+ int(1)
+ ["fruit"]=>
+ float(2.2)
+ [1]=>
+ string(3) "int"
+ [2]=>
+ string(5) "float"
+ [""]=>
+ string(5) "unset"
+ ["Hello world"]=>
+ string(7) "heredoc"
+}
+int(9)
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["hello"]=>
+ int(1)
+ ["fruit"]=>
+ float(2.2)
+ [3]=>
+ string(3) "int"
+ [4]=>
+ string(5) "float"
+ [""]=>
+ string(5) "unset"
+ ["Hello world"]=>
+ string(7) "heredoc"
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation5.phpt b/ext/standard/tests/array/array_unshift_variation5.phpt
new file mode 100644
index 000000000..ff6bf28f8
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation5.phpt
@@ -0,0 +1,396 @@
+--TEST--
+Test array_unshift() function : usage variations - assoc. array with diff values for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * associative arrays having different possible values to $array argument.
+ * The $var argument passed is a fixed value
+*/
+
+echo "*** Testing array_unshift() : associative array with different values ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+// get a heredoc string
+$heredoc = <<<EOT
+Hello world
+EOT;
+
+// initializing $var argument
+$var = 10;
+
+// different variations of associative arrays to be passed to $array argument
+$arrays = array (
+
+ // empty array
+/*1*/ array(),
+
+ // arrays with integer values
+ array('0' => 0),
+ array("1" => 1),
+ array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),
+
+ // arrays with float values
+/*5*/ array("float" => 2.3333),
+ array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333),
+
+ // arrays with string values
+/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
+ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
+ array(1 => "hello", "heredoc" => $heredoc),
+
+ // array with object, unset variable and resource variable
+ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),
+
+ // array with mixed values
+/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", 'resource' => $fp, "int" => 133, "float" => 444.432, "unset" => @$unset_var, "heredoc" => $heredoc)
+);
+
+// loop through the various elements of $arrays to test array_unshift()
+$iterator = 1;
+foreach($arrays as $array) {
+ echo "-- Iteration $iterator --\n";
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : associative array with different values ***
+-- Iteration 1 --
+int(1)
+array(1) {
+ [0]=>
+ int(10)
+}
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+}
+-- Iteration 2 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(0)
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ int(0)
+}
+-- Iteration 3 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(1)
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ int(1)
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [3]=>
+ int(4)
+}
+-- Iteration 5 --
+int(2)
+array(2) {
+ [0]=>
+ int(10)
+ ["float"]=>
+ float(2.3333)
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["float"]=>
+ float(2.3333)
+}
+-- Iteration 6 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [1]=>
+ float(4.8999992284)
+ ["f4"]=>
+ float(33333333.333333)
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f1"]=>
+ float(1.2)
+ ["f2"]=>
+ float(3.33)
+ [3]=>
+ float(4.8999992284)
+ ["f4"]=>
+ float(33333333.333333)
+}
+-- Iteration 7 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [2]=>
+ string(7) " world"
+ [3]=>
+ string(4) "pen
+"
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(6) " Hello"
+ ["red"]=>
+ string(6) "col or"
+ [4]=>
+ string(7) " world"
+ [5]=>
+ string(4) "pen
+"
+}
+-- Iteration 8 --
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [2]=>
+ string(9) "\v\fworld"
+ [3]=>
+ string(5) "pen\n"
+}
+int(7)
+array(7) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(7) "\tHello"
+ ["red"]=>
+ string(7) "col\tor"
+ [4]=>
+ string(9) "\v\fworld"
+ [5]=>
+ string(5) "pen\n"
+}
+-- Iteration 9 --
+int(3)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+int(5)
+array(5) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(5) "hello"
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+-- Iteration 10 --
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ object(classA)#%d (0) {
+ }
+ ["unset"]=>
+ NULL
+ ["resource"]=>
+ resource(%d) of type (stream)
+}
+-- Iteration 11 --
+int(9)
+array(9) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ object(classA)#%d (0) {
+ }
+ [3]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ ["float"]=>
+ float(444.432)
+ ["unset"]=>
+ NULL
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+int(11)
+array(11) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ string(5) "hello"
+ [4]=>
+ object(classA)#%d (0) {
+ }
+ [5]=>
+ string(5) "fruit"
+ ["resource"]=>
+ resource(%d) of type (stream)
+ ["int"]=>
+ int(133)
+ ["float"]=>
+ float(444.432)
+ ["unset"]=>
+ NULL
+ ["heredoc"]=>
+ string(11) "Hello world"
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation6.phpt b/ext/standard/tests/array/array_unshift_variation6.phpt
new file mode 100644
index 000000000..47da53be9
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation6.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test array_unshift() function : usage variations - two dimensional arrays for 'array' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by giving two-dimensional
+ * arrays and also sub-arrays within the two-dimensional array for $array argument.
+ * The $var argument passed is a fixed value
+*/
+
+echo "*** Testing array_unshift() : two dimensional arrays for \$array argument ***\n";
+
+// initializing $var argument
+$var = 10;
+
+// two-dimensional array to be passed to $array argument
+$two_dimensional_array = array(
+
+ // associative array
+ array('color' => 'red', 'item' => 'pen', 'place' => 'LA'),
+
+ // numeric array
+ array(1, 2, 3, 4, 5),
+
+ // combination of numeric and associative arrays
+ array('a' => 'green', 'red', 'brown', 33, 88, 'orange', 'item' => 'ball')
+);
+
+/* Passing the entire $two_dimensional_array to $array */
+
+/* With default argument */
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+$temp_array = $two_dimensional_array;
+var_dump( array_unshift($temp_array, $var) ); // whole 2-d array
+
+// dumps the resulting array
+var_dump($temp_array);
+
+/* With optional arguments */
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+$temp_array = $two_dimensional_array;
+var_dump( array_unshift($temp_array, $var, "hello", 'world') ); // whole 2-d array
+
+// dumps the resulting array
+var_dump($temp_array);
+
+/* Passing the sub-array within the $two_dimensional_array to $array argument */
+
+/* With default argument */
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+$temp_array = $two_dimensional_array[0];
+var_dump( array_unshift($temp_array, $var) ); // sub array
+
+// dumps the resulting array
+var_dump($temp_array);
+
+/* With optional arguments */
+// returns element count in the resulting array after arguments are pushed to
+// beginning of the given array
+$temp_array = $two_dimensional_array[0];
+var_dump( array_unshift($temp_array, $var, "hello", 'world') ); // sub array
+
+// dumps the resulting array
+var_dump($temp_array);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : two dimensional arrays for $array argument ***
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ [1]=>
+ array(3) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+ }
+ [2]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+ [3]=>
+ array(7) {
+ ["a"]=>
+ string(5) "green"
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "brown"
+ [2]=>
+ int(33)
+ [3]=>
+ int(88)
+ [4]=>
+ string(6) "orange"
+ ["item"]=>
+ string(4) "ball"
+ }
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ [3]=>
+ array(3) {
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+ }
+ [4]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ }
+ [5]=>
+ array(7) {
+ ["a"]=>
+ string(5) "green"
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "brown"
+ [2]=>
+ int(33)
+ [3]=>
+ int(88)
+ [4]=>
+ string(6) "orange"
+ ["item"]=>
+ string(4) "ball"
+ }
+}
+int(4)
+array(4) {
+ [0]=>
+ int(10)
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+}
+int(6)
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["color"]=>
+ string(3) "red"
+ ["item"]=>
+ string(3) "pen"
+ ["place"]=>
+ string(2) "LA"
+}
+Done
diff --git a/ext/standard/tests/array/array_unshift_variation7.phpt b/ext/standard/tests/array/array_unshift_variation7.phpt
new file mode 100644
index 000000000..08f4db081
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation7.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test array_unshift() function : usage variations - double quoted strings for 'var' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * double quoted strings for $var argument that is prepended to the array
+ * passed through $array argument
+*/
+
+echo "*** Testing array_unshift() : double quoted strings for \$var argument ***\n";
+
+// array to be passed to $array argument
+$array = array('f' => "first", "s" => 'second', 1, 2.222);
+
+// different variations of double quoted strings to be passed to $var argument
+$vars = array (
+ "\$ -> This represents the dollar sign. hello dollar!!!",
+ "\t\r\v The quick brown fo\fx jumped over the lazy dog",
+ "This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\\",
+ "hello world\\t",
+ "This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t"
+);
+
+// loop through the various elements of $arrays to test array_unshift()
+$iterator = 1;
+foreach($vars as $var) {
+ echo "-- Iteration $iterator --\n";
+ $temp_array = $array; // assign $array to another temporary $temp_array
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ var_dump( array_unshift($temp_array, $var) );
+
+// dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : double quoted strings for $var argument ***
+-- Iteration 1 --
+int(5)
+array(5) {
+ [0]=>
+ string(53) "$ -> This represents the dollar sign. hello dollar!!!"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(53) "$ -> This represents the dollar sign. hello dollar!!!"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 2 --
+int(5)
+array(5) {
+ [0]=>
+ string(49) " The quick brown fo x jumped over the lazy dog"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(49) " The quick brown fo x jumped over the lazy dog"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 3 --
+int(5)
+array(5) {
+ [0]=>
+ string(55) "This is a text with special chars: \!\@\#$\%\^\&\*\(\)\"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(55) "This is a text with special chars: \!\@\#$\%\^\&\*\(\)\"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ string(13) "hello world\t"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(13) "hello world\t"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 5 --
+int(5)
+array(5) {
+ [0]=>
+ string(70) "This is a text in bold letters \s\malong with slashes
+ : HELLO WORLD "
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(70) "This is a text in bold letters \s\malong with slashes
+ : HELLO WORLD "
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unshift_variation8.phpt b/ext/standard/tests/array/array_unshift_variation8.phpt
new file mode 100644
index 000000000..b9c25d3ca
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation8.phpt
@@ -0,0 +1,214 @@
+--TEST--
+Test array_unshift() function : usage variations - single quoted strings for 'var' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * single quoted strings for $var argument that is prepended to the array
+ * passed through $array argument
+*/
+
+echo "*** Testing array_unshift() : single quoted strings for \$var argument ***\n";
+
+// array to be passed to $array argument
+$array = array('f' => "first", "s" => 'second', 1, 2.222);
+
+// different variations of single quoted strings to be passed to $var argument
+$vars = array (
+ '\$ -> This represents the dollar sign. hello dollar!!!',
+ '\t\r\v The quick brown fo\fx jumped over the lazy dog',
+ 'This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\\',
+ 'hello world\\t',
+ 'This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t'
+);
+
+// loop through the various elements of $arrays to test array_unshift()
+$iterator = 1;
+foreach($vars as $var) {
+ echo "-- Iteration $iterator --\n";
+ $temp_array = $array; // assign $array to another temporary $temp_array
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with optional arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : single quoted strings for $var argument ***
+-- Iteration 1 --
+int(5)
+array(5) {
+ [0]=>
+ string(54) "\$ -> This represents the dollar sign. hello dollar!!!"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(54) "\$ -> This represents the dollar sign. hello dollar!!!"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 2 --
+int(5)
+array(5) {
+ [0]=>
+ string(53) "\t\r\v The quick brown fo\fx jumped over the lazy dog"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(53) "\t\r\v The quick brown fo\fx jumped over the lazy dog"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 3 --
+int(5)
+array(5) {
+ [0]=>
+ string(56) "This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(56) "This is a text with special chars: \!\@\#\$\%\^\&\*\(\)\"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ string(13) "hello world\t"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(13) "hello world\t"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 5 --
+int(5)
+array(5) {
+ [0]=>
+ string(74) "This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(74) "This is \ta text in bold letters\r\s\malong with slashes\n : HELLO WORLD\t"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/array_unshift_variation9.phpt b/ext/standard/tests/array/array_unshift_variation9.phpt
new file mode 100644
index 000000000..a667e6da0
--- /dev/null
+++ b/ext/standard/tests/array/array_unshift_variation9.phpt
@@ -0,0 +1,309 @@
+--TEST--
+Test array_unshift() function : usage variations - heredoc strings for 'var' argument
+--FILE--
+<?php
+/* Prototype : int array_unshift(array $array, mixed $var [, mixed ...])
+ * Description: Pushes elements onto the beginning of the array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing the functionality of array_unshift() by passing different
+ * heredoc strings for $var argument that is prepended to the array
+ * passed through $array argument
+*/
+
+echo "*** Testing array_unshift() : heredoc strings for \$var argument ***\n";
+
+// heredoc with empty value
+$empty_string = <<<EOT
+EOT;
+
+// heredoc with blank line
+$blank_line = <<<EOT
+
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+hello\r world\t
+1111\t\t != 2222\v\v
+heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
+EOT;
+
+// heredoc with numeric values
+$numeric_string = <<<EOT
+11 < 12. 123 >22
+2222 != 1111.\t 0000 = 0000\n
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+This's a string with quotes:
+"strings in double quote";
+'strings in single quote';
+this\line is single quoted /with\slashes
+EOT;
+
+// array to be passed to $array argument
+$array = array('f' => "first", "s" => 'second', 1, 2.222);
+
+// different heredoc strings to be passed to $var argument
+$vars = array(
+ $empty_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// loop through the various elements of $arrays to test array_unshift()
+$iterator = 1;
+foreach($vars as $var) {
+ echo "-- Iteration $iterator --\n";
+ $temp_array = $array; // assign $array to another temporary $temp_array
+
+ /* with default argument */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ var_dump( array_unshift($temp_array, $var) );
+
+ // dump the resulting array
+ var_dump($temp_array);
+
+ /* with all possible arguments */
+ // returns element count in the resulting array after arguments are pushed to
+ // beginning of the given array
+ $temp_array = $array;
+ var_dump( array_unshift($temp_array, $var, "hello", 'world') );
+
+ // dump the resulting array
+ var_dump($temp_array);
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing array_unshift() : heredoc strings for $var argument ***
+-- Iteration 1 --
+int(5)
+array(5) {
+ [0]=>
+ string(0) ""
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 2 --
+int(5)
+array(5) {
+ [0]=>
+ string(1) "
+"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(1) "
+"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 3 --
+int(5)
+array(5) {
+ [0]=>
+ string(86) "hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(86) "hello world
+The big brown fox jumped over;
+the lazy dog
+This is a double quoted string"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 4 --
+int(5)
+array(5) {
+ [0]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(88) "hello world
+1111 != 2222
+heredoc
+double quoted string. with different white spaces"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 5 --
+int(5)
+array(5) {
+ [0]=>
+ string(44) "11 < 12. 123 >22
+2222 != 1111. 0000 = 0000
+"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(44) "11 < 12. 123 >22
+2222 != 1111. 0000 = 0000
+"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+-- Iteration 6 --
+int(5)
+array(5) {
+ [0]=>
+ string(123) "This's a string with quotes:
+"strings in double quote";
+'strings in single quote';
+this\line is single quoted /with\slashes"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [1]=>
+ int(1)
+ [2]=>
+ float(2.222)
+}
+int(7)
+array(7) {
+ [0]=>
+ string(123) "This's a string with quotes:
+"strings in double quote";
+'strings in single quote';
+this\line is single quoted /with\slashes"
+ [1]=>
+ string(5) "hello"
+ [2]=>
+ string(5) "world"
+ ["f"]=>
+ string(5) "first"
+ ["s"]=>
+ string(6) "second"
+ [3]=>
+ int(1)
+ [4]=>
+ float(2.222)
+}
+Done
diff --git a/ext/standard/tests/array/asort_basic.phpt b/ext/standard/tests/array/asort_basic.phpt
new file mode 100644
index 000000000..13fa4f794
--- /dev/null
+++ b/ext/standard/tests/array/asort_basic.phpt
@@ -0,0 +1,133 @@
+--TEST--
+Test asort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing integer/string arrays to check the basic functionality
+ * with following flag values.
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing asort() : basic functionality ***\n";
+
+// an array containing unsorted string values with indices
+$unsorted_strings = array( "l" => "lemon", "o" => "orange", "b" => "banana" );
+// an array containing unsorted numeric values with indices
+$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 );
+
+echo "\n-- Testing asort() by supplying string array, 'flag' value is default --\n";
+$temp_array = $unsorted_strings;
+var_dump( asort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying numeric array, 'flag' value is default --\n";
+$temp_array = $unsorted_numerics;
+var_dump( asort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_strings;
+var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying numeric array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_numerics;
+var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying string array, 'flag' = SORT_STRING --\n";
+$temp_array = $unsorted_strings;
+var_dump( asort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : basic functionality ***
+
+-- Testing asort() by supplying string array, 'flag' value is default --
+bool(true)
+array(3) {
+ ["b"]=>
+ string(6) "banana"
+ ["l"]=>
+ string(5) "lemon"
+ ["o"]=>
+ string(6) "orange"
+}
+
+-- Testing asort() by supplying numeric array, 'flag' value is default --
+bool(true)
+array(4) {
+ [4]=>
+ int(22)
+ [2]=>
+ int(33)
+ [1]=>
+ int(100)
+ [3]=>
+ int(555)
+}
+
+-- Testing asort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ ["b"]=>
+ string(6) "banana"
+ ["l"]=>
+ string(5) "lemon"
+ ["o"]=>
+ string(6) "orange"
+}
+
+-- Testing asort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [4]=>
+ int(22)
+ [2]=>
+ int(33)
+ [1]=>
+ int(100)
+ [3]=>
+ int(555)
+}
+
+-- Testing asort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ ["b"]=>
+ string(6) "banana"
+ ["l"]=>
+ string(5) "lemon"
+ ["o"]=>
+ string(6) "orange"
+}
+
+-- Testing asort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [4]=>
+ int(22)
+ [2]=>
+ int(33)
+ [1]=>
+ int(100)
+ [3]=>
+ int(555)
+}
+Done
diff --git a/ext/standard/tests/array/asort_error.phpt b/ext/standard/tests/array/asort_error.phpt
new file mode 100644
index 000000000..ef2329585
--- /dev/null
+++ b/ext/standard/tests/array/asort_error.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test asort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool asort(array &array_arg [, int sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing asort() function with all possible error conditions
+*/
+
+echo "*** Testing asort() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing asort() function with Zero arguments --\n";
+var_dump( asort() );
+
+//Test asort with more than the expected number of arguments
+echo "\n-- Testing asort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and setting all possible flag values
+foreach($flags as $key => $flag){
+ echo "\nSort flag = $key\n";
+ var_dump( asort($array_arg,$flag, $extra_arg) );
+
+ // dump the input array to ensure that it wasn't changed
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing asort() : error conditions ***
+
+-- Testing asort() function with Zero arguments --
+
+Warning: asort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing asort() function with more than expected no. of arguments --
+
+Sort flag = SORT_REGULAR
+
+Warning: asort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_STRING
+
+Warning: asort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_NUMERIC
+
+Warning: asort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/asort_object1.phpt b/ext/standard/tests/array/asort_object1.phpt
new file mode 100644
index 000000000..ad54675d6
--- /dev/null
+++ b/ext/standard/tests/array/asort_object1.phpt
@@ -0,0 +1,245 @@
+--TEST--
+Test asort() function : object functionality - sort objects
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ * 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing asort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_asort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_asort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 1 => new for_integer_asort(11), 2 => new for_integer_asort(66),
+ 3 => new for_integer_asort(23), 4 => new for_integer_asort(-5),
+ 5 => new for_integer_asort(0.001), 6 => new for_integer_asort(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "a" => new for_string_asort("axx"), "b" => new for_string_asort("t"),
+ "c" => new for_string_asort("w"), "d" => new for_string_asort("py"),
+ "e" => new for_string_asort("apple"), "f" => new for_string_asort("Orange"),
+ "g" => new for_string_asort("Lemon"), "h" => new for_string_asort("aPPle")
+);
+
+
+echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing asort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(asort($temp_array) );
+var_dump($temp_array);
+
+// testing asort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(asort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing asort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(asort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing asort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(asort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : object functionality ***
+
+-- Testing asort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(6) {
+ [4]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [6]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [5]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [1]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [3]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [2]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ ["g"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ ["f"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["h"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["e"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["a"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["d"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["b"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["c"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+
+-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(6) {
+ [4]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [6]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [5]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [1]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [3]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [2]=>
+ object(for_integer_asort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ ["g"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ ["f"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ ["h"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ ["e"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ ["a"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ ["d"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ ["b"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ ["c"]=>
+ object(for_string_asort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/asort_object2.phpt b/ext/standard/tests/array/asort_object2.phpt
new file mode 100644
index 000000000..aa5d14c80
--- /dev/null
+++ b/ext/standard/tests/array/asort_object2.phpt
@@ -0,0 +1,253 @@
+--TEST--
+Test asort() function : object functionality - sorting objects with diff. accessibility of member vars
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing integer/string object arrays with following flag values
+ * 1. Defualt flag value
+ 2. SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing asort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_asort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_asort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+}
+
+// array of integer objects
+$unsorted_int_obj = array (
+ 1 => new for_integer_asort(11, 33,2), 2 => new for_integer_asort(44, 66,3),
+ 3 => new for_integer_asort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4),
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ "a" => new for_string_asort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"),
+ "c" => new for_string_asort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"),
+);
+
+
+echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is default --\n";
+
+// testing asort() function by supplying integer object array, flag value is default
+$temp_array = $unsorted_int_obj;
+var_dump(asort($temp_array) );
+var_dump($temp_array);
+
+// testing asort() function by supplying string object array, flag value is default
+$temp_array = $unsorted_str_obj;
+var_dump(asort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing asort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(asort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing asort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(asort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : object functionality ***
+
+-- Testing asort() by supplying various object arrays, 'flag' value is default --
+bool(true)
+array(4) {
+ [4]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(-88)
+ ["private_class_value:private"]=>
+ int(-5)
+ ["protected_class_value:protected"]=>
+ int(-4)
+ }
+ [1]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(11)
+ ["private_class_value:private"]=>
+ int(33)
+ ["protected_class_value:protected"]=>
+ int(2)
+ }
+ [3]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(23)
+ ["private_class_value:private"]=>
+ int(32)
+ ["protected_class_value:protected"]=>
+ int(6)
+ }
+ [2]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(44)
+ ["private_class_value:private"]=>
+ int(66)
+ ["protected_class_value:protected"]=>
+ int(3)
+ }
+}
+bool(true)
+array(4) {
+ ["d"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "PY"
+ ["private_class_value:private"]=>
+ string(2) "py"
+ ["protected_class_value:protected"]=>
+ string(1) "s"
+ }
+ ["b"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "T"
+ ["private_class_value:private"]=>
+ string(1) "t"
+ ["protected_class_value:protected"]=>
+ string(1) "q"
+ }
+ ["a"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(1) "d"
+ }
+ ["c"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+}
+
+-- Testing asort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [4]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(-88)
+ ["private_class_value:private"]=>
+ int(-5)
+ ["protected_class_value:protected"]=>
+ int(-4)
+ }
+ [1]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(11)
+ ["private_class_value:private"]=>
+ int(33)
+ ["protected_class_value:protected"]=>
+ int(2)
+ }
+ [3]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(23)
+ ["private_class_value:private"]=>
+ int(32)
+ ["protected_class_value:protected"]=>
+ int(6)
+ }
+ [2]=>
+ object(for_integer_asort)#%d (3) {
+ ["public_class_value"]=>
+ int(44)
+ ["private_class_value:private"]=>
+ int(66)
+ ["protected_class_value:protected"]=>
+ int(3)
+ }
+}
+bool(true)
+array(4) {
+ ["d"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "PY"
+ ["private_class_value:private"]=>
+ string(2) "py"
+ ["protected_class_value:protected"]=>
+ string(1) "s"
+ }
+ ["b"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "T"
+ ["private_class_value:private"]=>
+ string(1) "t"
+ ["protected_class_value:protected"]=>
+ string(1) "q"
+ }
+ ["a"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(1) "d"
+ }
+ ["c"]=>
+ object(for_string_asort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation1.phpt b/ext/standard/tests/array/asort_variation1.phpt
new file mode 100644
index 000000000..5420f0524
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation1.phpt
@@ -0,0 +1,399 @@
+--TEST--
+Test asort() function : usage variations - unexpected values for 'array_arg' argument
+--FILE--
+<?php
+/* Prototype : bool asort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different unexpected values for array argument with following flag values.
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of values with indices to iterate over
+$unexpected_values = array (
+
+ // int data
+ 0 => 0,
+ 1 => 1,
+ 2 => 12345,
+ 3 => -2345,
+
+ // float data
+ 4 => 10.5,
+ 5 => -10.5,
+ 6 => 10.5e3,
+ 7 => 10.6E-2,
+ 8 => .5,
+
+ // null data
+ 9 => NULL,
+ 10 => null,
+
+ // boolean data
+ 11 => true,
+ 12 => false,
+ 13 => TRUE,
+ 14 => FALSE,
+
+ // empty data
+ 15 => "",
+ 16 => '',
+
+ // string data
+ 17 => "string",
+ 18 => 'string',
+
+ // object data
+ 19 => new stdclass(),
+
+ // undefined data
+ 20 => @undefined_var,
+
+ // unset data
+ 21 => @unset_var,
+
+ // resource variable
+ 22 => $fp
+
+);
+
+// loop though each element of the array and check the working of asort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing asort() by supplying different unexpected values for 'array' argument --\n";
+echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ var_dump( asort($value) ); // expecting : bool(false)
+ var_dump( asort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( asort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( asort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: asort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: asort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: asort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/asort_variation10.phpt b/ext/standard/tests/array/asort_variation10.phpt
new file mode 100644
index 000000000..f51945bf9
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation10.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test asort() function : usage variations - sort octal values
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different octal array for $array argument with following flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// an array contains unsorted octal values
+$unsorted_oct_array = array (
+ 01235 => 01235, 0321 => 0321, 0345 => 0345, 066 => 066, 0772 => 0772,
+ 077 => 077, -066 => -066, -0345 => -0345, 0 => 0
+);
+
+echo "\n-- Testing asort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( asort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump( asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-229)
+ [-54]=>
+ int(-54)
+ [0]=>
+ int(0)
+ [54]=>
+ int(54)
+ [63]=>
+ int(63)
+ [209]=>
+ int(209)
+ [229]=>
+ int(229)
+ [506]=>
+ int(506)
+ [669]=>
+ int(669)
+}
+
+-- Testing asort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-229)
+ [-54]=>
+ int(-54)
+ [0]=>
+ int(0)
+ [54]=>
+ int(54)
+ [63]=>
+ int(63)
+ [209]=>
+ int(209)
+ [229]=>
+ int(229)
+ [506]=>
+ int(506)
+ [669]=>
+ int(669)
+}
+
+-- Testing asort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [-229]=>
+ int(-229)
+ [-54]=>
+ int(-54)
+ [0]=>
+ int(0)
+ [54]=>
+ int(54)
+ [63]=>
+ int(63)
+ [209]=>
+ int(209)
+ [229]=>
+ int(229)
+ [506]=>
+ int(506)
+ [669]=>
+ int(669)
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation11.phpt b/ext/standard/tests/array/asort_variation11.phpt
new file mode 100644
index 000000000..fca91a968
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/asort_variation2.phpt b/ext/standard/tests/array/asort_variation2.phpt
new file mode 100644
index 000000000..07dfe9b81
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation2.phpt
@@ -0,0 +1,308 @@
+--TEST--
+Test asort() function : usage variations - unexpected values for 'sort_flags' argument
+--FILE--
+<?php
+/* Prototype : proto bool asort(array &array_arg [, int sort_flags])
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// temperory array for checking unexpected behavior
+$unsorted_values = array(1 => 10, 2 => 2, 3 => 45);
+
+//array of values to iterate over
+$unexpected_values = array(
+
+ // int data
+/*1*/ -2345,
+
+ // float data
+/*2*/ 10.5,
+ -10.5,
+ 10.5e2,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*7*/ NULL,
+ null,
+
+ // boolean data
+/*9*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*13*/ "",
+ '',
+
+ // string data
+/*15*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var,
+
+ // resource variable
+/*19*/ $fp
+
+);
+
+// loop though each element of the array and check the working of asort()
+// when $flag arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing asort() by supplying different unexpected values for 'sort_flags' argument --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ $temp_array = $unsorted_values;
+ var_dump( asort($temp_array, $value) );
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying different unexpected values for 'sort_flags' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 4 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 5 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 6 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 8 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 9 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 10 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 11 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 12 --
+bool(true)
+array(3) {
+ [2]=>
+ int(2)
+ [1]=>
+ int(10)
+ [3]=>
+ int(45)
+}
+-- Iteration 13 --
+
+Warning: asort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 14 --
+
+Warning: asort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 15 --
+
+Warning: asort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 16 --
+
+Warning: asort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 17 --
+
+Warning: asort() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 18 --
+
+Warning: asort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 19 --
+
+Warning: asort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+-- Iteration 20 --
+
+Warning: asort() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+array(3) {
+ [1]=>
+ int(10)
+ [2]=>
+ int(2)
+ [3]=>
+ int(45)
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation3.phpt b/ext/standard/tests/array/asort_variation3.phpt
new file mode 100644
index 000000000..25f40d32a
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation3.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test asort() function : usage variations - sort integer/float values
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing different integer/float value arrays for $array argument with following values
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// group of various arrays with indices
+$various_arrays = array(
+ // negative/posative integer array
+ array(1 => 11, 2 => -11, 3 => 21, 4 => -21, 5 => 31, 6 => -31, 7 => 0, 8 => 41, 10 =>-41),
+
+ // float value array
+ array(1 => 10.5, 2 => -10.5, 3 => 10.5e2, 4 => 10.6E-2, 5 => .5, 6 => .0001, 7 => -.1),
+
+ // mixed value array
+ array(1 => .0001, 2 => .0021, 3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, 8 => -.9, 9 => 10.6E-2, 10 => -10.6E-2, 11 => 33),
+
+ // array values contains minimum and maximum ranges
+ array(1 => 2147483647, 2 => 2147483648, 3 => -2147483647, 4 => -2147483648, 5 => -0, 6 => 0, 7 => -2147483649)
+);
+
+// set of possible flag values
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing asort() by supplying various integer/float arrays --\n";
+
+// loop through to test asort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flag_value array and setting all possible flag values
+ foreach($flag_value as $key => $flag){
+ echo "- Sort_flag = $key -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(9) {
+ [10]=>
+ int(-41)
+ [6]=>
+ int(-31)
+ [4]=>
+ int(-21)
+ [2]=>
+ int(-11)
+ [7]=>
+ int(0)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [8]=>
+ int(41)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [10]=>
+ int(-41)
+ [6]=>
+ int(-31)
+ [4]=>
+ int(-21)
+ [2]=>
+ int(-11)
+ [7]=>
+ int(0)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [8]=>
+ int(41)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [10]=>
+ int(-41)
+ [6]=>
+ int(-31)
+ [4]=>
+ int(-21)
+ [2]=>
+ int(-11)
+ [7]=>
+ int(0)
+ [1]=>
+ int(11)
+ [3]=>
+ int(21)
+ [5]=>
+ int(31)
+ [8]=>
+ int(41)
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(7) {
+ [2]=>
+ float(-10.5)
+ [7]=>
+ float(-0.1)
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [5]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [2]=>
+ float(-10.5)
+ [7]=>
+ float(-0.1)
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [5]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [2]=>
+ float(-10.5)
+ [7]=>
+ float(-0.1)
+ [6]=>
+ float(0.0001)
+ [4]=>
+ float(0.106)
+ [5]=>
+ float(0.5)
+ [1]=>
+ float(10.5)
+ [3]=>
+ float(1050)
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(11) {
+ [4]=>
+ int(-1)
+ [8]=>
+ float(-0.9)
+ [10]=>
+ float(-0.106)
+ [3]=>
+ float(-0.01)
+ [5]=>
+ int(0)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [6]=>
+ float(0.09)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [11]=>
+ int(33)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [4]=>
+ int(-1)
+ [8]=>
+ float(-0.9)
+ [10]=>
+ float(-0.106)
+ [3]=>
+ float(-0.01)
+ [5]=>
+ int(0)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [6]=>
+ float(0.09)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [11]=>
+ int(33)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [4]=>
+ int(-1)
+ [8]=>
+ float(-0.9)
+ [10]=>
+ float(-0.106)
+ [3]=>
+ float(-0.01)
+ [5]=>
+ int(0)
+ [1]=>
+ float(0.0001)
+ [2]=>
+ float(0.0021)
+ [6]=>
+ float(0.09)
+ [9]=>
+ float(0.106)
+ [7]=>
+ int(2)
+ [11]=>
+ int(33)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(7) {
+ [7]=>
+ %s(-2147483649)
+ [4]=>
+ %s(-2147483648)
+ [3]=>
+ int(-2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ %s(2147483648)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [7]=>
+ %s(-2147483649)
+ [4]=>
+ %s(-2147483648)
+ [3]=>
+ int(-2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ %s(2147483648)
+}
+- Sort_flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [7]=>
+ %s(-2147483649)
+ [4]=>
+ %s(-2147483648)
+ [3]=>
+ int(-2147483647)
+ [6]=>
+ int(0)
+ [5]=>
+ int(0)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ %s(2147483648)
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation4.phpt b/ext/standard/tests/array/asort_variation4.phpt
new file mode 100644
index 000000000..9fd76009f
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation4.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test asort() function : usage variations - sort reference variables
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing reference variable array with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() :usage variations ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( 1 => &$value1 , 2 => &$value2, 3 => &$value3);
+
+echo "\n-- Testing asort() by supplying reference variable array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( asort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( asort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing asort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() :usage variations ***
+
+-- Testing asort() by supplying reference variable array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ [2]=>
+ &int(33)
+ [1]=>
+ &int(100)
+ [3]=>
+ &int(555)
+}
+
+-- Testing asort() by supplying reference variable array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [2]=>
+ &int(33)
+ [1]=>
+ &int(100)
+ [3]=>
+ &int(555)
+}
+
+-- Testing asort() by supplying reference variable array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(3) {
+ [2]=>
+ &int(33)
+ [1]=>
+ &int(100)
+ [3]=>
+ &int(555)
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation5.phpt b/ext/standard/tests/array/asort_variation5.phpt
new file mode 100644
index 000000000..faf7a5de5
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation5.phpt
@@ -0,0 +1,242 @@
+--TEST--
+Test asort() function : usage variations - sort strings
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different string arrays for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+$various_arrays = array (
+ // group of escape sequences
+ array ("null"=> null, "NULL" => NULL, "\a" => "\a", "\cx" => "\cx", "\e" => "\e",
+ "\f" => "\f", "\n" =>"\n", "\r" => "\r", "\t" => "\t", "\xhh" => "\xhh",
+ "\ddd" => "\ddd", "\v" => "\v"
+ ),
+
+ // array contains combination of capital/small letters
+ array ('l' => "lemoN", 'O' => "Orange", 'b' => "banana", 'a' => "apple", 'Te' => "Test",
+ 'T' => "TTTT", 't' => "ttt", 'w' => "ww", 'x' => "x", 'X' => "X", 'o' => "oraNGe",
+ 'B' => "BANANA"
+ )
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+echo "\n-- Testing asort() by supplying various string arrays --\n";
+
+// loop through to test asort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and setting all possible flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort_flag = $key -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(12) {
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["\a"]=>
+ string(2) "\a"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\e"]=>
+ string(2) "\e"
+ ["\xhh"]=>
+ string(4) "\xhh"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["\a"]=>
+ string(2) "\a"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\e"]=>
+ string(2) "\e"
+ ["\xhh"]=>
+ string(4) "\xhh"
+}
+- Sort_flag = SORT_STRING -
+bool(true)
+array(12) {
+ ["null"]=>
+ NULL
+ ["NULL"]=>
+ NULL
+ [" "]=>
+ string(1) " "
+ ["
+"]=>
+ string(1) "
+"
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ [" "]=>
+ string(1) " "
+ ["\a"]=>
+ string(2) "\a"
+ ["\cx"]=>
+ string(3) "\cx"
+ ["\ddd"]=>
+ string(4) "\ddd"
+ ["\e"]=>
+ string(2) "\e"
+ ["\xhh"]=>
+ string(4) "\xhh"
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(12) {
+ ["B"]=>
+ string(6) "BANANA"
+ ["O"]=>
+ string(6) "Orange"
+ ["T"]=>
+ string(4) "TTTT"
+ ["Te"]=>
+ string(4) "Test"
+ ["X"]=>
+ string(1) "X"
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(6) "banana"
+ ["l"]=>
+ string(5) "lemoN"
+ ["o"]=>
+ string(6) "oraNGe"
+ ["t"]=>
+ string(3) "ttt"
+ ["w"]=>
+ string(2) "ww"
+ ["x"]=>
+ string(1) "x"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ ["B"]=>
+ string(6) "BANANA"
+ ["O"]=>
+ string(6) "Orange"
+ ["T"]=>
+ string(4) "TTTT"
+ ["Te"]=>
+ string(4) "Test"
+ ["X"]=>
+ string(1) "X"
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(6) "banana"
+ ["l"]=>
+ string(5) "lemoN"
+ ["o"]=>
+ string(6) "oraNGe"
+ ["t"]=>
+ string(3) "ttt"
+ ["w"]=>
+ string(2) "ww"
+ ["x"]=>
+ string(1) "x"
+}
+- Sort_flag = SORT_STRING -
+bool(true)
+array(12) {
+ ["B"]=>
+ string(6) "BANANA"
+ ["O"]=>
+ string(6) "Orange"
+ ["T"]=>
+ string(4) "TTTT"
+ ["Te"]=>
+ string(4) "Test"
+ ["X"]=>
+ string(1) "X"
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(6) "banana"
+ ["l"]=>
+ string(5) "lemoN"
+ ["o"]=>
+ string(6) "oraNGe"
+ ["t"]=>
+ string(3) "ttt"
+ ["w"]=>
+ string(2) "ww"
+ ["x"]=>
+ string(1) "x"
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation6.phpt b/ext/standard/tests/array/asort_variation6.phpt
new file mode 100644
index 000000000..117f30d38
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation6.phpt
@@ -0,0 +1,114 @@
+--TEST--
+Test asort() function : usage variations - sort hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $asort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing different hexa-decimal array for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// an array contains unsorted hexadecimal values
+// There are multiple keys which are duplicate and the later should be picked
+$unsorted_hex_array = array ( 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF => 0xFF, 0x2AA => 0x2AA, 0xBB => 0xBB,
+ 0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
+ );
+
+echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(asort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(asort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(asort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [-682]=>
+ int(-682)
+ [-255]=>
+ int(-255)
+ [0]=>
+ int(0)
+ [15]=>
+ int(15)
+ [187]=>
+ int(187)
+ [255]=>
+ int(255)
+ [427]=>
+ int(427)
+ [682]=>
+ int(682)
+ [4095]=>
+ int(4095)
+}
+
+-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [-682]=>
+ int(-682)
+ [-255]=>
+ int(-255)
+ [0]=>
+ int(0)
+ [15]=>
+ int(15)
+ [187]=>
+ int(187)
+ [255]=>
+ int(255)
+ [427]=>
+ int(427)
+ [682]=>
+ int(682)
+ [4095]=>
+ int(4095)
+}
+
+-- Testing asort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [-682]=>
+ int(-682)
+ [-255]=>
+ int(-255)
+ [0]=>
+ int(0)
+ [15]=>
+ int(15)
+ [187]=>
+ int(187)
+ [255]=>
+ int(255)
+ [427]=>
+ int(427)
+ [682]=>
+ int(682)
+ [4095]=>
+ int(4095)
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation7.phpt b/ext/standard/tests/array/asort_variation7.phpt
new file mode 100644
index 000000000..6050b8653
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation7.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test asort() function : usage variations - sort bool values
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: This function asorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing bool value array for $array argument with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (1 => true, 2 => false, 3 => TRUE, 4 => FALSE);
+
+echo "\n-- Testing asort() by supplying bool value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(asort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(asort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(asort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing asort() by supplying bool value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(asort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying bool value array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+
+-- Testing asort() by supplying bool value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+
+-- Testing asort() by supplying bool value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(4) {
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+
+-- Testing asort() by supplying bool value array, 'flag' value is SORT_STRING --
+bool(true)
+array(4) {
+ [4]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [1]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation8.phpt b/ext/standard/tests/array/asort_variation8.phpt
new file mode 100644
index 000000000..561cc7d70
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation8.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test asort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as default/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing asort() by providing arrays contains sub arrays for $array argument with flowing flag values
+ * flag value as default
+ * SORT_REGULAR - compare items normally
+ * Note: arrays are sorted based on total count of elements inside it, when all the elements are arrays
+*/
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// array of arrays
+$various_arrays = array (
+ // null array
+ "array[0]" => array(),
+
+ // array contains null sub array
+ "array[1]" => array( "sub_array[1][0]" => array() ),
+
+ // array of arrays along with some values
+ "array[2]" => array("data[2,0]" => 44, "data[2,1]" => 11, "sub_array[2][0] " => array(64,61) ),
+
+ // array contains sub arrays
+ "array[3]" => array ( "sub_array[3][0]" => array(33,-5,6), "sub_array[3][1]" => array(11),
+ "sub_array[3][2]" => array(22,-55), "sub_array[3][3]" => array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing asort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test asort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ // testing asort() function by supplying different arrays, flag value is default
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array) );
+ var_dump($temp_array);
+
+ // testing asort() function by supplying different arrays, flag value = SORT_REGULAR
+ echo "- Sort_flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying various arrays containing sub arrays --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(0) {
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(1) {
+ ["sub_array[1][0]"]=>
+ array(0) {
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ ["sub_array[1][0]"]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ ["data[2,1]"]=>
+ int(11)
+ ["data[2,0]"]=>
+ int(44)
+ ["sub_array[2][0] "]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["data[2,1]"]=>
+ int(11)
+ ["data[2,0]"]=>
+ int(44)
+ ["sub_array[2][0] "]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(4) {
+ ["sub_array[3][3]"]=>
+ array(0) {
+ }
+ ["sub_array[3][1]"]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ ["sub_array[3][2]"]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ ["sub_array[3][0]"]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["sub_array[3][3]"]=>
+ array(0) {
+ }
+ ["sub_array[3][1]"]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ ["sub_array[3][2]"]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ ["sub_array[3][0]"]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/asort_variation9.phpt b/ext/standard/tests/array/asort_variation9.phpt
new file mode 100644
index 000000000..d79b6fc4a
--- /dev/null
+++ b/ext/standard/tests/array/asort_variation9.phpt
@@ -0,0 +1,258 @@
+--TEST--
+Test asort() function : usage variations - sorting arrays with/without keys, 'sort_flags' as default/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool asort ( array &$array [, int $sort_flags] )
+ * Description: Sort an array and maintain index association.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing asort() by providing arrays with key values for $array argument with following flag values.
+ * 1.flag value as default
+ * 2.SORT_REGULAR - compare items normally
+ */
+
+echo "*** Testing asort() : usage variations ***\n";
+
+// list of arrays with/without key values
+$various_arrays = array (
+ array(5 => 55, 66, 22, 33, 11),
+ array ("a" => "orange", "banana", "c" => "apple"),
+ array(1, 2, 3, 4, 5, 6),
+ array("first", 5 => "second", "third"),
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ array('bar' => 'baz', "foo" => 1),
+ array('a'=>1,'b'=>array('e'=>2,'f'=>3),'c'=>array('g'=>4),'d'=>5),
+);
+
+$count = 1;
+echo "\n-- Testing asort() by supplying various arrays with key values --\n";
+
+// loop through to test asort() with different arrays,
+// to test the new keys for the elements in the sorted array
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With default sort_flag -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort_flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(asort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing asort() : usage variations ***
+
+-- Testing asort() by supplying various arrays with key values --
+
+-- Iteration 1 --
+- With default sort_flag -
+bool(true)
+array(5) {
+ [9]=>
+ int(11)
+ [7]=>
+ int(22)
+ [8]=>
+ int(33)
+ [5]=>
+ int(55)
+ [6]=>
+ int(66)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [9]=>
+ int(11)
+ [7]=>
+ int(22)
+ [8]=>
+ int(33)
+ [5]=>
+ int(55)
+ [6]=>
+ int(66)
+}
+
+-- Iteration 2 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ ["c"]=>
+ string(5) "apple"
+ [0]=>
+ string(6) "banana"
+ ["a"]=>
+ string(6) "orange"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ ["c"]=>
+ string(5) "apple"
+ [0]=>
+ string(6) "banana"
+ ["a"]=>
+ string(6) "orange"
+}
+
+-- Iteration 3 --
+- With default sort_flag -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+}
+
+-- Iteration 4 --
+- With default sort_flag -
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+}
+
+-- Iteration 5 --
+- With default sort_flag -
+bool(true)
+array(6) {
+ [4]=>
+ int(1)
+ [0]=>
+ int(1)
+ [8]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(13)
+ [9]=>
+ int(19)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [4]=>
+ int(1)
+ [0]=>
+ int(1)
+ [8]=>
+ int(1)
+ [1]=>
+ int(1)
+ [3]=>
+ int(13)
+ [9]=>
+ int(19)
+}
+
+-- Iteration 6 --
+- With default sort_flag -
+bool(true)
+array(2) {
+ ["bar"]=>
+ string(3) "baz"
+ ["foo"]=>
+ int(1)
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ ["bar"]=>
+ string(3) "baz"
+ ["foo"]=>
+ int(1)
+}
+
+-- Iteration 7 --
+- With default sort_flag -
+bool(true)
+array(4) {
+ ["a"]=>
+ int(1)
+ ["d"]=>
+ int(5)
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+}
+- Sort_flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ ["a"]=>
+ int(1)
+ ["d"]=>
+ int(5)
+ ["c"]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ ["b"]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/in_array_errors.phpt b/ext/standard/tests/array/in_array_errors.phpt
new file mode 100644
index 000000000..db0f98f2a
--- /dev/null
+++ b/ext/standard/tests/array/in_array_errors.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test in_array() function : error conditions
+--FILE--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+echo "\n*** Testing error conditions of in_array() ***\n";
+/* zero argument */
+var_dump( in_array() );
+
+/* unexpected no.of arguments in in_array() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( in_array(1, $var, 0, "test") );
+var_dump( in_array("test") );
+
+/* unexpected second argument in in_array() */
+$var="test";
+var_dump( in_array("test", $var) );
+var_dump( in_array(1, 123) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing error conditions of in_array() ***
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_search_variation.phpt b/ext/standard/tests/array/in_array_variation1.phpt
index c8ca2d7b7..470738bcf 100644
--- a/ext/standard/tests/array/array_search_variation.phpt
+++ b/ext/standard/tests/array/in_array_variation1.phpt
@@ -1,10 +1,17 @@
--TEST--
-Test array_search() and in_array() functions (variation)
+Test in_array() function : usage variations - different needdle values
--FILE--
<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
-/* checking for STRICT option in in_array() */
-echo "\n*** Testing STRICT option of in_array() on arrays ***\n";
+/* Test in_array() with different possible needle values */
+
+echo "*** Testing in_array() with different needle values ***\n";
$arrays = array (
array(0),
array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
@@ -55,7 +62,7 @@ foreach($arrays as $array) {
echo "Done\n";
?>
--EXPECTF--
-*** Testing STRICT option of in_array() on arrays ***
+*** Testing in_array() with different needle values ***
-- Iteration 1 --
bool(false)
bool(false)
diff --git a/ext/standard/tests/array/in_array_variation2.phpt b/ext/standard/tests/array/in_array_variation2.phpt
new file mode 100644
index 000000000..ee1267f4e
--- /dev/null
+++ b/ext/standard/tests/array/in_array_variation2.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test in_array() function : usage variations - different haystack values
+--FILE--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with different possible haystack values */
+
+echo "*** Testing in_array() with different haystack values ***\n";
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using in_array();
+ checking PHP type comparison tables
+*/
+$counter = 1;
+foreach($array_type as $type) {
+ echo "-- Iteration $counter --\n";
+ //loose type checking
+ var_dump( in_array($type,$misc_array ) );
+ //strict type checking
+ var_dump( in_array($type,$misc_array,true) );
+ //loose type checking
+ var_dump( in_array($type,$misc_array,false) );
+ $counter++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing in_array() with different haystack values ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt
new file mode 100644
index 000000000..47831e3bb
--- /dev/null
+++ b/ext/standard/tests/array/in_array_variation3.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test in_array() function : usage variations - haystack as sub-array/object
+--FILE--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with haystack as sub-array and object */
+
+/* checking for sub-arrays with in_array() */
+echo "*** Testing sub-arrays with in_array() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "two", "three" => 3),
+ 4 => "four",
+ "five" => 5,
+ array('', 'i')
+);
+var_dump( in_array("four", $sub_array) );
+//checking for element in a sub-array
+var_dump( in_array(3, $sub_array[1]) );
+var_dump( in_array(array('','i'), $sub_array) );
+
+/* checking for objects in in_array() */
+echo "\n*** Testing objects with in_array() ***\n";
+class in_array_check {
+ public $array_var = array(1=>"one", "two"=>2, 3=>3);
+ public function foo() {
+ echo "Public function\n";
+ }
+}
+
+$in_array_obj = new in_array_check(); //creating new object
+//error: as wrong datatype for second argument
+var_dump( in_array("array_var", $in_array_obj) );
+//error: as wrong datatype for second argument
+var_dump( in_array("foo", $in_array_obj) );
+//element found as "one" exists in array $array_var
+var_dump( in_array("one", $in_array_obj->array_var) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sub-arrays with in_array() ***
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing objects with in_array() ***
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt
new file mode 100644
index 000000000..b88a5a2d6
--- /dev/null
+++ b/ext/standard/tests/array/in_array_variation4.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test in_array() function : usage variations - haystack as resource/multi dimentional array
+--FILE--
+<?php
+/*
+ * Prototype : bool in_array ( mixed $needle, array $haystack [, bool $strict] )
+ * Description: Searches haystack for needle and returns TRUE
+ * if it is found in the array, FALSE otherwise.
+ * Source Code: ext/standard/array.c
+*/
+
+/* Test in_array() with haystack as resouce and multidimentional arrays */
+
+/* checking for Resources */
+echo "*** Testing resource type with in_array() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( in_array($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( in_array((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with in_array() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( in_array("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( in_array("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( in_array(0, array("this")) );
+// false in strict mode
+var_dump( in_array(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( in_array("this", array(0)) );
+// false in stric mode
+var_dump( in_array("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( in_array(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( in_array('123abc', array(123)) );
+var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing resource type with in_array() ***
+bool(true)
+bool(false)
+
+*** Testing miscelleneos inputs with in_array() ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt
index 1495a78dc..6293dee37 100644
--- a/ext/standard/tests/array/max.phpt
+++ b/ext/standard/tests/array/max.phpt
@@ -20,13 +20,13 @@ var_dump(max(0, true, false, true));
echo "Done\n";
?>
--EXPECTF--
-Warning: max(): Atleast one value should be passed in %s on line %d
+Warning: max(): At least one value should be passed in %s on line %d
NULL
Warning: Wrong parameter count for max() in %s on line %d
NULL
-Warning: max(): Array must contain atleast one element in %s on line %d
+Warning: max(): Array must contain at least one element in %s on line %d
bool(false)
Warning: Wrong parameter count for max() in %s on line %d
diff --git a/ext/standard/tests/array/max_basic.phpt b/ext/standard/tests/array/max_basic.phpt
new file mode 100644
index 000000000..62eb2271a
--- /dev/null
+++ b/ext/standard/tests/array/max_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test return type and value for expected input max()
+--FILE--
+<?php
+/*
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing sequences of numbers ***\n";
+
+var_dump(max(2,1,2));
+var_dump(max(-2,1,2));
+var_dump(max(2.1,2.11,2.09));
+var_dump(max("", "t", "b"));
+var_dump(max(false, true, false));
+var_dump(max(true, false, true));
+var_dump(max(1, true, false, true));
+var_dump(max(0, true, false, true));
+var_dump(max(0, 1, array(2,3)));
+
+echo "\nDone\n";
+?>
+--EXPECT--
+
+*** Testing sequences of numbers ***
+int(2)
+int(2)
+float(2.11)
+string(1) "t"
+bool(true)
+bool(true)
+int(1)
+bool(true)
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/max_error.phpt b/ext/standard/tests/array/max_error.phpt
new file mode 100644
index 000000000..cbc36f494
--- /dev/null
+++ b/ext/standard/tests/array/max_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test wrong number of arguments for min()
+--FILE--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+
+echo "\n*** Testing Error Conditions ***\n";
+
+var_dump(max());
+var_dump(max(1));
+var_dump(max(array()));
+var_dump(max(new stdclass));
+
+?>
+--EXPECTF--
+
+*** Testing Error Conditions ***
+
+Warning: max(): At least one %s on line %d
+NULL
+
+Warning: Wrong parameter count for max() in %s on line %d
+NULL
+
+Warning: max(): Array must contain at least one element in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for max() in %s on line %d
+NULL
diff --git a/ext/standard/tests/array/max_variation1.phpt b/ext/standard/tests/array/max_variation1.phpt
new file mode 100644
index 000000000..a32ceb8fc
--- /dev/null
+++ b/ext/standard/tests/array/max_variation1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test variations in usage of max()
+--FILE--
+<?php
+/*
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing boundary conditions ***\n";
+var_dump(max(2147483645, 2147483646) );
+var_dump(max(2147483647, 2147483648) );
+var_dump(max(2147483646, 2147483648) );
+var_dump(max(-2147483647, -2147483646) );
+var_dump(max(-2147483648, -2147483647) );
+var_dump(max(-2147483649, -2147483647) );
+
+echo "\n*** Testing large number of arguments ***\n";
+
+var_dump(max(0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,21));
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+
+*** Testing boundary conditions ***
+int(2147483646)
+%s(2147483648)
+%s(2147483648)
+int(-2147483646)
+int(-2147483647)
+int(-2147483647)
+
+*** Testing large number of arguments ***
+int(21)
+
+Done
diff --git a/ext/standard/tests/array/max_variation2.phpt b/ext/standard/tests/array/max_variation2.phpt
new file mode 100644
index 000000000..9abcda53c
--- /dev/null
+++ b/ext/standard/tests/array/max_variation2.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test variations in usage of max()
+--FILE--
+<?php
+/*
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing arrays ***\n";
+
+var_dump(max(array(2,1,2)));
+var_dump(max(array(-2,1,2)));
+var_dump(max(array(2.1,2.11,2.09)));
+var_dump(max(array("", "t", "b")));
+var_dump(max(array(false, true, false)));
+var_dump(max(array(true, false, true)));
+var_dump(max(array(1, true, false, true)));
+var_dump(max(array(0, true, false, true)));
+var_dump(max(array(0, 1, array(2,3))));
+var_dump(max(array(2147483645, 2147483646)));
+var_dump(max(array(2147483647, 2147483648)));
+var_dump(max(array(2147483646, 2147483648)));
+var_dump(max(array(-2147483647, -2147483646)));
+var_dump(max(array(-2147483648, -2147483647)));
+var_dump(max(array(-2147483649, -2147483647)));
+
+echo "\nDone\n";
+
+?>
+--EXPECTF--
+
+*** Testing arrays ***
+int(2)
+int(2)
+float(2.11)
+string(1) "t"
+bool(true)
+bool(true)
+int(1)
+bool(true)
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+int(2147483646)
+%s(2147483648)
+%s(2147483648)
+int(-2147483646)
+int(-2147483647)
+int(-2147483647)
+
+Done
diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt
index dfb3c9bde..2fae3f9d4 100644
--- a/ext/standard/tests/array/min.phpt
+++ b/ext/standard/tests/array/min.phpt
@@ -20,13 +20,13 @@ var_dump(min(0, true, false, true));
echo "Done\n";
?>
--EXPECTF--
-Warning: min(): Atleast one value should be passed in %s on line %d
+Warning: min(): At least one value should be passed in %s on line %d
NULL
Warning: Wrong parameter count for min() in %s on line %d
NULL
-Warning: min(): Array must contain atleast one element in %s on line %d
+Warning: min(): Array must contain at least one element in %s on line %d
bool(false)
Warning: Wrong parameter count for min() in %s on line %d
diff --git a/ext/standard/tests/array/min_basic.phpt b/ext/standard/tests/array/min_basic.phpt
new file mode 100644
index 000000000..9fd4af616
--- /dev/null
+++ b/ext/standard/tests/array/min_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test return type and value for expected input min()
+--FILE--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing sequences of numbers ***\n";
+
+var_dump(min(2,1,2));
+var_dump(min(-2,1,2));
+var_dump(min(2.1,2.11,2.09));
+var_dump(min("", "t", "b"));
+var_dump(min(false, true, false));
+var_dump(min(true, false, true));
+var_dump(min(1, true, false, true));
+var_dump(min(0, true, false, true));
+var_dump(min(0, 1, array(2,3)));
+
+echo "\nDone\n";
+?>
+--EXPECT--
+
+*** Testing sequences of numbers ***
+int(1)
+int(-2)
+float(2.09)
+string(0) ""
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+
+Done \ No newline at end of file
diff --git a/ext/standard/tests/array/min_error.phpt b/ext/standard/tests/array/min_error.phpt
new file mode 100644
index 000000000..f39516c68
--- /dev/null
+++ b/ext/standard/tests/array/min_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test wrong number of arguments for min()
+--FILE--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+
+echo "\n*** Testing Error Conditions ***\n";
+
+var_dump(min());
+var_dump(min(1));
+var_dump(min(array()));
+var_dump(min(new stdclass));
+
+?>
+--EXPECTF--
+
+*** Testing Error Conditions ***
+
+Warning: min(): At least one %s on line %d
+NULL
+
+Warning: Wrong parameter count for min() in %s on line %d
+NULL
+
+Warning: min(): Array must contain at least one element in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for min() in %s on line %d
+NULL
diff --git a/ext/standard/tests/array/min_variation1.phpt b/ext/standard/tests/array/min_variation1.phpt
new file mode 100644
index 000000000..9e24bd66a
--- /dev/null
+++ b/ext/standard/tests/array/min_variation1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test variations in usage of min()
+--FILE--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing boundary conditions ***\n";
+var_dump(min(2147483645, 2147483646) );
+var_dump(min(2147483647, 2147483648) );
+var_dump(min(2147483646, 2147483648) );
+var_dump(min(-2147483647, -2147483646) );
+var_dump(min(-2147483648, -2147483647) );
+var_dump(min(-2147483649, -2147483647) );
+
+echo "\n*** Testing large number of arguments ***\n";
+
+var_dump(min(0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,0, 1 , 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,21));
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+
+*** Testing boundary conditions ***
+int(2147483645)
+int(2147483647)
+int(2147483646)
+int(-2147483647)
+%s(-2147483648)
+%s(-2147483649)
+
+*** Testing large number of arguments ***
+int(0)
+
+Done
diff --git a/ext/standard/tests/array/min_variation2.phpt b/ext/standard/tests/array/min_variation2.phpt
new file mode 100644
index 000000000..a8b215209
--- /dev/null
+++ b/ext/standard/tests/array/min_variation2.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test variations in usage of min()
+--FILE--
+<?php
+/*
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+ * Function is implemented in ext/standard/array.c
+*/
+
+echo "\n*** Testing arrays ***\n";
+
+var_dump(min(array(2,1,2)));
+var_dump(min(array(-2,1,2)));
+var_dump(min(array(2.1,2.11,2.09)));
+var_dump(min(array("", "t", "b")));
+var_dump(min(array(false, true, false)));
+var_dump(min(array(true, false, true)));
+var_dump(min(array(1, true, false, true)));
+var_dump(min(array(0, true, false, true)));
+var_dump(min(array(0, 1, array(2,3))));
+var_dump(min(array(2147483645, 2147483646)));
+var_dump(min(array(2147483647, 2147483648)));
+var_dump(min(array(2147483646, 2147483648)));
+var_dump(min(array(-2147483647, -2147483646)));
+var_dump(min(array(-2147483648, -2147483647)));
+var_dump(min(array(-2147483649, -2147483647)));
+
+echo "\nDone\n";
+
+?>
+--EXPECTF--
+
+*** Testing arrays ***
+int(1)
+int(-2)
+float(2.09)
+string(0) ""
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(2147483645)
+int(2147483647)
+int(2147483646)
+int(-2147483647)
+%s(-2147483648)
+%s(-2147483649)
+
+Done
diff --git a/ext/standard/tests/array/shuffle_basic1.phpt b/ext/standard/tests/array/shuffle_basic1.phpt
new file mode 100644
index 000000000..4bff667a3
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_basic1.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test shuffle() function : basic functionality - array with default keys
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle when an array with default keys
+* is passed to the 'array_arg' argument and check for the
+* changes in the input array by printing the input array
+* before and after shuffle() function is applied on it
+*/
+
+echo "*** Testing shuffle() : with arrays having default keys ***\n";
+
+// Initialise the array with integers
+$array_arg_int = array(0, 10, 20, 30, 40, 50, 60, 70, 80);
+
+// Initialise the array with strings
+$array_arg_strings = array("one", 'two', 'three', "four", "five", " ", 'six', ' ', "seven");
+
+/* Testing shuffle() function with array of integers */
+
+// printing the input array with integers before the shuffle operation
+echo "\n-- input array of integers before shuffle() function is applied --\n";
+var_dump( $array_arg_int );
+
+// applying shuffle() function on the input array of integers
+echo "\n-- return value from shuffle() function --\n";
+var_dump( shuffle($array_arg_int) ); // prints the return value from shuffle() function
+
+echo "\n-- resultant array after shuffle() function is applied --\n";
+var_dump( $array_arg_int );
+
+/* Testing shuffle() function with array of strings */
+
+// printing the input array with strings before the shuffle operation
+echo "\n-- input array of strings before shuffle() function is applied --\n";
+var_dump( $array_arg_strings );
+
+// applying shuffle() function on the input array of strings
+echo "\n-- return value from shuffle() function --\n";
+var_dump( shuffle($array_arg_strings) ); // prints the return value from shuffle() function
+
+echo "\n-- resultant array after shuffle() function is applied --\n";
+var_dump( $array_arg_strings );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : with arrays having default keys ***
+
+-- input array of integers before shuffle() function is applied --
+array(9) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(10)
+ [2]=>
+ int(20)
+ [3]=>
+ int(30)
+ [4]=>
+ int(40)
+ [5]=>
+ int(50)
+ [6]=>
+ int(60)
+ [7]=>
+ int(70)
+ [8]=>
+ int(80)
+}
+
+-- return value from shuffle() function --
+bool(true)
+
+-- resultant array after shuffle() function is applied --
+array(9) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+}
+
+-- input array of strings before shuffle() function is applied --
+array(9) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ string(3) "two"
+ [2]=>
+ string(5) "three"
+ [3]=>
+ string(4) "four"
+ [4]=>
+ string(4) "five"
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(3) "six"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(5) "seven"
+}
+
+-- return value from shuffle() function --
+bool(true)
+
+-- resultant array after shuffle() function is applied --
+array(9) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+ [3]=>
+ string(%d) "%s"
+ [4]=>
+ string(%d) "%s"
+ [5]=>
+ string(%d) "%s"
+ [6]=>
+ string(%d) "%s"
+ [7]=>
+ string(%d) "%s"
+ [8]=>
+ string(%d) "%s"
+}
+Done
diff --git a/ext/standard/tests/array/shuffle_basic2.phpt b/ext/standard/tests/array/shuffle_basic2.phpt
new file mode 100644
index 000000000..01fc1d4c7
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_basic2.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test shuffle() function : basic functionality - with associative array
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle when an associative array is
+* passed to the 'array_arg' argument and check for the
+* changes in the input array by printing the input array
+* before and after shuffle() function is applied on it
+*/
+
+echo "*** Testing shuffle() : with associative array ***\n";
+
+// Initialise the associative array
+$array_arg = array(
+ 'one' => 1, 2 => 02, 'three' => 3,
+ 4 => 4, '#5' => 5, 'SIX' => 6,
+ "seven" => 0x7, "#8" => 012, "nine" => 9
+);
+
+// printing the input array before the shuffle operation
+echo "\n-- input array before shuffle() function is applied --\n";
+var_dump( $array_arg );
+
+// applying shuffle() function on the input array
+echo "\n-- return value from shuffle() function --\n";
+var_dump( shuffle($array_arg) ); // prints the return value from shuffle() function
+
+echo "\n-- resultant array after shuffle() function is applied --\n";
+var_dump( $array_arg );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : with associative array ***
+
+-- input array before shuffle() function is applied --
+array(9) {
+ ["one"]=>
+ int(1)
+ [2]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ [4]=>
+ int(4)
+ ["#5"]=>
+ int(5)
+ ["SIX"]=>
+ int(6)
+ ["seven"]=>
+ int(7)
+ ["#8"]=>
+ int(10)
+ ["nine"]=>
+ int(9)
+}
+
+-- return value from shuffle() function --
+bool(true)
+
+-- resultant array after shuffle() function is applied --
+array(9) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+ [6]=>
+ int(%d)
+ [7]=>
+ int(%d)
+ [8]=>
+ int(%d)
+}
+Done
diff --git a/ext/standard/tests/array/shuffle_error.phpt b/ext/standard/tests/array/shuffle_error.phpt
new file mode 100644
index 000000000..4df3467a0
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_error.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test shuffle() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/* Test shuffle() to see that warning messages are emitted
+ * when invalid number of arguments are passed to the function
+*/
+
+echo "*** Testing shuffle() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing shuffle() function with Zero arguments --\n";
+var_dump( shuffle() );
+
+// more than the expected number of arguments
+echo "\n-- Testing shuffle() function with more than expected no. of arguments --\n";
+$array_arg = array(1, "two" => 2);
+$extra_arg = 10;
+var_dump( shuffle($array_arg, $extra_arg) );
+
+// printing the input array to check that it is not affected
+// by above shuffle() function calls
+echo "\n-- original input array --\n";
+var_dump( $array_arg );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : error conditions ***
+
+-- Testing shuffle() function with Zero arguments --
+
+Warning: shuffle() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing shuffle() function with more than expected no. of arguments --
+
+Warning: shuffle() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+-- original input array --
+array(2) {
+ [0]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/shuffle_variation1.phpt b/ext/standard/tests/array/shuffle_variation1.phpt
new file mode 100644
index 000000000..597c1e92e
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_variation1.phpt
@@ -0,0 +1,212 @@
+--TEST--
+Test shuffle() function : usage variations - unexpected values for 'array_arg' argument
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() when unexpected values are passed for 'array_arg'
+* argument and verify that function outputs required warning messages wherever applicable
+*/
+
+echo "*** Testing shuffle() : with unexpected values for 'array_arg' argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//define a class
+class test
+{
+ var $t = 10;
+ function __toString()
+ {
+ return "object";
+ }
+}
+
+//array of values to iterate over
+$values = 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,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new test(),
+
+ // undefined data
+/*21*/ @$undefined_var,
+
+ // unset data
+/*22*/ @$unset_var,
+
+/*23*/ // resource data
+ $fp
+);
+
+// loop through the array to test shuffle() function
+// with each element of the array
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( shuffle($value) );
+ $count++;
+};
+
+// closing the resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : with unexpected values for 'array_arg' argument ***
+
+-- Iteration 1 --
+
+Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: shuffle() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: shuffle() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: shuffle() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: shuffle() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+
+Warning: shuffle() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: shuffle() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: shuffle() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/shuffle_variation2.phpt b/ext/standard/tests/array/shuffle_variation2.phpt
new file mode 100644
index 000000000..f9fdccbd7
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_variation2.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Test shuffle() function : usage variation - with MultiDimensional array
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() function when multi-dimensional array is
+* passed to 'array_arg' argument
+*/
+
+echo "*** Testing shuffle() : with multi-dimensional array ***\n";
+
+// initialise the multi-dimensional array
+$array_arg = array(
+ array(1, 2, 3),
+ array(4, 5, 6),
+ array(7, 8, 9),
+ array(10000, 20000000, 30000000),
+ array(0, 0, 0),
+ array(012, 023, 034),
+ array(0x1, 0x0, 0xa)
+
+);
+
+// calling shuffle() function with multi-dimensional array
+var_dump( shuffle($array_arg) );
+echo "\nThe output array is:\n";
+var_dump( $array_arg );
+
+
+// looping to test shuffle() with each sub-array in the multi-dimensional array
+echo "\n*** Testing shuffle() with arrays having different types of values ***\n";
+$counter = 1;
+for($i=0; $i<=6; $i++) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( shuffle($array_arg[$i]) );
+ echo "\nThe output array is:\n";
+ var_dump( $array_arg[$i] );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : with multi-dimensional array ***
+bool(true)
+
+The output array is:
+array(7) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+ [4]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+ [5]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+ [6]=>
+ array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ }
+}
+
+*** Testing shuffle() with arrays having different types of values ***
+
+-- Iteration 1 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 2 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 3 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 4 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 5 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 6 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+
+-- Iteration 7 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+}
+Done
diff --git a/ext/standard/tests/array/shuffle_variation3.phpt b/ext/standard/tests/array/shuffle_variation3.phpt
new file mode 100644
index 000000000..3e20383af
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_variation3.phpt
@@ -0,0 +1,232 @@
+--TEST--
+Test shuffle() function : usage variation - arrays with diff. types of values
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() function when arrays having different
+* types of values, are passed to 'array_arg' argument
+*/
+
+echo "*** Testing shuffle() : arrays with diff types of values ***\n";
+
+// initialise different arrays
+$array_arg = array(
+ // array with positive int values
+/*1*/ array(0, 1, 2, 2147483647 ),
+
+ // array with negative int values
+ array(-1, -2, -2147483647 ),
+
+ // array with positive float values
+/*3*/ array(0.23, 1.34, 0e2, 200e-2, 30e2, 10e0, 2147473648.90),
+
+ // array with negative float values
+ array(-0.23, -1.34, -200e-2, -30e2, -10e0, -2147473649.80),
+
+ // array with single quoted and double quoted strings
+/*5*/ array('one', "123numbers", 'hello\tworld', "hello world\0", '12.34floatnum'),
+
+ // array with bool values
+ array(true, TRUE, FALSE, false),
+
+ // array with positive hexa values
+/*7*/ array(0x123, 0xabc, 0xABC, 0xac, 0xAb1, 0x9fa),
+
+ // array with negative hexa values
+ array(-0x123, -0xabc, -0xABC, -0xAb1, -0x9fa),
+
+ // array with positive octal values
+/*9*/ array(0123, 02348, 034, 00),
+
+ // array with negative octal values
+/*10*/ array(-0123, -02348, -034),
+
+);
+
+// looping to test shuffle() with each sub-array in the $array_arg array
+echo "\n*** Testing shuffle() with arrays having different types of values ***\n";
+$counter = 1;
+foreach($array_arg as $arr) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( shuffle($arr) );
+ echo "\nThe output array is:\n";
+ var_dump( $arr );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : arrays with diff types of values ***
+
+*** Testing shuffle() with arrays having different types of values ***
+
+-- Iteration 1 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+}
+
+-- Iteration 2 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(-%d)
+ [1]=>
+ int(-%d)
+ [2]=>
+ int(-%d)
+}
+
+-- Iteration 3 --
+bool(true)
+
+The output array is:
+array(7) {
+ [0]=>
+ float(%f)
+ [1]=>
+ float(%f)
+ [2]=>
+ float(%f)
+ [3]=>
+ float(%f)
+ [4]=>
+ float(%f)
+ [5]=>
+ float(%f)
+ [6]=>
+ float(%f)
+}
+
+-- Iteration 4 --
+bool(true)
+
+The output array is:
+array(6) {
+ [0]=>
+ float(-%f)
+ [1]=>
+ float(-%f)
+ [2]=>
+ float(-%f)
+ [3]=>
+ float(-%f)
+ [4]=>
+ float(-%f)
+ [5]=>
+ float(-%f)
+}
+
+-- Iteration 5 --
+bool(true)
+
+The output array is:
+array(5) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+ [3]=>
+ string(%d) "%s"
+ [4]=>
+ string(%d) "%s"
+}
+
+-- Iteration 6 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ bool(%s)
+ [1]=>
+ bool(%s)
+ [2]=>
+ bool(%s)
+ [3]=>
+ bool(%s)
+}
+
+-- Iteration 7 --
+bool(true)
+
+The output array is:
+array(6) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+ [4]=>
+ int(%d)
+ [5]=>
+ int(%d)
+}
+
+-- Iteration 8 --
+bool(true)
+
+The output array is:
+array(5) {
+ [0]=>
+ int(-%d)
+ [1]=>
+ int(-%d)
+ [2]=>
+ int(-%d)
+ [3]=>
+ int(-%d)
+ [4]=>
+ int(-%d)
+}
+
+-- Iteration 9 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+}
+
+-- Iteration 10 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(-%d)
+ [1]=>
+ int(-%d)
+ [2]=>
+ int(-%d)
+}
+Done
diff --git a/ext/standard/tests/array/shuffle_variation4.phpt b/ext/standard/tests/array/shuffle_variation4.phpt
new file mode 100644
index 000000000..34c1a0644
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_variation4.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test shuffle() function : usage variation - associative arrays with diff. types of values
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() function when associative arrays
+* having different types of values, are passed to 'array_arg' argument
+*/
+
+echo "*** Testing shuffle() : associative arrays with diff types of values ***\n";
+
+// initialise different arrays
+$array_arg = array(
+ // array with positive int values
+/*1*/ array("zero" => 0, 1 => 1, "two" => 2, "max_int" => 2147483647 ),
+
+ // array with negative int values
+ array("minus_one" => -1, 'minus_two' => -2, "min_int" => -2147483647 ),
+
+ // array with positive float values
+/*3*/ array("float1" => 0.23, 'float2' => 1.34, "exp1" => 0e2, 'exp2' => 200e-2, "exp3" => 10e0),
+
+ // array with negative float values
+ array(-0.23 => -0.23, -1.34 => -1.34, -200e-2 => -200e-2, -30 => -30e0, -2147473649.80),
+
+ // array with single and double quoted strings
+/*5*/ array('1' => 'one', "str1" => "123numbers", '' => 'hello\tworld', "" => "hello world\0", "12.34floatnum"),
+
+ // array with bool values
+ array('1' => TRUE, "1" => TRUE, "0" => FALSE, '0' => FALSE),
+
+ // array with positive hexa values
+/*7*/ array("hex1" => 0x123, 'hex2' => 0xabc, "hex\t3" => 0xABC, "hex\04" => 0xAb1),
+
+ // array with negative hexa values
+ array(NULL => -0x123, "NULL" => -0xabc, "-ABC" => -0xABC, -0xAB1 => -0xAb1),
+
+ // array with positive octal values
+/*9*/ array(0123 => 0123, "02348" => 02348, '034' => 034, 00 => 00),
+
+ // array with negative octal values
+ array(-0123 => -0123, "-02348" => -02348, '-034' => -034),
+
+ // array with null values
+/*11*/ array(NULL => NULL, "null" => NULL, "NULL" => NULL)
+
+);
+
+// looping to test shuffle() with each sub-array in the $array_arg array
+echo "\n*** Testing shuffle() with arrays having different types of values ***\n";
+$counter = 1;
+foreach($array_arg as $arr) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( shuffle($arr) );
+ echo "\nThe output array is:\n";
+ var_dump( $arr );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing shuffle() : associative arrays with diff types of values ***
+
+*** Testing shuffle() with arrays having different types of values ***
+
+-- Iteration 1 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+}
+
+-- Iteration 2 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(-%d)
+ [1]=>
+ int(-%d)
+ [2]=>
+ int(-%d)
+}
+
+-- Iteration 3 --
+bool(true)
+
+The output array is:
+array(5) {
+ [0]=>
+ float(%f)
+ [1]=>
+ float(%f)
+ [2]=>
+ float(%f)
+ [3]=>
+ float(%f)
+ [4]=>
+ float(%f)
+}
+
+-- Iteration 4 --
+bool(true)
+
+The output array is:
+array(5) {
+ [0]=>
+ float(-%f)
+ [1]=>
+ float(-%f)
+ [2]=>
+ float(-%f)
+ [3]=>
+ float(-%f)
+ [4]=>
+ float(-%f)
+}
+
+-- Iteration 5 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ string(%d) "%s"
+ [1]=>
+ string(%d) "%s"
+ [2]=>
+ string(%d) "%s"
+ [3]=>
+ string(%d) "%s"
+}
+
+-- Iteration 6 --
+bool(true)
+
+The output array is:
+array(2) {
+ [0]=>
+ bool(%s)
+ [1]=>
+ bool(%s)
+}
+
+-- Iteration 7 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+}
+
+-- Iteration 8 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ int(-%d)
+ [1]=>
+ int(-%d)
+ [2]=>
+ int(-%d)
+ [3]=>
+ int(-%d)
+}
+
+-- Iteration 9 --
+bool(true)
+
+The output array is:
+array(4) {
+ [0]=>
+ int(%d)
+ [1]=>
+ int(%d)
+ [2]=>
+ int(%d)
+ [3]=>
+ int(%d)
+}
+
+-- Iteration 10 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ int(-%d)
+ [1]=>
+ int(-%d)
+ [2]=>
+ int(-%d)
+}
+
+-- Iteration 11 --
+bool(true)
+
+The output array is:
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+Done
diff --git a/ext/standard/tests/array/shuffle_variation5.phpt b/ext/standard/tests/array/shuffle_variation5.phpt
new file mode 100644
index 000000000..3428e5678
--- /dev/null
+++ b/ext/standard/tests/array/shuffle_variation5.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test shuffle() function : usage variation - arrays with diff heredoc strings
+--FILE--
+<?php
+/* Prototype : bool shuffle(array $array_arg)
+ * Description: Randomly shuffle the contents of an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Test behaviour of shuffle() when an array of heredoc strings is passed to
+* 'array_arg' argument of the function
+*/
+
+echo "*** Testing shuffle() : with array containing heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+// defining array with values as heredoc strings
+$heredoc_array = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls
+);
+
+// defining array with keys as heredoc strings
+$heredoc_asso_array = array(
+ $empty_heredoc => "heredoc1",
+ $heredoc_with_newline => "heredoc2",
+ $heredoc_with_characters => "heredoc3",
+ $heredoc_with_newline_and_tabs => "heredoc3",
+ $heredoc_with_alphanumerics => "heredoc4",
+ $heredoc_with_embedded_nulls => "heredoc5"
+);
+
+// test shuffle() with array containing heredoc strings as values
+echo "\n-- with array of heredoc strings --\n";
+var_dump( shuffle($heredoc_array) );
+echo "\nThe output array is:\n";
+var_dump( $heredoc_array );
+
+// test shuffle() with array containing heredoc strings as its keys
+echo "\n-- with array having heredoc strings as keys --\n";
+var_dump( shuffle($heredoc_asso_array) );
+echo "\nThe output array is:\n";
+var_dump( $heredoc_asso_array );
+
+echo "Done";
+?>
+--EXPECTREGEX--
+\*\*\* Testing shuffle\(\) : with array containing heredoc strings \*\*\*
+
+-- with array of heredoc strings --
+bool\(true\)
+
+The output array is:
+array\(6\) {
+ \[0\]=>
+ string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
+ \[1\]=>
+ string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
+ \[2\]=>
+ string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
+ \[3\]=>
+ string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
+ \[4\]=>
+ string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
+ \[5\]=>
+ string\([0-9]*\) "[0-9 a-z \n \0 \t]*"
+}
+
+-- with array having heredoc strings as keys --
+bool\(true\)
+
+The output array is:
+array\(6\) {
+ \[0\]=>
+ string\(8\) "[heredoc 1-5]*"
+ \[1\]=>
+ string\(8\) "[heredoc 1-5]*"
+ \[2\]=>
+ string\(8\) "[heredoc 1-5]*"
+ \[3\]=>
+ string\(8\) "[heredoc 1-5]*"
+ \[4\]=>
+ string\(8\) "[heredoc 1-5]*"
+ \[5\]=>
+ string\(8\) "[heredoc 1-5]*"
+}
+Done
diff --git a/ext/standard/tests/array/sort_basic.phpt b/ext/standard/tests/array/sort_basic.phpt
new file mode 100644
index 000000000..3cf653f20
--- /dev/null
+++ b/ext/standard/tests/array/sort_basic.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Test sort() function : basic functionality
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing arrays with default keys and assoc arrays
+ * to check the basic functionality with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : basic functionality ***\n";
+
+// associative array containing unsorted string values
+$unsorted_strings = array( "l" => "lemon", "o" => "orange", "b" => "banana" );
+
+// array with default keys containing unsorted numeric values
+$unsorted_numerics = array( 100, 33, 555, 22 );
+
+echo "\n-- Testing sort() by supplying string array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_strings;
+var_dump( sort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying numeric array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( sort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying string array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_strings;
+var_dump( sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying numeric array, 'flag' = SORT_REGULAR --\n";
+$temp_array = $unsorted_numerics;
+var_dump( sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying string array, 'flag' = SORT_STRING --\n";
+$temp_array = $unsorted_strings;
+var_dump( sort($temp_array, SORT_STRING) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = $unsorted_numerics;
+var_dump( sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : basic functionality ***
+
+-- Testing sort() by supplying string array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ [0]=>
+ string(6) "banana"
+ [1]=>
+ string(5) "lemon"
+ [2]=>
+ string(6) "orange"
+}
+
+-- Testing sort() by supplying numeric array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(33)
+ [2]=>
+ int(100)
+ [3]=>
+ int(555)
+}
+
+-- Testing sort() by supplying string array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ string(6) "banana"
+ [1]=>
+ string(5) "lemon"
+ [2]=>
+ string(6) "orange"
+}
+
+-- Testing sort() by supplying numeric array, 'flag' = SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(33)
+ [2]=>
+ int(100)
+ [3]=>
+ int(555)
+}
+
+-- Testing sort() by supplying string array, 'flag' = SORT_STRING --
+bool(true)
+array(3) {
+ [0]=>
+ string(6) "banana"
+ [1]=>
+ string(5) "lemon"
+ [2]=>
+ string(6) "orange"
+}
+
+-- Testing sort() by supplying numeric array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(4) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(33)
+ [2]=>
+ int(100)
+ [3]=>
+ int(555)
+}
+Done
diff --git a/ext/standard/tests/array/sort_error.phpt b/ext/standard/tests/array/sort_error.phpt
new file mode 100644
index 000000000..4864ef33d
--- /dev/null
+++ b/ext/standard/tests/array/sort_error.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sort() function : error conditions
+--FILE--
+<?php
+/* Prototype : bool sort(array &array_arg [, int sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing sort() function with all possible error conditions
+*/
+
+echo "*** Testing sort() : error conditions ***\n";
+
+// zero arguments
+echo "\n-- Testing sort() function with Zero arguments --\n";
+var_dump( sort() );
+
+//Test sort with more than the expected number of arguments
+echo "\n-- Testing sort() function with more than expected no. of arguments --\n";
+$array_arg = array(1, 2);
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING, "SORT_NUMERIC" => SORT_NUMERIC);
+$extra_arg = 10;
+
+// loop through $flag_value array and setting all possible flag values
+foreach($flag_value as $key => $flag){
+ echo "\nSort flag = $key\n";
+ var_dump( sort($array_arg,$flag, $extra_arg) );
+
+ // dump the input array to ensure that it wasn't changed
+ var_dump($array_arg);
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sort() : error conditions ***
+
+-- Testing sort() function with Zero arguments --
+
+Warning: sort() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+-- Testing sort() function with more than expected no. of arguments --
+
+Sort flag = SORT_REGULAR
+
+Warning: sort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_STRING
+
+Warning: sort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+
+Sort flag = SORT_NUMERIC
+
+Warning: sort() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/sort_object1.phpt b/ext/standard/tests/array/sort_object1.phpt
new file mode 100644
index 000000000..caa9c8dbb
--- /dev/null
+++ b/ext/standard/tests/array/sort_object1.phpt
@@ -0,0 +1,242 @@
+--TEST--
+Test sort() function : object functionality - sorting objects, 'sort_flags' as default/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+/*
+ * testing sort() by providing integer/string object arrays with flag values are defualt, SORT_REGULAR
+*/
+
+echo "*** Testing sort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_sort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_sort
+{
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array(
+ new for_integer_sort(11), new for_integer_sort(66),
+ new for_integer_sort(23), new for_integer_sort(-5),
+ new for_integer_sort(0.001), new for_integer_sort(0)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_sort("axx"), new for_string_sort("t"),
+ new for_string_sort("w"), new for_string_sort("py"),
+ new for_string_sort("apple"), new for_string_sort("Orange"),
+ new for_string_sort("Lemon"), new for_string_sort("aPPle")
+);
+
+
+echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing sort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(sort($temp_array) );
+var_dump($temp_array);
+
+// testing sort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(sort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing sort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(sort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing sort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(sort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : object functionality ***
+
+-- Testing sort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(6) {
+ [0]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [1]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [2]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [3]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [4]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [5]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ [0]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ [1]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [2]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [3]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [4]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [5]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [6]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [7]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+
+-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(6) {
+ [0]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(-5)
+ }
+ [1]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(0)
+ }
+ [2]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ float(0.001)
+ }
+ [3]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(11)
+ }
+ [4]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(23)
+ }
+ [5]=>
+ object(for_integer_sort)#%d (1) {
+ ["class_value"]=>
+ int(66)
+ }
+}
+bool(true)
+array(8) {
+ [0]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(5) "Lemon"
+ }
+ [1]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(6) "Orange"
+ }
+ [2]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(5) "aPPle"
+ }
+ [3]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(5) "apple"
+ }
+ [4]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(3) "axx"
+ }
+ [5]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(2) "py"
+ }
+ [6]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(1) "t"
+ }
+ [7]=>
+ object(for_string_sort)#%d (1) {
+ ["class_value"]=>
+ string(1) "w"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/sort_object2.phpt b/ext/standard/tests/array/sort_object2.phpt
new file mode 100644
index 000000000..173719bd9
--- /dev/null
+++ b/ext/standard/tests/array/sort_object2.phpt
@@ -0,0 +1,257 @@
+--TEST--
+Test sort() function : object functionality - sorting objects with diff. accessibility of member vars
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing integer/string object arrays with flag values are defualt, SORT_REGULAR
+*/
+
+echo "*** Testing sort() : object functionality ***\n";
+
+// class declaration for integer objects
+class for_integer_sort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+}
+
+// class declaration for string objects
+class for_string_sort
+{
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
+
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
+
+}
+
+// array of integer objects
+$unsorted_int_obj = array(
+ new for_integer_sort(11,33,30),
+ new for_integer_sort(66,44,4),
+ new for_integer_sort(-88,-5,5),
+ new for_integer_sort(0.001,99.5,0.1)
+);
+
+// array of string objects
+$unsorted_str_obj = array (
+ new for_string_sort("axx","AXX","ass"),
+ new for_string_sort("t","eee","abb"),
+ new for_string_sort("w","W", "c"),
+ new for_string_sort("py","PY", "pt"),
+);
+
+
+echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is defualt --\n";
+
+// testing sort() function by supplying integer object array, flag value is defualt
+$temp_array = $unsorted_int_obj;
+var_dump(sort($temp_array) );
+var_dump($temp_array);
+
+// testing sort() function by supplying string object array, flag value is defualt
+$temp_array = $unsorted_str_obj;
+var_dump(sort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR --\n";
+// testing sort() function by supplying integer object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_int_obj;
+var_dump(sort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+// testing sort() function by supplying string object array, flag value = SORT_REGULAR
+$temp_array = $unsorted_str_obj;
+var_dump(sort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : object functionality ***
+
+-- Testing sort() by supplying various object arrays, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ int(-88)
+ ["private_class_value:private"]=>
+ int(-5)
+ ["protected_class_value:protected"]=>
+ int(5)
+ }
+ [1]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ float(0.001)
+ ["private_class_value:private"]=>
+ float(99.5)
+ ["protected_class_value:protected"]=>
+ float(0.1)
+ }
+ [2]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ int(11)
+ ["private_class_value:private"]=>
+ int(33)
+ ["protected_class_value:protected"]=>
+ int(30)
+ }
+ [3]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ int(66)
+ ["private_class_value:private"]=>
+ int(44)
+ ["protected_class_value:protected"]=>
+ int(4)
+ }
+}
+bool(true)
+array(4) {
+ [0]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(3) "ass"
+ }
+ [1]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "py"
+ ["private_class_value:private"]=>
+ string(2) "PY"
+ ["protected_class_value:protected"]=>
+ string(2) "pt"
+ }
+ [2]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "t"
+ ["private_class_value:private"]=>
+ string(3) "eee"
+ ["protected_class_value:protected"]=>
+ string(3) "abb"
+ }
+ [3]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+}
+
+-- Testing sort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ int(-88)
+ ["private_class_value:private"]=>
+ int(-5)
+ ["protected_class_value:protected"]=>
+ int(5)
+ }
+ [1]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ float(0.001)
+ ["private_class_value:private"]=>
+ float(99.5)
+ ["protected_class_value:protected"]=>
+ float(0.1)
+ }
+ [2]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ int(11)
+ ["private_class_value:private"]=>
+ int(33)
+ ["protected_class_value:protected"]=>
+ int(30)
+ }
+ [3]=>
+ object(for_integer_sort)#%d (3) {
+ ["public_class_value"]=>
+ int(66)
+ ["private_class_value:private"]=>
+ int(44)
+ ["protected_class_value:protected"]=>
+ int(4)
+ }
+}
+bool(true)
+array(4) {
+ [0]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(3) "axx"
+ ["private_class_value:private"]=>
+ string(3) "AXX"
+ ["protected_class_value:protected"]=>
+ string(3) "ass"
+ }
+ [1]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(2) "py"
+ ["private_class_value:private"]=>
+ string(2) "PY"
+ ["protected_class_value:protected"]=>
+ string(2) "pt"
+ }
+ [2]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "t"
+ ["private_class_value:private"]=>
+ string(3) "eee"
+ ["protected_class_value:protected"]=>
+ string(3) "abb"
+ }
+ [3]=>
+ object(for_string_sort)#%d (3) {
+ ["public_class_value"]=>
+ string(1) "w"
+ ["private_class_value:private"]=>
+ string(1) "W"
+ ["protected_class_value:protected"]=>
+ string(1) "c"
+ }
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation1.phpt b/ext/standard/tests/array/sort_variation1.phpt
new file mode 100644
index 000000000..f6991bdf6
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation1.phpt
@@ -0,0 +1,398 @@
+--TEST--
+Test sort() function : usage variations - unexpected values for 'array_arg' argument
+--FILE--
+<?php
+/* Prototype : bool sort(array &array_arg [, int $sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different unexpected values for array argument
+ * with following flag values.
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+//array of values to iterate over
+$unexpected_values = array (
+
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 10.5e3,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+
+ // string data
+/*18*/ "string",
+ 'string',
+
+ // object data
+/*20*/ new stdclass(),
+
+ // undefined data
+/*21*/ @undefined_var,
+
+ // unset data
+/*22*/ @unset_var,
+
+ // resource variable
+/*23*/ $fp
+);
+
+// loop though each element of the array and check the working of sort()
+// when $array arugment is supplied with different values from $unexpected_values
+echo "\n-- Testing sort() by supplying different unexpected values for 'array' argument --\n";
+echo "\n-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $value = $unexpected_values [$index];
+ var_dump( sort($value) ); // expecting : bool(false)
+ var_dump( sort($value, SORT_REGULAR) ); // expecting : bool(false)
+ var_dump( sort($value, SORT_NUMERIC) ); // expecting : bool(false)
+ var_dump( sort($value, SORT_STRING) ); // expecting : bool(false)
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying different unexpected values for 'array' argument --
+
+-- Flag values are defualt, SORT_REGULAR, SORT_NUMERIC, SORT_STRING --
+-- Iteration 1 --
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 2 --
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, integer given in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, double given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, null given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 15 --
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, boolean given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: sort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, object given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, string given in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: sort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+
+Warning: sort() expects parameter 1 to be array, resource given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/sort_variation10.phpt b/ext/standard/tests/array/sort_variation10.phpt
new file mode 100644
index 000000000..0a5a58044
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation10.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Test sort() function : usage variations - sort octal values
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different octal array for $array argument
+ * with following flag values
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * 3.SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// an array containing unsorted octal values
+$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
+
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(sort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_oct_array;
+var_dump(sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying octal value array, 'flag' value is defualt --
+bool(true)
+array(9) {
+ [0]=>
+ int(-229)
+ [1]=>
+ int(-54)
+ [2]=>
+ int(0)
+ [3]=>
+ int(54)
+ [4]=>
+ int(63)
+ [5]=>
+ int(209)
+ [6]=>
+ int(229)
+ [7]=>
+ int(506)
+ [8]=>
+ int(669)
+}
+
+-- Testing sort() by supplying octal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(9) {
+ [0]=>
+ int(-229)
+ [1]=>
+ int(-54)
+ [2]=>
+ int(0)
+ [3]=>
+ int(54)
+ [4]=>
+ int(63)
+ [5]=>
+ int(209)
+ [6]=>
+ int(229)
+ [7]=>
+ int(506)
+ [8]=>
+ int(669)
+}
+
+-- Testing sort() by supplying octal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(9) {
+ [0]=>
+ int(-229)
+ [1]=>
+ int(-54)
+ [2]=>
+ int(0)
+ [3]=>
+ int(54)
+ [4]=>
+ int(63)
+ [5]=>
+ int(209)
+ [6]=>
+ int(229)
+ [7]=>
+ int(506)
+ [8]=>
+ int(669)
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation11.phpt b/ext/standard/tests/array/sort_variation11.phpt
new file mode 100644
index 000000000..56583d208
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/sort_variation2.phpt b/ext/standard/tests/array/sort_variation2.phpt
new file mode 100644
index 000000000..4304ecb76
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation2.phpt
@@ -0,0 +1,311 @@
+--TEST--
+Test sort() function : usage variations - unexpected values for 'sort_flags' argument
+--FILE--
+<?php
+/* Prototype : bool sort(array &array_arg [, int $sort_flags])
+ * Description: Sort an array
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing different unexpected values for flag argument
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// temperory array for checking unexpected behavior
+$unsorted_values = array(10, 2, 45);
+
+//array of values to iterate over
+$unexpected_values = array(
+
+ // int data
+/*1*/ -2345,
+
+ // float data
+/*2*/ 10.5,
+ -10.5,
+ 10.5e2,
+ 10.6E-2,
+ .5,
+
+ // null data
+/*7*/ NULL,
+ null,
+
+ // boolean data
+/*9*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*13*/ "",
+ '',
+
+ // string data
+/*15*/ "string",
+ 'string',
+
+ // object data
+/*16*/ new stdclass(),
+
+ // undefined data
+/*17*/ @undefined_var,
+
+ // unset data
+/*18*/ @unset_var,
+
+ // resource variable
+/*19*/ $fp
+
+);
+
+// loop though each element of the array and check the working of sort()
+// when $flag arugment is supplied with different values
+echo "\n-- Testing sort() by supplying different unexpected values for 'flag' argument --\n";
+
+$counter = 1;
+for($index = 0; $index < count($unexpected_values); $index ++) {
+ echo "-- Iteration $counter --\n";
+
+ // sort the array, retain a temp. copy of input array for next iteration
+ $value = $unexpected_values [$index];
+ $temp_array = $unsorted_values;
+ var_dump( sort($temp_array, $value) );
+
+ //dump the sorted array
+ var_dump($temp_array);
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying different unexpected values for 'flag' argument --
+-- Iteration 1 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 2 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 3 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 4 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 5 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 6 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 7 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 8 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 9 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 10 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 11 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 12 --
+bool(true)
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(10)
+ [2]=>
+ int(45)
+}
+-- Iteration 13 --
+
+Warning: sort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 14 --
+
+Warning: sort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 15 --
+
+Warning: sort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 16 --
+
+Warning: sort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 17 --
+
+Warning: sort() expects parameter 2 to be long, object given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 18 --
+
+Warning: sort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 19 --
+
+Warning: sort() expects parameter 2 to be long, string given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+-- Iteration 20 --
+
+Warning: sort() expects parameter 2 to be long, resource given in %s on line %d
+bool(false)
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(2)
+ [2]=>
+ int(45)
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation3.phpt b/ext/standard/tests/array/sort_variation3.phpt
new file mode 100644
index 000000000..1ad058d4e
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation3.phpt
@@ -0,0 +1,328 @@
+--TEST--
+Test sort() function : usage variations - sort integer/float values
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing different integer/float value arrays for $array argument
+ * with following flag values
+ * 1. flag value as defualt
+ * 2. SORT_REGULAR - compare items normally
+ * 3. SORT_NUMERIC - compare items numerically
+ * 4. SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// group of various arrays
+$various_arrays = array (
+ // negative/posative integers array
+ array(11, -11, 21, -21, 31, -31, 0, 41, -41),
+
+ // float value array
+ array(10.5, -10.5, 10.5e2, 10.6E-2, .5, .01, -.1),
+
+ // mixed value array
+ array(.0001, .0021, -.01, -1, 0, .09, 2, -.9, 10.6E-2, -10.6E-2, 33),
+
+ // array values contains minimum and maximum ranges
+ array(2147483647, 2147483648, -2147483647, -2147483648, -0, 0, -2147483649)
+);
+
+// set of possible flag values
+$flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
+
+$count = 1;
+echo "\n-- Testing sort() by supplying various integer/float arrays --\n";
+
+// loop through to test sort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array) );
+ var_dump($temp_array);
+
+ // loop through $flag_value array and setting all possible flag values
+ foreach($flag_value as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying various integer/float arrays --
+
+-- Iteration 1 --
+- With Defualt sort flag -
+bool(true)
+array(9) {
+ [0]=>
+ int(-41)
+ [1]=>
+ int(-31)
+ [2]=>
+ int(-21)
+ [3]=>
+ int(-11)
+ [4]=>
+ int(0)
+ [5]=>
+ int(11)
+ [6]=>
+ int(21)
+ [7]=>
+ int(31)
+ [8]=>
+ int(41)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(9) {
+ [0]=>
+ int(-41)
+ [1]=>
+ int(-31)
+ [2]=>
+ int(-21)
+ [3]=>
+ int(-11)
+ [4]=>
+ int(0)
+ [5]=>
+ int(11)
+ [6]=>
+ int(21)
+ [7]=>
+ int(31)
+ [8]=>
+ int(41)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(9) {
+ [0]=>
+ int(-41)
+ [1]=>
+ int(-31)
+ [2]=>
+ int(-21)
+ [3]=>
+ int(-11)
+ [4]=>
+ int(0)
+ [5]=>
+ int(11)
+ [6]=>
+ int(21)
+ [7]=>
+ int(31)
+ [8]=>
+ int(41)
+}
+
+-- Iteration 2 --
+- With Defualt sort flag -
+bool(true)
+array(7) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(-0.1)
+ [2]=>
+ float(0.01)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.5)
+ [5]=>
+ float(10.5)
+ [6]=>
+ float(1050)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(-0.1)
+ [2]=>
+ float(0.01)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.5)
+ [5]=>
+ float(10.5)
+ [6]=>
+ float(1050)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [0]=>
+ float(-10.5)
+ [1]=>
+ float(-0.1)
+ [2]=>
+ float(0.01)
+ [3]=>
+ float(0.106)
+ [4]=>
+ float(0.5)
+ [5]=>
+ float(10.5)
+ [6]=>
+ float(1050)
+}
+
+-- Iteration 3 --
+- With Defualt sort flag -
+bool(true)
+array(11) {
+ [0]=>
+ int(-1)
+ [1]=>
+ float(-0.9)
+ [2]=>
+ float(-0.106)
+ [3]=>
+ float(-0.01)
+ [4]=>
+ int(0)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ float(0.0021)
+ [7]=>
+ float(0.09)
+ [8]=>
+ float(0.106)
+ [9]=>
+ int(2)
+ [10]=>
+ int(33)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(11) {
+ [0]=>
+ int(-1)
+ [1]=>
+ float(-0.9)
+ [2]=>
+ float(-0.106)
+ [3]=>
+ float(-0.01)
+ [4]=>
+ int(0)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ float(0.0021)
+ [7]=>
+ float(0.09)
+ [8]=>
+ float(0.106)
+ [9]=>
+ int(2)
+ [10]=>
+ int(33)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(11) {
+ [0]=>
+ int(-1)
+ [1]=>
+ float(-0.9)
+ [2]=>
+ float(-0.106)
+ [3]=>
+ float(-0.01)
+ [4]=>
+ int(0)
+ [5]=>
+ float(0.0001)
+ [6]=>
+ float(0.0021)
+ [7]=>
+ float(0.09)
+ [8]=>
+ float(0.106)
+ [9]=>
+ int(2)
+ [10]=>
+ int(33)
+}
+
+-- Iteration 4 --
+- With Defualt sort flag -
+bool(true)
+array(7) {
+ [0]=>
+ %s(-2147483649)
+ [1]=>
+ %s(-2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(2147483647)
+ [6]=>
+ %s(2147483648)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(7) {
+ [0]=>
+ %s(-2147483649)
+ [1]=>
+ %s(-2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(2147483647)
+ [6]=>
+ %s(2147483648)
+}
+- Sort flag = SORT_NUMERIC -
+bool(true)
+array(7) {
+ [0]=>
+ %s(-2147483649)
+ [1]=>
+ %s(-2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(0)
+ [4]=>
+ int(0)
+ [5]=>
+ int(2147483647)
+ [6]=>
+ %s(2147483648)
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation4.phpt b/ext/standard/tests/array/sort_variation4.phpt
new file mode 100644
index 000000000..82e3d9708
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation4.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sort() function : usage variations - sort reference values
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing reference variable array with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing sort() :usage variations ***\n";
+
+$value1 = 100;
+$value2 = 33;
+$value3 = 555;
+
+// an array containing integer references
+$unsorted_numerics = array( &$value1 , &$value2, &$value3);
+
+echo "\n-- Testing sort() by supplying reference variable array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_numerics;
+var_dump( sort($temp_array) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "\n-- Testing sort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n";
+$temp_array = &$unsorted_numerics;
+var_dump( sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump( $temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() :usage variations ***
+
+-- Testing sort() by supplying reference variable array, 'flag' value is defualt --
+bool(true)
+array(3) {
+ [0]=>
+ &int(33)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(555)
+}
+
+-- Testing sort() by supplying reference variable array, 'flag' = SORT_REGULAR --
+bool(true)
+array(3) {
+ [0]=>
+ &int(33)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(555)
+}
+
+-- Testing sort() by supplying reference variable array, 'flag' = SORT_NUMERIC --
+bool(true)
+array(3) {
+ [0]=>
+ &int(33)
+ [1]=>
+ &int(100)
+ [2]=>
+ &int(555)
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation5.phpt b/ext/standard/tests/array/sort_variation5.phpt
new file mode 100644
index 000000000..061a1cbac
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation5.phpt
@@ -0,0 +1,233 @@
+--TEST--
+Test sort() function : usage variations - sort strings
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different string arrays for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_STRING - compare items as strings
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+$various_arrays = array (
+ // group of escape sequences
+ array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\r", "\t", "\xhh", "\ddd", "\v"),
+
+ // array contains combination of capital/small letters
+ array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
+);
+
+$flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
+
+$count = 1;
+echo "\n-- Testing sort() by supplying various string arrays --\n";
+
+// loop through to test sort() with different arrays
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Default sort flag -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array) ); // expecting : bool(true)
+ var_dump($temp_array);
+
+ // loop through $flags array and setting all possible flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array, $flag) ); // expecting : bool(true)
+ var_dump($temp_array);
+ }
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying various string arrays --
+
+-- Iteration 1 --
+- With Default sort flag -
+bool(true)
+array(12) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) "
+"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(2) "\a"
+ [8]=>
+ string(3) "\cx"
+ [9]=>
+ string(4) "\ddd"
+ [10]=>
+ string(2) "\e"
+ [11]=>
+ string(4) "\xhh"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) "
+"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(2) "\a"
+ [8]=>
+ string(3) "\cx"
+ [9]=>
+ string(4) "\ddd"
+ [10]=>
+ string(2) "\e"
+ [11]=>
+ string(4) "\xhh"
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(12) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ string(1) " "
+ [3]=>
+ string(1) "
+"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) " "
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(2) "\a"
+ [8]=>
+ string(3) "\cx"
+ [9]=>
+ string(4) "\ddd"
+ [10]=>
+ string(2) "\e"
+ [11]=>
+ string(4) "\xhh"
+}
+
+-- Iteration 2 --
+- With Default sort flag -
+bool(true)
+array(12) {
+ [0]=>
+ string(6) "BANANA"
+ [1]=>
+ string(6) "Orange"
+ [2]=>
+ string(4) "TTTT"
+ [3]=>
+ string(4) "Test"
+ [4]=>
+ string(1) "X"
+ [5]=>
+ string(5) "apple"
+ [6]=>
+ string(6) "banana"
+ [7]=>
+ string(5) "lemoN"
+ [8]=>
+ string(6) "oraNGe"
+ [9]=>
+ string(3) "ttt"
+ [10]=>
+ string(2) "ww"
+ [11]=>
+ string(1) "x"
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(12) {
+ [0]=>
+ string(6) "BANANA"
+ [1]=>
+ string(6) "Orange"
+ [2]=>
+ string(4) "TTTT"
+ [3]=>
+ string(4) "Test"
+ [4]=>
+ string(1) "X"
+ [5]=>
+ string(5) "apple"
+ [6]=>
+ string(6) "banana"
+ [7]=>
+ string(5) "lemoN"
+ [8]=>
+ string(6) "oraNGe"
+ [9]=>
+ string(3) "ttt"
+ [10]=>
+ string(2) "ww"
+ [11]=>
+ string(1) "x"
+}
+- Sort flag = SORT_STRING -
+bool(true)
+array(12) {
+ [0]=>
+ string(6) "BANANA"
+ [1]=>
+ string(6) "Orange"
+ [2]=>
+ string(4) "TTTT"
+ [3]=>
+ string(4) "Test"
+ [4]=>
+ string(1) "X"
+ [5]=>
+ string(5) "apple"
+ [6]=>
+ string(6) "banana"
+ [7]=>
+ string(5) "lemoN"
+ [8]=>
+ string(6) "oraNGe"
+ [9]=>
+ string(3) "ttt"
+ [10]=>
+ string(2) "ww"
+ [11]=>
+ string(1) "x"
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation6.phpt b/ext/standard/tests/array/sort_variation6.phpt
new file mode 100644
index 000000000..7a93f0e5f
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation6.phpt
@@ -0,0 +1,123 @@
+--TEST--
+Test sort() function : usage variations - sort hexadecimal values
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing different hexa-decimal array for $array argument with following flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+ * SORT_NUMERIC - compare items numerically
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// an array contains unsorted hexadecimal values
+$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
+
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(sort($temp_array) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $unsorted_hex_array;
+var_dump(sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying hexadecimal value array, 'flag' value is defualt --
+bool(true)
+array(11) {
+ [0]=>
+ int(-682)
+ [1]=>
+ int(-255)
+ [2]=>
+ int(0)
+ [3]=>
+ int(15)
+ [4]=>
+ int(187)
+ [5]=>
+ int(255)
+ [6]=>
+ int(255)
+ [7]=>
+ int(427)
+ [8]=>
+ int(427)
+ [9]=>
+ int(682)
+ [10]=>
+ int(4095)
+}
+
+-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(11) {
+ [0]=>
+ int(-682)
+ [1]=>
+ int(-255)
+ [2]=>
+ int(0)
+ [3]=>
+ int(15)
+ [4]=>
+ int(187)
+ [5]=>
+ int(255)
+ [6]=>
+ int(255)
+ [7]=>
+ int(427)
+ [8]=>
+ int(427)
+ [9]=>
+ int(682)
+ [10]=>
+ int(4095)
+}
+
+-- Testing sort() by supplying hexadecimal value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(11) {
+ [0]=>
+ int(-682)
+ [1]=>
+ int(-255)
+ [2]=>
+ int(0)
+ [3]=>
+ int(15)
+ [4]=>
+ int(187)
+ [5]=>
+ int(255)
+ [6]=>
+ int(255)
+ [7]=>
+ int(427)
+ [8]=>
+ int(427)
+ [9]=>
+ int(682)
+ [10]=>
+ int(4095)
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation7.phpt b/ext/standard/tests/array/sort_variation7.phpt
new file mode 100644
index 000000000..19d888a76
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation7.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test sort() function : usage variations - sort boolean values
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing bool value array for $array argument with following flag values.
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// bool value array
+$bool_values = array (true, false, TRUE, FALSE);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is defualt --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array, SORT_REGULAR) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is SORT_NUMERIC --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array, SORT_NUMERIC) );
+var_dump($temp_array);
+
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is SORT_STRING --\n";
+$temp_array = $bool_values;
+var_dump(sort($temp_array, SORT_STRING) );
+var_dump($temp_array);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying bool value array, 'flag' value is defualt --
+bool(true)
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+
+-- Testing sort() by supplying bool value array, 'flag' value is SORT_REGULAR --
+bool(true)
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+
+-- Testing sort() by supplying bool value array, 'flag' value is SORT_NUMERIC --
+bool(true)
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+
+-- Testing sort() by supplying bool value array, 'flag' value is SORT_STRING --
+bool(true)
+array(4) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(true)
+ [3]=>
+ bool(true)
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation8.phpt b/ext/standard/tests/array/sort_variation8.phpt
new file mode 100644
index 000000000..9a330313f
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation8.phpt
@@ -0,0 +1,178 @@
+--TEST--
+Test sort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as defualt/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * testing sort() by providing arrays contains sub arrays for $array argument with flowing flag values
+ * flag value as defualt
+ * SORT_REGULAR - compare items normally
+*/
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// array of arrays
+$various_arrays = array (
+ // null array
+ array(),
+
+ // array contains null sub array
+ array( array() ),
+
+ // array of arrays along with some values
+ array(44, 11, array(64, 61) ),
+
+ // array containing sub arrays
+ array(array(33, -5, 6), array(11), array(22, -55), array() )
+);
+
+
+$count = 1;
+echo "\n-- Testing sort() by supplying various arrays containing sub arrays --\n";
+
+// loop through to test sort() with different arrays
+foreach ($various_arrays as $array) {
+
+ echo "\n-- Iteration $count --\n";
+ // testing sort() function by supplying different arrays, flag value is defualt
+ echo "- With Defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array) );
+ var_dump($temp_array);
+
+ // testing sort() function by supplying different arrays, flag value = SORT_REGULAR
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying various arrays containing sub arrays --
+
+-- Iteration 1 --
+- With Defualt sort flag -
+bool(true)
+array(0) {
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(0) {
+}
+
+-- Iteration 2 --
+- With Defualt sort flag -
+bool(true)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+
+-- Iteration 3 --
+- With Defualt sort flag -
+bool(true)
+array(3) {
+ [0]=>
+ int(11)
+ [1]=>
+ int(44)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [0]=>
+ int(11)
+ [1]=>
+ int(44)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(64)
+ [1]=>
+ int(61)
+ }
+}
+
+-- Iteration 4 --
+- With Defualt sort flag -
+bool(true)
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ [0]=>
+ array(0) {
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ int(11)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(22)
+ [1]=>
+ int(-55)
+ }
+ [3]=>
+ array(3) {
+ [0]=>
+ int(33)
+ [1]=>
+ int(-5)
+ [2]=>
+ int(6)
+ }
+}
+Done
diff --git a/ext/standard/tests/array/sort_variation9.phpt b/ext/standard/tests/array/sort_variation9.phpt
new file mode 100644
index 000000000..faab1666c
--- /dev/null
+++ b/ext/standard/tests/array/sort_variation9.phpt
@@ -0,0 +1,259 @@
+--TEST--
+Test sort() function : usage variations - sort diff. associative arrays, 'sort_flags' as defualt/SORT_REGULAR
+--FILE--
+<?php
+/* Prototype : bool sort ( array &$array [, int $sort_flags] )
+ * Description: This function sorts an array.
+ Elements will be arranged from lowest to highest when this function has completed.
+ * Source code: ext/standard/array.c
+*/
+
+/*
+ * Testing sort() by providing arrays with key values for $array argument
+ * with following flag values.
+ * 1.flag value as defualt
+ * 2.SORT_REGULAR - compare items normally
+ * To test the new keys for the elements in the sorted array.
+ */
+
+echo "*** Testing sort() : usage variations ***\n";
+
+// list of arrays with key and values
+$various_arrays = array(
+ array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11),
+ array ("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
+ "numbers" => array(1, 2, 3, 4, 5, 6),
+ "holes" => array("first", 5 => "second", "third")
+ ),
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ array('bar' => 'baz', "foo" => 1),
+ array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
+);
+
+$count = 1;
+echo "\n-- Testing sort() by supplying various arrays with key values --\n";
+
+// loop through to test sort() with different arrays,
+// to test the new keys for the elements in the sorted array
+foreach ($various_arrays as $array) {
+ echo "\n-- Iteration $count --\n";
+
+ echo "- With Defualt sort flag -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array) );
+ var_dump($temp_array);
+
+ echo "- Sort flag = SORT_REGULAR -\n";
+ $temp_array = $array;
+ var_dump(sort($temp_array, SORT_REGULAR) );
+ var_dump($temp_array);
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing sort() : usage variations ***
+
+-- Testing sort() by supplying various arrays with key values --
+
+-- Iteration 1 --
+- With Defualt sort flag -
+bool(true)
+array(5) {
+ [0]=>
+ int(11)
+ [1]=>
+ int(22)
+ [2]=>
+ int(33)
+ [3]=>
+ int(55)
+ [4]=>
+ int(66)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(5) {
+ [0]=>
+ int(11)
+ [1]=>
+ int(22)
+ [2]=>
+ int(33)
+ [3]=>
+ int(55)
+ [4]=>
+ int(66)
+}
+
+-- Iteration 2 --
+- With Defualt sort flag -
+bool(true)
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+ }
+ [1]=>
+ array(3) {
+ ["a"]=>
+ string(6) "orange"
+ ["b"]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+ }
+ [2]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ string(5) "first"
+ [5]=>
+ string(6) "second"
+ [6]=>
+ string(5) "third"
+ }
+ [1]=>
+ array(3) {
+ ["a"]=>
+ string(6) "orange"
+ ["b"]=>
+ string(6) "banana"
+ ["c"]=>
+ string(5) "apple"
+ }
+ [2]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ }
+}
+
+-- Iteration 3 --
+- With Defualt sort flag -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(13)
+ [5]=>
+ int(19)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+ [4]=>
+ int(13)
+ [5]=>
+ int(19)
+}
+
+-- Iteration 4 --
+- With Defualt sort flag -
+bool(true)
+array(2) {
+ [0]=>
+ string(3) "baz"
+ [1]=>
+ int(1)
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(2) {
+ [0]=>
+ string(3) "baz"
+ [1]=>
+ int(1)
+}
+
+-- Iteration 5 --
+- With Defualt sort flag -
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ [3]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+}
+- Sort flag = SORT_REGULAR -
+bool(true)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ array(1) {
+ ["g"]=>
+ int(4)
+ }
+ [3]=>
+ array(2) {
+ ["e"]=>
+ int(2)
+ ["f"]=>
+ int(3)
+ }
+}
+Done
diff --git a/ext/standard/tests/file/005_basic.phpt b/ext/standard/tests/file/005_basic.phpt
index 44a49d8cd..5ed111890 100644
--- a/ext/standard/tests/file/005_basic.phpt
+++ b/ext/standard/tests/file/005_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test fileatime(),filemtime(),filectime() & touch() functions : basic functionality
+Test fileatime(), filemtime(), filectime() & touch() functions : basic functionality
--FILE--
<?php
/*
diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt
index f5eff9131..77fd4731c 100644
--- a/ext/standard/tests/file/005_error.phpt
+++ b/ext/standard/tests/file/005_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test fileatime(), filemtime(), filectime() & touch() functions: error conditions
+Test fileatime(), filemtime(), filectime() & touch() functions : error conditions
--FILE--
<?php
/*
diff --git a/ext/standard/tests/file/006_basic.phpt b/ext/standard/tests/file/006_basic.phpt
index b4eee97d3..213442c15 100644
--- a/ext/standard/tests/file/006_basic.phpt
+++ b/ext/standard/tests/file/006_basic.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt
index 691e76eae..ac95ca570 100644
--- a/ext/standard/tests/file/006_error.phpt
+++ b/ext/standard/tests/file/006_error.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
@@ -70,7 +70,7 @@ unlink( dirname(__FILE__)."/006_error.tmp");
Warning: chmod(): %s in %s on line %d
bool(false)
-100644
+100%d44
Warning: chmod(): %s in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/006_variation1.phpt b/ext/standard/tests/file/006_variation1.phpt
index 5162181bf..b752d21fe 100644
--- a/ext/standard/tests/file/006_variation1.phpt
+++ b/ext/standard/tests/file/006_variation1.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt
index e224be2b1..348e9b869 100644
--- a/ext/standard/tests/file/006_variation2.phpt
+++ b/ext/standard/tests/file/006_variation2.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/007_variation1.phpt b/ext/standard/tests/file/007_variation1.phpt
index c3a2ccc17..6cba14665 100644
--- a/ext/standard/tests/file/007_variation1.phpt
+++ b/ext/standard/tests/file/007_variation1.phpt
@@ -42,7 +42,7 @@ unlink(dirname(__FILE__)."/007_variation1.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'r' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
diff --git a/ext/standard/tests/file/007_variation10.phpt b/ext/standard/tests/file/007_variation10.phpt
index ce6d293a9..c9f3e01cf 100644
--- a/ext/standard/tests/file/007_variation10.phpt
+++ b/ext/standard/tests/file/007_variation10.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation10.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'r+t' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
diff --git a/ext/standard/tests/file/007_variation11-win32.phpt b/ext/standard/tests/file/007_variation11-win32.phpt
index 94017e7e5..d9c6e83d4 100644
--- a/ext/standard/tests/file/007_variation11-win32.phpt
+++ b/ext/standard/tests/file/007_variation11-win32.phpt
@@ -61,7 +61,7 @@ unlink(dirname(__FILE__)."/007_variation11.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'wt' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation11.phpt b/ext/standard/tests/file/007_variation11.phpt
index aa75dfad7..0656c6460 100644
--- a/ext/standard/tests/file/007_variation11.phpt
+++ b/ext/standard/tests/file/007_variation11.phpt
@@ -61,7 +61,7 @@ unlink(dirname(__FILE__)."/007_variation11.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'wt' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation12-win32.phpt b/ext/standard/tests/file/007_variation12-win32.phpt
index e439f441b..0fb9ad8df 100644
--- a/ext/standard/tests/file/007_variation12-win32.phpt
+++ b/ext/standard/tests/file/007_variation12-win32.phpt
@@ -61,7 +61,7 @@ unlink(dirname(__FILE__)."/007_variation12.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'w+t' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation12.phpt b/ext/standard/tests/file/007_variation12.phpt
index bb6634fd0..44488fa21 100644
--- a/ext/standard/tests/file/007_variation12.phpt
+++ b/ext/standard/tests/file/007_variation12.phpt
@@ -61,7 +61,7 @@ unlink(dirname(__FILE__)."/007_variation12.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'w+t' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation13-win32.phpt b/ext/standard/tests/file/007_variation13-win32.phpt
index fa6c6db39..736b10104 100644
--- a/ext/standard/tests/file/007_variation13-win32.phpt
+++ b/ext/standard/tests/file/007_variation13-win32.phpt
@@ -53,7 +53,7 @@ unlink(dirname(__FILE__)."/007_variation13.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'at' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(0) ""
diff --git a/ext/standard/tests/file/007_variation13.phpt b/ext/standard/tests/file/007_variation13.phpt
index a0489ee77..0cb48d366 100644
--- a/ext/standard/tests/file/007_variation13.phpt
+++ b/ext/standard/tests/file/007_variation13.phpt
@@ -53,7 +53,7 @@ unlink(dirname(__FILE__)."/007_variation13.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'at' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(0) ""
diff --git a/ext/standard/tests/file/007_variation14.phpt b/ext/standard/tests/file/007_variation14.phpt
index 21f515c96..ed76ab483 100644
--- a/ext/standard/tests/file/007_variation14.phpt
+++ b/ext/standard/tests/file/007_variation14.phpt
@@ -47,7 +47,7 @@ unlink(dirname(__FILE__)."/007_variation14.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'a+t' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(57) "line
diff --git a/ext/standard/tests/file/007_variation15.phpt b/ext/standard/tests/file/007_variation15.phpt
index 018df4159..ce47615bc 100644
--- a/ext/standard/tests/file/007_variation15.phpt
+++ b/ext/standard/tests/file/007_variation15.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation15.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'xt' mode ***
-resource(5) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation16.phpt b/ext/standard/tests/file/007_variation16.phpt
index 8857338cc..c725aa183 100644
--- a/ext/standard/tests/file/007_variation16.phpt
+++ b/ext/standard/tests/file/007_variation16.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation16.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'x+t' mode ***
-resource(5) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation17.phpt b/ext/standard/tests/file/007_variation17.phpt
index fd8dcc326..d3408e9db 100644
--- a/ext/standard/tests/file/007_variation17.phpt
+++ b/ext/standard/tests/file/007_variation17.phpt
@@ -42,7 +42,7 @@ unlink(dirname(__FILE__)."/007_variation17.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'rb' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
diff --git a/ext/standard/tests/file/007_variation18.phpt b/ext/standard/tests/file/007_variation18.phpt
index 2b43b5c3c..991051d5e 100644
--- a/ext/standard/tests/file/007_variation18.phpt
+++ b/ext/standard/tests/file/007_variation18.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation18.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'r+b' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
diff --git a/ext/standard/tests/file/007_variation19.phpt b/ext/standard/tests/file/007_variation19.phpt
index 74f9ebe34..3830e4fc2 100644
--- a/ext/standard/tests/file/007_variation19.phpt
+++ b/ext/standard/tests/file/007_variation19.phpt
@@ -56,7 +56,7 @@ unlink(dirname(__FILE__)."/007_variation19.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'wb' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation2.phpt b/ext/standard/tests/file/007_variation2.phpt
index 774e4af87..4c883ea32 100644
--- a/ext/standard/tests/file/007_variation2.phpt
+++ b/ext/standard/tests/file/007_variation2.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation2.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'r+' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
diff --git a/ext/standard/tests/file/007_variation20.phpt b/ext/standard/tests/file/007_variation20.phpt
index 5a67beda2..4d66dc7ee 100644
--- a/ext/standard/tests/file/007_variation20.phpt
+++ b/ext/standard/tests/file/007_variation20.phpt
@@ -56,7 +56,7 @@ unlink(dirname(__FILE__)."/007_variation20.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'w+b' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation21.phpt b/ext/standard/tests/file/007_variation21.phpt
index ccef2db30..6c968f229 100644
--- a/ext/standard/tests/file/007_variation21.phpt
+++ b/ext/standard/tests/file/007_variation21.phpt
@@ -48,7 +48,7 @@ unlink(dirname(__FILE__)."/007_variation21.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'ab' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(0) ""
diff --git a/ext/standard/tests/file/007_variation22.phpt b/ext/standard/tests/file/007_variation22.phpt
index 61c80e222..d1456fe26 100644
--- a/ext/standard/tests/file/007_variation22.phpt
+++ b/ext/standard/tests/file/007_variation22.phpt
@@ -47,7 +47,7 @@ unlink(dirname(__FILE__)."/007_variation22.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'a+b' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(57) "line
diff --git a/ext/standard/tests/file/007_variation23.phpt b/ext/standard/tests/file/007_variation23.phpt
index 5f21164c5..7886e3287 100644
--- a/ext/standard/tests/file/007_variation23.phpt
+++ b/ext/standard/tests/file/007_variation23.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation23.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'xb' mode ***
-resource(5) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation24.phpt b/ext/standard/tests/file/007_variation24.phpt
index 26130b55b..41fc24cbe 100644
--- a/ext/standard/tests/file/007_variation24.phpt
+++ b/ext/standard/tests/file/007_variation24.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation24.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'x+b' mode ***
-resource(5) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation3.phpt b/ext/standard/tests/file/007_variation3.phpt
index 728f6e2c8..cd31eba1e 100644
--- a/ext/standard/tests/file/007_variation3.phpt
+++ b/ext/standard/tests/file/007_variation3.phpt
@@ -56,7 +56,7 @@ unlink(dirname(__FILE__)."/007_variation3.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'w' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation4.phpt b/ext/standard/tests/file/007_variation4.phpt
index b86e534ab..e88324e83 100644
--- a/ext/standard/tests/file/007_variation4.phpt
+++ b/ext/standard/tests/file/007_variation4.phpt
@@ -56,7 +56,7 @@ unlink(dirname(__FILE__)."/007_variation4.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'w+' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation5.phpt b/ext/standard/tests/file/007_variation5.phpt
index 5cb9f4440..931153457 100644
--- a/ext/standard/tests/file/007_variation5.phpt
+++ b/ext/standard/tests/file/007_variation5.phpt
@@ -48,7 +48,7 @@ unlink(dirname(__FILE__)."/007_variation5.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'a' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(0) ""
diff --git a/ext/standard/tests/file/007_variation6.phpt b/ext/standard/tests/file/007_variation6.phpt
index 4cd6494c1..b274b0592 100644
--- a/ext/standard/tests/file/007_variation6.phpt
+++ b/ext/standard/tests/file/007_variation6.phpt
@@ -47,7 +47,7 @@ unlink(dirname(__FILE__)."/007_variation6.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'a+' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(37)
string(57) "line
diff --git a/ext/standard/tests/file/007_variation7.phpt b/ext/standard/tests/file/007_variation7.phpt
index ffb97e38a..2a3f16533 100644
--- a/ext/standard/tests/file/007_variation7.phpt
+++ b/ext/standard/tests/file/007_variation7.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation7.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'x' mode ***
-resource(5) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation8.phpt b/ext/standard/tests/file/007_variation8.phpt
index bad41136d..aa847115c 100644
--- a/ext/standard/tests/file/007_variation8.phpt
+++ b/ext/standard/tests/file/007_variation8.phpt
@@ -44,7 +44,7 @@ unlink(dirname(__FILE__)."/007_variation8.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'x+' mode ***
-resource(5) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
int(37)
diff --git a/ext/standard/tests/file/007_variation9.phpt b/ext/standard/tests/file/007_variation9.phpt
index b9cc004f8..ab5f1ca01 100644
--- a/ext/standard/tests/file/007_variation9.phpt
+++ b/ext/standard/tests/file/007_variation9.phpt
@@ -42,7 +42,7 @@ unlink(dirname(__FILE__)."/007_variation9.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'rt' mode ***
-resource(8) of type (stream)
+resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
diff --git a/ext/standard/tests/file/bug41655_1.phpt b/ext/standard/tests/file/bug41655_1.phpt
index fbf44fcdf..d02de7066 100644
--- a/ext/standard/tests/file/bug41655_1.phpt
+++ b/ext/standard/tests/file/bug41655_1.phpt
@@ -1,10 +1,12 @@
--TEST--
-Bug #41655 (open_basedir bypass via glob())
+Bug #41655 (open_basedir bypass via glob()) 1/2
--INI--
open_basedir=/tmp
--FILE--
<?php
$a=glob("./*.jpeg");
+
+echo "Done\n";
?>
---EXPECTF--
-Warning: glob(): open_basedir restriction in effect. File%s.) is not within the allowed path(s): (/tmp) in %s on line %d
+--EXPECT--
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/bug41655_2.phpt b/ext/standard/tests/file/bug41655_2.phpt
index a675d599a..23086661f 100644
--- a/ext/standard/tests/file/bug41655_2.phpt
+++ b/ext/standard/tests/file/bug41655_2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #41655: open_basedir bypass via glob()
+Bug #41655 (open_basedir bypass via glob()) 2/2
--INI--
open_basedir=/
--FILE--
@@ -11,6 +11,7 @@ open_basedir=/
--EXPECTF--
Array
(
- [%d] => %sbug41655_1.phpt
- [%d] => %sbug41655_2.phpt
+ [0] => %sbug41655_1.phpt
+ [1] => %sbug41655_2.php
+ [2] => %sbug41655_2.phpt
)
diff --git a/ext/standard/tests/file/bug43137.phpt b/ext/standard/tests/file/bug43137.phpt
new file mode 100644
index 000000000..8125445bb
--- /dev/null
+++ b/ext/standard/tests/file/bug43137.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #43137 (rmdir() and rename() do not clear statcache)
+--FILE--
+<?php
+ $toname = "TO_" . md5(microtime());
+ $dirname = "FROM_" . md5(microtime());
+
+ mkdir($dirname);
+ var_dump(is_dir($dirname)); // Expected: true
+ rename($dirname, $toname);
+ var_dump(is_dir($dirname)); // Expected: false
+ var_dump(is_dir($toname)); // Expected: true
+ rmdir($toname);
+ var_dump(is_dir($toname)); // Expected: false
+?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(true)
+bool(false)
diff --git a/ext/standard/tests/file/copy_variation15.phpt b/ext/standard/tests/file/copy_variation15.phpt
index 127811689..d5b7a4b8b 100644
--- a/ext/standard/tests/file/copy_variation15.phpt
+++ b/ext/standard/tests/file/copy_variation15.phpt
@@ -2,15 +2,15 @@
Test copy() function: usage variations - destination dir access perms
--SKIPIF--
<?php
-if( (stristr(PHP_OS, "Mac")) || (substr(PHP_OS, 0, 3) == "WIN") )
- die("skip do not run on Win/MacOS");
+if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) )
+ die("skip do not run on MacOS/Windows");
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/copy_variation15_root_check.tmp";
$fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
?>
diff --git a/ext/standard/tests/file/copy_variation5.phpt b/ext/standard/tests/file/copy_variation5.phpt
index cd8be7e1d..f4b4f0170 100644
--- a/ext/standard/tests/file/copy_variation5.phpt
+++ b/ext/standard/tests/file/copy_variation5.phpt
@@ -2,8 +2,8 @@
Test copy() function: usage variations - destination file names(case sensitive)
--SKIPIF--
<?php
-if( (stristr(PHP_OS, "Mac")) || (substr(PHP_OS, 0, 3) == "WIN") )
- die("skip do not run on Win/MacOS");
+if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) )
+ die("skip do not run on MacOS/Windows");
?>
--FILE--
<?php
diff --git a/ext/standard/tests/file/copy_variation9.phpt b/ext/standard/tests/file/copy_variation9.phpt
index 1450f3ebc..8f9c2e921 100644
--- a/ext/standard/tests/file/copy_variation9.phpt
+++ b/ext/standard/tests/file/copy_variation9.phpt
@@ -2,8 +2,8 @@
Test copy() function: usage variations - destination file access perms
--SKIPIF--
<?php
-if( (stristr(PHP_OS, "Mac")) || (substr(PHP_OS, 0, 3) == "WIN") )
- die("skip do not run on Win/MacOS");
+if( (stristr(PHP_OS, "Darwin")) || (stristr(PHP_OS, "Win")) )
+ die("skip do not run on MacOS/Windows");
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/copy_variation9_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
?>
diff --git a/ext/standard/tests/file/fgetc_basic.phpt b/ext/standard/tests/file/fgetc_basic.phpt
index fca3a312a..d82110f78 100644
--- a/ext/standard/tests/file/fgetc_basic.phpt
+++ b/ext/standard/tests/file/fgetc_basic.phpt
@@ -21,7 +21,7 @@ for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $ou
echo $outerloop_counter + 1;
echo " ---\n";
// create file file
- create_files(dirname(__FILE__), 1, $file_content_types[$outerloop_counter]);
+ create_files(dirname(__FILE__), 1, $file_content_types[$outerloop_counter], 0755, 1, "w", "fgetc_basic", 1);
//open the file in different modes and check the working of fgetc
for($innerloop_counter = 0; $innerloop_counter < count($file_modes); $innerloop_counter++) {
@@ -32,7 +32,7 @@ for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $ou
echo " --\n";
// open the file using the $file_modes
- $filename = dirname(__FILE__)."/file1.tmp"; // file name that is created by create_files
+ $filename = dirname(__FILE__)."/fgetc_basic1.tmp"; // file name that is created by create_files
echo "-- Testing fgetc() : file opened using $file_modes[$innerloop_counter] mode --\n";
$file_handle = fopen($filename, $file_modes[$innerloop_counter]);
if ( !$file_handle ) {
@@ -40,7 +40,7 @@ for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $ou
exit();
}
- // perform the read file atleast 6 char and check
+ // perform the read file at least 6 char and check
for( $counter = 1; $counter <= 6; $counter++ ) {
// read data from the file and check, file pointer position, feof etc
var_dump( fgetc($file_handle) ); // read a char
@@ -55,7 +55,7 @@ for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $ou
} // end of innerloop for
// delete the file
- delete_files(dirname(__FILE__), 1);
+ delete_files(dirname(__FILE__), 1, "fgetc_basic", 1, ".tmp");
} // end of outerloop for
diff --git a/ext/standard/tests/file/fgetc_variation4.phpt b/ext/standard/tests/file/fgetc_variation4.phpt
index 15d5b60b8..a2bc9e524 100644
--- a/ext/standard/tests/file/fgetc_variation4.phpt
+++ b/ext/standard/tests/file/fgetc_variation4.phpt
@@ -34,7 +34,7 @@ foreach ($file_modes as $file_mode ) {
var_dump( ftell($file_handle) );
var_dump( feof($file_handle) );
- // read from file, atleast 7 chars
+ // read from file, at least 7 chars
for($counter =0; $counter < 7; $counter ++) {
var_dump( fgetc($file_handle) ); // expected : 1 char
var_dump( ftell($file_handle) );
diff --git a/ext/standard/tests/file/file_basic.phpt b/ext/standard/tests/file/file_basic.phpt
index cb15a52c8..e1d9ec561 100644
--- a/ext/standard/tests/file/file_basic.phpt
+++ b/ext/standard/tests/file/file_basic.phpt
@@ -13,17 +13,17 @@ echo "*** Testing file() with basic files ***\n";
$filetypes = array("numeric", "text", "empty", "text_with_new_line");
foreach( $filetypes as $type ) {
- create_files($file_path, 1, $type, 0755, 100, "w", "file", 1, "byte");
- print_r( file($file_path."/file1.tmp") );
- delete_files($file_path, 1);
+ create_files($file_path, 1, $type, 0755, 100, "w", "file_basic", 1, "byte");
+ print_r( file($file_path."/file_basic1.tmp") );
+ delete_files($file_path, 1, "file_basic");
}
echo "*** Testing for return type of file function ***\n";
foreach( $filetypes as $type ) {
- create_files($file_path, 1, $type);
- $ret_arr = file($file_path."/file1.tmp");
+ create_files($file_path, 1, $type, 0755, 1, "w", "file_basic");
+ $ret_arr = file($file_path."/file_basic1.tmp");
var_dump( is_array($ret_arr) );
- delete_files($file_path, 1);
+ delete_files($file_path, 1, "file_basic");
}
echo "\n--- Done ---";
diff --git a/ext/standard/tests/file/file_variation.phpt b/ext/standard/tests/file/file_variation.phpt
index b83148ba8..4672f7d68 100644
--- a/ext/standard/tests/file/file_variation.phpt
+++ b/ext/standard/tests/file/file_variation.phpt
@@ -10,7 +10,7 @@ Test file() function : usage variations
$file_path = dirname(__FILE__);
require($file_path."/file.inc");
-$filename = $file_path."/file.tmp";
+$filename = $file_path."/file_variation.tmp";
$data_array = array( "Garbage data", "Gar\nba\nge d\nata", "Gar\n\nbage \n\n data" );
@@ -27,18 +27,18 @@ foreach( $data_array as $data ) {
}
echo "*** Testing with variation in use_include_path argument ***\n";
-$dir = "/file";
+$dir = "/file_variation";
$file_path = dirname(__FILE__).$dir;
mkdir($file_path);
ini_set( 'include_path', $file_path );
-$filename = $file_path."/file1.tmp";
+$filename = $file_path."/file1_variation.tmp";
$buffer_types = array("text", "numeric", "alphanumeric", "text_with_new_line");
foreach( $buffer_types as $type) {
fill_buffer($buffer, $type, 100);
file_put_contents($filename, $buffer );
- var_dump( file("file1.tmp", FILE_USE_INCLUDE_PATH) );
+ var_dump( file("file1_variation.tmp", FILE_USE_INCLUDE_PATH) );
var_dump( file($filename, FILE_IGNORE_NEW_LINES) );
var_dump( file($filename, FILE_SKIP_EMPTY_LINES) );
@@ -52,11 +52,11 @@ echo "\n--- Done ---";
// Removing the temporary files and directory
$file_path = dirname(__FILE__);
-unlink($file_path."/file.tmp");
+unlink($file_path."/file_variation.tmp");
-$dir = "/file";
+$dir = "/file_variation";
$file_path = dirname(__FILE__).$dir;
-unlink($file_path."/file1.tmp");
+unlink($file_path."/file1_variation.tmp");
rmdir($file_path);
?>
diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt
index 4730d060d..eb88aa36b 100644
--- a/ext/standard/tests/file/fileinode_error.phpt
+++ b/ext/standard/tests/file/fileinode_error.phpt
@@ -26,16 +26,19 @@ echo "\n*** Done ***";
--EXPECTF--
*** Testing error conditions of fileinode() ***
-Warning: fileinode(): stat failed for /no/such/file/dir in %s on line %d
+Warning: fileinode(): stat failed for /no/such/file/dir in %s on line 10
bool(false)
-Warning: fileinode(): stat failed for string in %s on line %d
+Warning: fileinode(): stat failed for string in %s on line 13
bool(false)
-Warning: Wrong parameter count for fileinode() in %s on line %d
+Warning: fileinode(): stat failed for 100 in %s on line 14
+bool(false)
+
+Warning: Wrong parameter count for fileinode() in %s on line 17
NULL
-Warning: Wrong parameter count for fileinode() in %s on line %d
+Warning: Wrong parameter count for fileinode() in %s on line 20
NULL
*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation.phpt b/ext/standard/tests/file/fileinode_variation.phpt
index 8ea9d3a21..1f48d2249 100644
--- a/ext/standard/tests/file/fileinode_variation.phpt
+++ b/ext/standard/tests/file/fileinode_variation.phpt
@@ -5,6 +5,7 @@ Test fileinode() function: Variations
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip no link()/symlink() on Windows');
}
+?>
--FILE--
<?php
/*
@@ -12,46 +13,52 @@ Prototype: int fileinode ( string $filename );
Description: Returns the inode number of the file, or FALSE in case of an error.
*/
-include "file.inc";
-
echo "*** Testing fileinode() with files, links and directories ***\n";
+$file_path = dirname(__FILE__);
+$file1 = $file_path."/fileinode1_variation.tmp";
+$file2 = $file_path."/fileinode2_variation.tmp";
+$link1 = $file_path."/fileinode1_variation_link.tmp";
+$link2 = $file_path."/fileinode2_variation_link.tmp";
+
echo "-- Testing with files --\n";
-create_files( dirname(__FILE__), 2);
+//creating the files
+fclose( fopen( $file1, "w" ) );
+fclose( fopen( $file2, "w" ) );
-print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n";
-print( fileinode( dirname(__FILE__)."/file2.tmp") )."\n";
+print( fileinode( $file1) )."\n";
+print( fileinode( $file2) )."\n";
clearstatcache();
echo "-- Testing with links: hard link --\n";
-link( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/link1.tmp"); // Creating an hard link
-print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n";
+link( $file1, $link1); // Creating an hard link
+print( fileinode( $file1) )."\n";
clearstatcache();
-print( fileinode( dirname(__FILE__)."/link1.tmp") )."\n";
+print( fileinode( $link1) )."\n";
clearstatcache();
echo "-- Testing with links: soft link --\n";
-symlink( dirname(__FILE__)."/file2.tmp", dirname(__FILE__)."/link2.tmp"); // Creating a soft link
-print( fileinode( dirname(__FILE__)."/file2.tmp") )."\n";
+symlink( $file2, $link2); // Creating a soft link
+print( fileinode( $file2) )."\n";
clearstatcache();
-print( fileinode( dirname(__FILE__)."/link2.tmp") )."\n";
+print( fileinode( $link2) )."\n";
-delete_files( dirname(__FILE__), 2, "link");
+unlink( $link1 );
+unlink( $link2 );
echo "-- Testing after copying a file --\n";
-copy( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/file1_new.tmp");
-print( fileinode( dirname(__FILE__)."/file1.tmp") )."\n";
+copy( $file1, $file_path."/fileinode1_variation_new.tmp");
+print( fileinode( $file1) )."\n";
clearstatcache();
-print( fileinode( dirname(__FILE__)."/file1_new.tmp") )."\n";
+print( fileinode( $file_path."/fileinode1_variation_new.tmp") )."\n";
-unlink( dirname(__FILE__)."/file1_new.tmp");
-
-delete_files( dirname(__FILE__), 2);
+unlink( $file_path."/fileinode1_variation_new.tmp");
+unlink( $file1);
+unlink( $file2);
echo "-- Testing after renaming the file --\n";
-$file_path = dirname(__FILE__);
-fopen("$file_path/old.txt", "w");
+fclose( fopen("$file_path/old.txt", "w") );
print( fileinode("$file_path/old.txt") )."\n";
clearstatcache();
diff --git a/ext/standard/tests/file/fileowner_basic.phpt b/ext/standard/tests/file/fileowner_basic.phpt
index c7b72989e..703a36bed 100644
--- a/ext/standard/tests/file/fileowner_basic.phpt
+++ b/ext/standard/tests/file/fileowner_basic.phpt
@@ -1,11 +1,5 @@
--TEST--
Test fileowner() function: basic functionality
---SKIPIF--
-<?php
-if (!function_exists("posix_getpwuid")) {
- die("skip no posix_getpwuid");
-}
-?>
--FILE--
<?php
/* Prototype: int fileowner ( string $filename )
@@ -16,7 +10,7 @@ if (!function_exists("posix_getpwuid")) {
echo "*** Testing fileowner(): basic functionality ***\n";
echo "-- Testing with the file or directory created by owner --\n";
-var_dump( posix_getpwuid ( fileowner(__FILE__) ) );
+var_dump( fileowner(__FILE__) );
var_dump( fileowner(".") );
var_dump( fileowner("./..") );
@@ -33,12 +27,7 @@ $dir_name = $file_path."/fileowner_basic";
mkdir($dir_name);
var_dump( fileowner($dir_name) );
-echo "\n-- Testing with the standard file or directory --\n";
-var_dump( fileowner("/etc/passwd") );
-var_dump( fileowner("/etc") );
-var_dump( fileowner("/") );
-
-echo "\n*** Done ***\n";
+echo "*** Done ***\n";
?>
--CLEAN--
@@ -53,30 +42,9 @@ rmdir($dir_name);
--EXPECTF--
*** Testing fileowner(): basic functionality ***
-- Testing with the file or directory created by owner --
-array(7) {
- ["name"]=>
- string(%d) %s
- ["passwd"]=>
- string(%d) "%s"
- ["uid"]=>
- int(%d)
- ["gid"]=>
- int(%d)
- ["gecos"]=>
- string(%d) %s
- ["dir"]=>
- string(%d) %s
- ["shell"]=>
- string(%d) %s
-}
int(%d)
int(%d)
int(%d)
int(%d)
-
--- Testing with the standard file or directory --
int(%d)
-int(%d)
-int(%d)
-
*** Done ***
diff --git a/ext/standard/tests/file/filetype_variation.phpt b/ext/standard/tests/file/filetype_variation.phpt
index d0c2a7923..3308cee20 100644
--- a/ext/standard/tests/file/filetype_variation.phpt
+++ b/ext/standard/tests/file/filetype_variation.phpt
@@ -6,7 +6,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip no link()/symlink() on Windows');
}
if (!function_exists("posix_mkfifo")) {
- die("skip no posix_mkfifo()");
+ die("skip no posix_mkfifo()");
}
?>
--FILE--
@@ -17,39 +17,44 @@ Description: Returns the type of the file. Possible values are fifo, char,
dir, block, link, file, and unknown.
*/
-include "file.inc";
-
echo "*** Testing filetype() with various types ***\n";
+$file_path = dirname(__FILE__);
+$file1 = $file_path."/filetype1_variation.tmp";
+$file2 = $file_path."/filetype2_variation.tmp";
+$file3 = $file_path."/filetype3_variation.tmp";
+$link1 = $file_path."/filetype1_variation_link.tmp";
+$link2 = $file_path."/filetype2_variation_link.tmp";
-create_files( dirname(__FILE__), 2);
+fclose( fopen($file1, "w") );
+fclose( fopen($file2, "w") );
echo "-- Checking with files --\n";
-print( filetype( dirname(__FILE__)."/file1.tmp") )."\n";
-print( filetype( dirname(__FILE__)."/file2.tmp") )."\n";
+print( filetype($file1) )."\n";
+print( filetype($file2) )."\n";
clearstatcache();
echo "-- Checking with links: hardlink --\n";
-link( dirname(__FILE__)."/file1.tmp", dirname(__FILE__)."/link1.tmp");
-print( filetype( dirname(__FILE__)."/link1.tmp" ) )."\n";
+link( $file1, $link1);
+print( filetype($link1 ) )."\n";
echo "-- Checking with links: symlink --\n";
-symlink( dirname(__FILE__)."/file2.tmp", dirname(__FILE__)."/link2.tmp");
-print( filetype( dirname(__FILE__)."/link2.tmp") )."\n";
+symlink( $file2, $link2);
+print( filetype($link2) )."\n";
-delete_files( dirname(__FILE__), 2, "link");
+unlink($link1);
+unlink($link2);
+unlink($file1);
+unlink($file2);
-delete_files( dirname(__FILE__), 2, "file");
-
-$file_path = dirname(__FILE__);
echo "-- Checking with directory --\n";
-mkdir("$file_path/temp");
-print( filetype("$file_path/temp") )."\n";
-rmdir( "$file_path/temp" );
+mkdir("$file_path/filetype_variation");
+print( filetype("$file_path/filetype_variation") )."\n";
+rmdir( "$file_path/filetype_variation" );
echo "-- Checking with fifo --\n";
-posix_mkfifo( dirname(__FILE__)."/file3.tmp", 0755);
-print( filetype( dirname(__FILE__)."/file3.tmp") )."\n";
-delete_files( dirname(__FILE__), 1, "file", 3);
+posix_mkfifo( $file3, 0755);
+print( filetype( $file3) )."\n";
+unlink($file3);
/* Checking with block in file */
/* To test this PEAR package should be installed */
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt b/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
new file mode 100644
index 000000000..6920f9d2c
--- /dev/null
+++ b/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt
@@ -0,0 +1,804 @@
+--TEST--
+Test fseek(), ftell() & rewind() functions : usage variations - all w and x modes, default whence
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN" )
+ die("skip.. only valid for Windows");
+?>
+--FILE--
+<?php
+/* Prototype: int fseek ( resource $handle, int $offset [, int $whence] );
+ Description: Seeks on a file pointer
+
+ Prototype: bool rewind ( resource $handle );
+ Description: Rewind the position of a file pointer
+
+ Prototype: int ftell ( resource $handle );
+ Description: Tells file pointer read/write position
+*/
+
+// include the file.inc for common functions for test
+include ("file.inc");
+
+/* Testing fseek(),ftell(),rewind() functions
+ 1. All write and create with write modes
+ 2. Testing fseek() without using argument whence
+*/
+
+echo "*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***\n";
+$file_modes = array( "w","wb","wt","w+","w+b","w+t",
+ "x","xb","xt","x+","x+b","x+t");
+$file_content_types = array( "text_with_new_line","alphanumeric");
+
+$offset = array(-1, 0, 1, 513); // different offsets, including negative and beyond size
+
+$filename = dirname(__FILE__)."/fseek_ftell_rewind_variation2.tmp"; // this is name of the file created by create_files()
+
+/* open the file using $files_modes and perform fseek(),ftell() and rewind() on it */
+foreach($file_content_types as $file_content_type){
+ echo "\n-- File having data of type ". $file_content_type ." --\n";
+
+ foreach($file_modes as $file_mode) {
+ echo "-- File opened in mode ".$file_mode." --\n";
+ $file_handle = fopen($filename, $file_mode);
+ if (!$file_handle){
+ echo "Error: failed to fopen() file: $filename!";
+ exit();
+ }
+ $data_to_be_written="";
+ fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
+ $data_to_be_written = $data_to_be_written;
+ fwrite($file_handle,(binary)$data_to_be_written);
+ rewind($file_handle);
+
+ echo "-- Testing fseek() without using argument whence --\n";
+ foreach($offset as $count){
+ var_dump( fseek($file_handle,$count) );
+ var_dump( ftell($file_handle) ); // confirm the file pointer position
+ var_dump( feof($file_handle) ); //ensure that file pointer is not at end
+ } //end of offset loop
+
+ //close the file and check the size
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+
+ delete_file($filename); // delete file with name
+ } //end of file_mode loop
+} //end of file_content_types loop
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+Done
+--UEXPECTF--
+*** Testing fseek(), ftell(), rewind() : default whence & all w and x modes ***
+
+-- File having data of type text_with_new_line --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(569)
+
+-- File having data of type alphanumeric --
+-- File opened in mode w --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode wt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode w+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xb --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode xt --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+ --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+b --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+-- File opened in mode x+t --
+-- Testing fseek() without using argument whence --
+int(-1)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(513)
+bool(false)
+int(512)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/file/is_executable_basic.phpt b/ext/standard/tests/file/is_executable_basic.phpt
index 895f16e1e..730ffc9fc 100644
--- a/ext/standard/tests/file/is_executable_basic.phpt
+++ b/ext/standard/tests/file/is_executable_basic.phpt
@@ -3,7 +3,7 @@ Test is_executable() function: basic functionality
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
@@ -12,7 +12,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt
index d96599d3b..f172f503c 100644
--- a/ext/standard/tests/file/is_executable_variation1.phpt
+++ b/ext/standard/tests/file/is_executable_variation1.phpt
@@ -3,7 +3,7 @@ Test is_executable() function: usage variations - diff. path notations
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_executable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_executable_variation2.phpt b/ext/standard/tests/file/is_executable_variation2.phpt
index e5fac0512..cc7439b06 100644
--- a/ext/standard/tests/file/is_executable_variation2.phpt
+++ b/ext/standard/tests/file/is_executable_variation2.phpt
@@ -3,7 +3,7 @@ Test is_executable() function: usage variations - file/dir with diff. perms
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_executable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt
index 03ae37b25..777599cbf 100644
--- a/ext/standard/tests/file/is_executable_variation3.phpt
+++ b/ext/standard/tests/file/is_executable_variation3.phpt
@@ -3,7 +3,7 @@ Test is_executable() function: usage variations - invalid file names
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_executable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt
index 55aeedfaa..fc0cab85c 100644
--- a/ext/standard/tests/file/is_file_variation4.phpt
+++ b/ext/standard/tests/file/is_file_variation4.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test is_file() function: usage variations - diff. path notations (Bug #42027)
+Test is_file() function: usage variations - diff. path notations (Bug #42027, #42638)
--FILE--
<?php
/* Prototype: bool is_file ( string $filename );
diff --git a/ext/standard/tests/file/is_readable_basic.phpt b/ext/standard/tests/file/is_readable_basic.phpt
index f656f3d16..4d5febfb3 100644
--- a/ext/standard/tests/file/is_readable_basic.phpt
+++ b/ext/standard/tests/file/is_readable_basic.phpt
@@ -3,7 +3,7 @@ Test is_readable() function: basic functionality
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt
index 14cfb5860..2ab1e3d67 100644
--- a/ext/standard/tests/file/is_readable_variation1.phpt
+++ b/ext/standard/tests/file/is_readable_variation1.phpt
@@ -3,7 +3,7 @@ Test is_readable() function: usage variations - diff. file notations
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_readable_variation2.phpt b/ext/standard/tests/file/is_readable_variation2.phpt
index a11f78340..0a3e4f7da 100644
--- a/ext/standard/tests/file/is_readable_variation2.phpt
+++ b/ext/standard/tests/file/is_readable_variation2.phpt
@@ -3,7 +3,7 @@ Test is_readable() function: usage variations - file/dir with diff. perms
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt
index 9e1e4bdb2..e42839ed9 100644
--- a/ext/standard/tests/file/is_readable_variation3.phpt
+++ b/ext/standard/tests/file/is_readable_variation3.phpt
@@ -3,7 +3,7 @@ Test is_readable() function: usage variations - invalid file names
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. only for LINUX');
+ die('skip not for windows');
}
// Skip if being run by root (files are always readable, writeable and executable)
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_writable_basic.phpt b/ext/standard/tests/file/is_writable_basic.phpt
index 27d14dd07..86599b473 100644
--- a/ext/standard/tests/file/is_writable_basic.phpt
+++ b/ext/standard/tests/file/is_writable_basic.phpt
@@ -8,7 +8,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt
index c2a57774e..2d0da9b18 100644
--- a/ext/standard/tests/file/is_writable_variation1.phpt
+++ b/ext/standard/tests/file/is_writable_variation1.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_writable_variation2.phpt b/ext/standard/tests/file/is_writable_variation2.phpt
index dffac8996..40f93b38a 100644
--- a/ext/standard/tests/file/is_writable_variation2.phpt
+++ b/ext/standard/tests/file/is_writable_variation2.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt
index ab2c8e3f3..69de6046d 100644
--- a/ext/standard/tests/file/is_writable_variation3.phpt
+++ b/ext/standard/tests/file/is_writable_variation3.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/lstat_stat_basic.phpt b/ext/standard/tests/file/lstat_stat_basic.phpt
index f3ff81a0d..362fcfe86 100644
--- a/ext/standard/tests/file/lstat_stat_basic.phpt
+++ b/ext/standard/tests/file/lstat_stat_basic.phpt
@@ -24,6 +24,7 @@ echo "*** Testing lstat() & stat() : basic functionality ***\n";
// creating dir
$dirname = "$file_path/lstat_stat_basic";
+@rmdir($dirname);
mkdir($dirname);
// stat of the dir created
$dir_stat = stat($dirname);
diff --git a/ext/standard/tests/file/lstat_stat_variation6.phpt b/ext/standard/tests/file/lstat_stat_variation6.phpt
index de62c05aa..aff6fdc70 100755
--- a/ext/standard/tests/file/lstat_stat_variation6.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation6.phpt
@@ -2,9 +2,17 @@
Test lstat() and stat() functions: usage variations - effects of touch() on link
--SKIPIF--
<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. lstat() not available on Windows');
+if (!(stristr(PHP_OS, 'linux'))) {
+ die('skip.. test valid for linux only');
}
+
+// checking for atime update whether it is enabled or disabled
+exec("mount", $mount_output);
+foreach( $mount_output as $out ) {
+ if( stristr($out, "noatime") )
+ die('skip.. atime update is disabled, hence skip the test');
+}
+
?>
--FILE--
<?php
@@ -32,10 +40,13 @@ symlink($file_name, $link_name); // temp link
// touch a link, check stat, there should be difference in atime
echo "*** Testing lstat() for link after using touch() on the link ***\n";
$old_stat = lstat($link_name);
+sleep(2);
+
// clear the cache
clearstatcache();
-sleep(2);
+
var_dump( touch($link_name) );
+
$new_stat = lstat($link_name);
// compare self stats
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation1.phpt b/ext/standard/tests/file/mkdir_rmdir_variation1.phpt
index 4aae72214..5dc7a7a4d 100644
--- a/ext/standard/tests/file/mkdir_rmdir_variation1.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_variation1.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
index 1bbb60ab7..d09fa5871 100644
--- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/readlink_realpath_basic1.phpt b/ext/standard/tests/file/readlink_realpath_basic1.phpt
index 8616f0f6d..e2a076c94 100644
--- a/ext/standard/tests/file/readlink_realpath_basic1.phpt
+++ b/ext/standard/tests/file/readlink_realpath_basic1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test readlink() and realpath functions: basic functionality - diff. path notation for links
+Test readlink() and realpath functions: basic functionality - diff. path notation for links(Bug #42038)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
diff --git a/ext/standard/tests/file/readlink_realpath_variation1.phpt b/ext/standard/tests/file/readlink_realpath_variation1.phpt
index 7a924c77b..9c795e979 100644
--- a/ext/standard/tests/file/readlink_realpath_variation1.phpt
+++ b/ext/standard/tests/file/readlink_realpath_variation1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test readlink() and realpath() functions: usage variation - linkname/filename stored in object
+Test readlink() and realpath() functions: usage variation - linkname/filename stored in object(Bug #42038)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
diff --git a/ext/standard/tests/file/readlink_realpath_variation2.phpt b/ext/standard/tests/file/readlink_realpath_variation2.phpt
index 1485a860d..0e748576a 100644
--- a/ext/standard/tests/file/readlink_realpath_variation2.phpt
+++ b/ext/standard/tests/file/readlink_realpath_variation2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test readlink() and realpath() functions: usage variation - linkname/filename stored in array
+Test readlink() and realpath() functions: usage variation - linkname/filename stored in array(Bug #42038)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
diff --git a/ext/standard/tests/file/rename_variation.phpt b/ext/standard/tests/file/rename_variation.phpt
index 63b47a37a..ae7a628bd 100644
--- a/ext/standard/tests/file/rename_variation.phpt
+++ b/ext/standard/tests/file/rename_variation.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test rename() function: usage variations-1
+Test rename() function: usage variations-1 (Bug#42638)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt
index 24facf4b2..4cf566ca1 100644
--- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt
@@ -18,7 +18,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/file/unlink_variation1.phpt b/ext/standard/tests/file/unlink_variation1.phpt
index 4046be882..c8a567542 100644
--- a/ext/standard/tests/file/unlink_variation1.phpt
+++ b/ext/standard/tests/file/unlink_variation1.phpt
@@ -11,7 +11,7 @@ $fp = fopen($filename, 'w');
fclose($fp);
if(fileowner($filename) == 0) {
unlink ($filename);
- die('skip...cannot be run as root\n');
+ die('skip cannot be run as root');
}
unlink($filename);
diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt
index 2e8201207..677e6b26f 100644
--- a/ext/standard/tests/general_functions/bug32647.phpt
+++ b/ext/standard/tests/general_functions/bug32647.phpt
@@ -43,8 +43,12 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed
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() cannot 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
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 100755
index 000000000..f8cb94fb5
--- /dev/null
+++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
@@ -0,0 +1,10 @@
+--TEST--
+dl() filename length checks (CVE-2007-4887)
+--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/import_request.phpt b/ext/standard/tests/general_functions/import_request.phpt
index 805d240b8..c48a8f3ed 100644
--- a/ext/standard/tests/general_functions/import_request.phpt
+++ b/ext/standard/tests/general_functions/import_request.phpt
@@ -39,7 +39,7 @@ Notice: import_request_variables(): No prefix specified - possible security haza
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
+Warning: import_request_variables(): Numeric key detected - possible security hazard in %s on line %d
NULL
Notice: Undefined variable: ap in %s on line %d
diff --git a/ext/standard/tests/general_functions/is_callable.phpt b/ext/standard/tests/general_functions/is_callable.phpt
index 66aa1d352..b15703fed 100644
--- a/ext/standard/tests/general_functions/is_callable.phpt
+++ b/ext/standard/tests/general_functions/is_callable.phpt
@@ -2,6 +2,7 @@
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]] );
diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt
index 2a8acc9a8..cc1a30879 100644
--- a/ext/standard/tests/general_functions/phpcredits.phpt
+++ b/ext/standard/tests/general_functions/phpcredits.phpt
@@ -17,28 +17,28 @@ var_dump(phpcredits(CREDITS_GROUP));
PHP Credits
PHP Group
-%s
+%a
Language Design & Concept
-%s
+%a
%wPHP %d Authors%w
-%s
+%a
%wSAPI Modules%w
-%s
+%a
%wModule Authors%w
-%s
+%a
%wPHP Documentation%w
-%s
+%a
PHP Quality Assurance Team
-%s
+%a
PHP Website Team
-%s
+%a
bool(true)
Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits.php on line 4
@@ -50,5 +50,5 @@ bool(true)
PHP Credits
PHP Group
-%s
+%a
bool(true)
diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt
index e3b6e354d..9c5148b1d 100644
--- a/ext/standard/tests/general_functions/phpcredits2.phpt
+++ b/ext/standard/tests/general_functions/phpcredits2.phpt
@@ -18,7 +18,7 @@ var_dump(phpcredits(CREDITS_GROUP));
?>
--EXPECTF--
-<!DOCTYPE %s>%s</html>
+<!DOCTYPE %a>%s</html>
bool(true)
Warning: phpcredits() expects parameter 1 to be long, array given in %sphpcredits2.php on line 4
@@ -28,5 +28,5 @@ NULL
bool(true)
--
<h1>PHP Credits</h1>
-%sPHP Group%s
+%aPHP Group%a
bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
index dab7f327c..32125bfce 100644
--- a/ext/standard/tests/general_functions/phpinfo.phpt
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -24,6 +24,7 @@ Configure Command => %s
Server API => Command Line Interface
Virtual Directory Support => %s
Configuration File (php.ini) Path => %s
+Loaded Configuration File => %s
PHP API => %d
PHP Extension => %d
Zend Extension => %d
@@ -35,7 +36,7 @@ Registered PHP Streams => %s
Registered Stream Socket Transports => %s
Registered Stream Filters => %s
-%s
+%a
_______________________________________________________________________
@@ -43,22 +44,22 @@ Configuration
PHP Core
-%s
+%a
Additional Modules
-%s
+%a
Environment
-%s
+%a
PHP Variables
-%s
+%a
PHP License
-%s
+%a
bool(true)
--
@@ -71,5 +72,5 @@ bool(true)
phpinfo()
PHP License
-%s
+%a
bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt
index ba9cc28ab..cf65e0c98 100644
--- a/ext/standard/tests/general_functions/phpinfo2.phpt
+++ b/ext/standard/tests/general_functions/phpinfo2.phpt
@@ -20,14 +20,14 @@ var_dump(phpinfo(INFO_LICENSE));
?>
--EXPECTF--
<!DOCTYPE %s>
-%s</html>bool(true)
+%a</html>bool(true)
--
Warning: phpinfo() expects parameter 1 to be long, array given in %sphpinfo2.php on line 5
NULL
--
<!DOCTYPE %s>
-%s</html>bool(true)
+%a</html>bool(true)
--
<!DOCTYPE %s>
-%s</html>bool(true)
+%a</html>bool(true)
diff --git a/ext/standard/tests/math/acos_basic.phpt b/ext/standard/tests/math/acos_basic.phpt
new file mode 100644
index 000000000..150eb975a
--- /dev/null
+++ b/ext/standard/tests/math/acos_basic.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test return type and value for expected input acos()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+//output is in degrees
+
+echo "acos .5 = ";
+$acosv1 = 360.0 * acos(0.5) / (2.0 * M_PI );
+var_dump($acosv1);
+if (allowed_rounding_error($acosv1 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "acos 0.86602540378444 = ";
+$acosv2 = 360.0 * acos(0.86602540378444) / (2.0 * M_PI );
+var_dump($acosv2);
+if (allowed_rounding_error($acosv2 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "acos 1.0 = ";
+$acosv3 = 360.0 * acos(1.0) / (2.0 * M_PI);
+var_dump($acosv3);
+if (allowed_rounding_error($acosv3 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "acos 0.0 = ";
+$acosv4 = 360.0 * acos(0.0) / (2.0 * M_PI );
+var_dump($acosv4);
+if (allowed_rounding_error($acosv3 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+acos .5 = float(%f)
+Pass
+acos 0.86602540378444 = float(%f)
+Pass
+acos 1.0 = float(%f)
+Pass
+acos 0.0 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/acos_error.phpt b/ext/standard/tests/math/acos_error.phpt
new file mode 100644
index 000000000..6e3f2ecfd
--- /dev/null
+++ b/ext/standard/tests/math/acos_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for acos()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(acos($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(acos());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for acos() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for acos() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt
new file mode 100644
index 000000000..2503b8b8d
--- /dev/null
+++ b/ext/standard/tests/math/acos_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of acos()
+--INI--
+precision=10
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test acos with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = acos($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(1.570796327)
+float(NAN)
+float(NAN)
+float(1.570796327)
+float(0)
+float(1.570796327)
diff --git a/ext/standard/tests/math/acosh_basic.phpt b/ext/standard/tests/math/acosh_basic.phpt
new file mode 100644
index 000000000..34839ee2f
--- /dev/null
+++ b/ext/standard/tests/math/acosh_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test return type and value for expected input acosh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "acosh 1.1276259652064= ";
+var_dump(acosh(1.1276259652064));
+if (allowed_rounding_error(acosh(1.1276259652064), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "acosh 10.067661995778= ";
+var_dump(acosh(10.067661995778));
+if (allowed_rounding_error(acosh(10.067661995778), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+?>
+--EXPECTF--
+acosh 1.1276259652064= float(%f)
+Pass
+acosh 10.067661995778= float(%f)
+Pass
diff --git a/ext/standard/tests/math/acosh_error.phpt b/ext/standard/tests/math/acosh_error.phpt
new file mode 100644
index 000000000..8a4b9730e
--- /dev/null
+++ b/ext/standard/tests/math/acosh_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test wrong number of arguments for acosh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(acosh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(acosh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for acosh() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for acosh() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt
new file mode 100644
index 000000000..b0e9f9bd8
--- /dev/null
+++ b/ext/standard/tests/math/acosh_variation.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test variations in usage of acosh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test acosh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = acosh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(3.828168471)
+float(NAN)
+float(3.847562739)
+float(NAN)
+float(3.828168471)
+float(3.828168471)
+float(3.828168471)
+float(3.847562739)
+float(3.847562739)
+float(NAN)
+float(7.60090221)
+float(7.60090221)
+float(NAN)
+float(0)
+float(NAN)
diff --git a/ext/standard/tests/math/allowed_rounding_error.inc b/ext/standard/tests/math/allowed_rounding_error.inc
new file mode 100644
index 000000000..71dbf9af4
--- /dev/null
+++ b/ext/standard/tests/math/allowed_rounding_error.inc
@@ -0,0 +1,18 @@
+<?php
+function allowed_rounding_error ($number, $expected) {
+
+ //different machines may give slightly different floating point numbers
+ //This assumes that the results will be the same to + or - 1.0E-10.
+
+ $small_number = 1.0e-10;
+ $min = $expected - $small_number;
+ $max = $expected + $small_number;
+
+ if ($number < $max && $number > $min ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+?> \ No newline at end of file
diff --git a/ext/standard/tests/math/asin_basic.phpt b/ext/standard/tests/math/asin_basic.phpt
new file mode 100644
index 000000000..183f7449b
--- /dev/null
+++ b/ext/standard/tests/math/asin_basic.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test return type and value for expected input asin()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+//output is in degrees
+
+echo "asin .5 = ";
+$asinv1 = 360.0 * asin(0.5) / (2.0 * M_PI );
+var_dump($asinv1);
+if (allowed_rounding_error($asinv1 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asin 0.86602540378444 = ";
+$asinv2 = 360.0 * asin(0.86602540378444) / (2.0 * M_PI );
+var_dump($asinv2);
+if (allowed_rounding_error($asinv2 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asin 1.0 = ";
+$asinv3 = 360.0 * asin(1.0) / (2.0 * M_PI );
+var_dump($asinv3);
+if (allowed_rounding_error($asinv3 ,90 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "asin 0.0 = ";
+$asinv4 = 360.0 * asin(0.0) / (2.0 * M_PI );
+var_dump($asinv4);
+if (allowed_rounding_error($asinv4 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+asin .5 = float(%f)
+Pass
+asin 0.86602540378444 = float(%f)
+Pass
+asin 1.0 = float(%f)
+Pass
+asin 0.0 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/asin_error.phpt b/ext/standard/tests/math/asin_error.phpt
new file mode 100644
index 000000000..21c824b55
--- /dev/null
+++ b/ext/standard/tests/math/asin_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for asin()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(asin($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(asin());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for asin() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for asin() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt
new file mode 100644
index 000000000..2902e969b
--- /dev/null
+++ b/ext/standard/tests/math/asin_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of asin()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test asin with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = asin($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(0)
+float(NAN)
+float(NAN)
+float(0)
+float(1.570796327)
+float(0)
diff --git a/ext/standard/tests/math/asinh_basic.phpt b/ext/standard/tests/math/asinh_basic.phpt
new file mode 100644
index 000000000..61f173155
--- /dev/null
+++ b/ext/standard/tests/math/asinh_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test return type and value for expected input asinh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN")
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "asinh 0.52109530549375= ";
+var_dump(asinh(0.52109530549375));
+if (allowed_rounding_error(asinh(0.52109530549375), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asinh 10.01787492741= ";
+var_dump(asinh(10.01787492741));
+if (allowed_rounding_error(asinh(10.01787492741), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+asinh 0.52109530549375= float(%f)
+Pass
+asinh 10.01787492741= float(%f)
+Pass
diff --git a/ext/standard/tests/math/asinh_error.phpt b/ext/standard/tests/math/asinh_error.phpt
new file mode 100644
index 000000000..e6439d1bd
--- /dev/null
+++ b/ext/standard/tests/math/asinh_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test wrong number of arguments for asinh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(asinh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(asinh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for asinh() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for asinh() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt
new file mode 100644
index 000000000..00ade0b8d
--- /dev/null
+++ b/ext/standard/tests/math/asinh_variation.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test variations in usage of asinh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test asinh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = asinh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(3.829113652)
+float(-3.829113652)
+float(3.848471992)
+float(-3.848471992)
+float(3.829113652)
+float(3.829113652)
+float(3.829113652)
+float(3.848471992)
+float(3.848471992)
+float(0)
+float(7.60090271)
+float(7.60090271)
+float(0)
+float(0.881373587)
+float(0)
diff --git a/ext/standard/tests/math/atan_basic.phpt b/ext/standard/tests/math/atan_basic.phpt
new file mode 100644
index 000000000..f4a2bedf7
--- /dev/null
+++ b/ext/standard/tests/math/atan_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test return type and value for expected input atan()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "atan 1.7320508075689 = ";
+$atan1 = 360 * atan(1.7320508075689) / (2.0 * M_PI);
+var_dump($atan1);
+if (allowed_rounding_error($atan1 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "atan 0.57735026918963 = ";
+$atan2 = 360 * atan(0.57735026918963) / (2.0 * M_PI);
+var_dump($atan2);
+if (allowed_rounding_error($atan2 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+atan 1.7320508075689 = float(%f)
+Pass
+atan 0.57735026918963 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/atan_error.phpt b/ext/standard/tests/math/atan_error.phpt
new file mode 100644
index 000000000..07cc93aea
--- /dev/null
+++ b/ext/standard/tests/math/atan_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for atan()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(atan($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(atan());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for atan() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for atan() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt
new file mode 100644
index 000000000..a53099d10
--- /dev/null
+++ b/ext/standard/tests/math/atan_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of atan()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test atan with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = atan($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(1.527345431)
+float(-1.527345431)
+float(1.528178225)
+float(-1.528178225)
+float(1.527345431)
+float(1.527345431)
+float(1.527345431)
+float(1.528178225)
+float(1.528178225)
+float(0)
+float(1.569796327)
+float(1.569796327)
+float(0)
+float(0.7853981634)
+float(0)
diff --git a/ext/standard/tests/math/atanh_basic.phpt b/ext/standard/tests/math/atanh_basic.phpt
new file mode 100644
index 000000000..c259bdb82
--- /dev/null
+++ b/ext/standard/tests/math/atanh_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test return type and value for expected input atanh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "atanh 0.46211715726001 = ";
+var_dump(atanh(0.46211715726001));
+if (allowed_rounding_error(atanh(0.46211715726001), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "atanh 0.99505475368673 = ";
+var_dump(atanh(0.99505475368673));
+if (allowed_rounding_error(atanh(0.99505475368673), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+?>
+--EXPECTF--
+atanh 0.46211715726001 = float(%f)
+Pass
+atanh 0.99505475368673 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/atanh_error.phpt b/ext/standard/tests/math/atanh_error.phpt
new file mode 100644
index 000000000..cb6fb6def
--- /dev/null
+++ b/ext/standard/tests/math/atanh_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test wrong number of arguments for atanh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(atanh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(atanh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for atanh() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for atanh() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt
new file mode 100644
index 000000000..879b9a9f2
--- /dev/null
+++ b/ext/standard/tests/math/atanh_variation.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test variations in usage of atanh()
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) == "WIN" )
+ die ("skip - function not supported on Windows");
+?>
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test atanh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = atanh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(0)
+float(NAN)
+float(NAN)
+float(0)
+float(INF)
+float(0)
diff --git a/ext/standard/tests/math/cos_basic.phpt b/ext/standard/tests/math/cos_basic.phpt
new file mode 100644
index 000000000..f0cfa66ee
--- /dev/null
+++ b/ext/standard/tests/math/cos_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test return type and value for expected input cos()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+// Use known values to test
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+$ninety = M_PI /2.0;
+$oneeighty = M_PI;
+$twoseventy = M_PI * 1.5;
+$threesixty = M_PI * 2.0;
+
+
+echo "cos 30 = ";
+var_dump(cos($thirty));
+if (allowed_rounding_error(cos($thirty),0.86602540378444)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 60 = ";
+var_dump(cos($sixty));
+if (allowed_rounding_error(cos($sixty),0.5)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 90 = ";
+var_dump(cos($ninety));
+if (allowed_rounding_error(cos($ninety),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 180 = ";
+var_dump(cos($oneeighty));
+if (allowed_rounding_error(cos($oneeighty),-1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 270 = ";
+var_dump(cos($twoseventy));
+if (allowed_rounding_error(cos($twoseventy),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 360 = ";
+var_dump(cos($threesixty));
+if (allowed_rounding_error(cos($threesixty),1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+cos 30 = float(%f)
+Pass
+cos 60 = float(%f)
+Pass
+cos 90 = float(%f)
+Pass
+cos 180 = float(%f)
+Pass
+cos 270 = float(%f)
+Pass
+cos 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/cos_error.phpt b/ext/standard/tests/math/cos_error.phpt
new file mode 100644
index 000000000..1a9a26ce6
--- /dev/null
+++ b/ext/standard/tests/math/cos_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for cos()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(cos($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(cos());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for cos() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for cos() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt
new file mode 100644
index 000000000..0ae3c30da
--- /dev/null
+++ b/ext/standard/tests/math/cos_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of cos()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test cos with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = cos($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.1117112391)
+float(-0.1117112391)
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.1117112391)
+float(-0.1117112391)
+float(1)
+float(0.5623790763)
+float(0.5623790763)
+float(1)
+float(0.5403023059)
+float(1)
diff --git a/ext/standard/tests/math/cosh_basic.phpt b/ext/standard/tests/math/cosh_basic.phpt
new file mode 100644
index 000000000..0a637ca8e
--- /dev/null
+++ b/ext/standard/tests/math/cosh_basic.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test return type and value for expected input cosh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "cosh .5 = ";
+var_dump(cosh(0.5));
+
+if (allowed_rounding_error(cosh(0.5),1.1276259652064)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh -0.5 = ";
+var_dump(cosh(-0.5));
+if (allowed_rounding_error(cosh(-0.5),1.1276259652064)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh 3 = ";
+var_dump(cosh(3.0));
+if (allowed_rounding_error(cosh(3.0), 10.067661995778)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh -3 = ";
+var_dump(cosh(-3.0));
+if (allowed_rounding_error(cosh(-3.0), 10.067661995778)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+cosh .5 = float(%f)
+Pass
+cosh -0.5 = float(%f)
+Pass
+cosh 3 = float(%f)
+Pass
+cosh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/cosh_error.phpt b/ext/standard/tests/math/cosh_error.phpt
new file mode 100644
index 000000000..f91cb256a
--- /dev/null
+++ b/ext/standard/tests/math/cosh_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for cosh()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(cosh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(cosh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for cosh() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for cosh() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt
new file mode 100644
index 000000000..3bd8852a5
--- /dev/null
+++ b/ext/standard/tests/math/cosh_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of cosh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test cosh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = cosh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+float(4872401723)
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+float(1)
+float(INF)
+float(INF)
+float(1)
+float(1.543080635)
+float(1)
diff --git a/ext/standard/tests/math/sin_basic.phpt b/ext/standard/tests/math/sin_basic.phpt
new file mode 100644
index 000000000..2b55ad735
--- /dev/null
+++ b/ext/standard/tests/math/sin_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test return type and value for expected input sin()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+// Use known values to test
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+$ninety = M_PI /2.0;
+$oneeighty = M_PI;
+$twoseventy = M_PI * 1.5;
+$threesixty = M_PI * 2.0;
+
+
+echo "sin 30 = ";
+var_dump(sin($thirty));
+if (allowed_rounding_error(sin($thirty),0.5)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 60 = ";
+var_dump(sin($sixty));
+if (allowed_rounding_error(sin($sixty),0.86602540378444)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 90 = ";
+var_dump(sin($ninety));
+if (allowed_rounding_error(sin($ninety),1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 180 = ";
+var_dump(sin($oneeighty));
+if (allowed_rounding_error(sin($oneeighty),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 270 = ";
+var_dump(sin($twoseventy));
+if (allowed_rounding_error(sin($twoseventy),-1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 360 = ";
+var_dump(sin($threesixty));
+if (allowed_rounding_error(sin($threesixty),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+sin 30 = float(%f)
+Pass
+sin 60 = float(%f)
+Pass
+sin 90 = float(%f)
+Pass
+sin 180 = float(%f)
+Pass
+sin 270 = float(%f)
+Pass
+sin 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/sin_error.phpt b/ext/standard/tests/math/sin_error.phpt
new file mode 100644
index 000000000..e2693ea8f
--- /dev/null
+++ b/ext/standard/tests/math/sin_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for sin()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sin($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sin());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for sin() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for sin() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt
new file mode 100644
index 000000000..0e79317d4
--- /dev/null
+++ b/ext/standard/tests/math/sin_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of sin()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sin with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sin($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(-0.8462204042)
+float(0.8462204042)
+float(-0.9937407102)
+float(0.9937407102)
+float(-0.8462204042)
+float(-0.8462204042)
+float(-0.8462204042)
+float(-0.9937407102)
+float(-0.9937407102)
+float(0)
+float(0.8268795405)
+float(0.8268795405)
+float(0)
+float(0.8414709848)
+float(0)
diff --git a/ext/standard/tests/math/sinh_basic.phpt b/ext/standard/tests/math/sinh_basic.phpt
new file mode 100644
index 000000000..79bef6314
--- /dev/null
+++ b/ext/standard/tests/math/sinh_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test return type and value for expected input sinh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "sinh .5 = ";
+var_dump(sinh(0.5));
+if (allowed_rounding_error(sinh(0.5),0.52109530549375)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh -0.5 = ";
+var_dump(sinh(-0.5));
+if (allowed_rounding_error(sinh(-0.5), -0.52109530549375)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh 3 = ";
+var_dump(sinh(3.0));
+if (allowed_rounding_error(sinh(3.0), 10.01787492741)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh -3 = ";
+var_dump(sinh(-3.0));
+if (allowed_rounding_error(sinh(-3.0), -10.01787492741)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+sinh .5 = float(%f)
+Pass
+sinh -0.5 = float(%f)
+Pass
+sinh 3 = float(%f)
+Pass
+sinh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/sinh_error.phpt b/ext/standard/tests/math/sinh_error.phpt
new file mode 100644
index 000000000..415d6b09b
--- /dev/null
+++ b/ext/standard/tests/math/sinh_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for sinh()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sinh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sinh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for sinh() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for sinh() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt
new file mode 100644
index 000000000..c0f238582
--- /dev/null
+++ b/ext/standard/tests/math/sinh_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of sinh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sinh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sinh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(4872401723)
+float(-4872401723)
+float(7641446995)
+float(-7641446995)
+float(4872401723)
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+float(0)
+float(INF)
+float(INF)
+float(0)
+float(1.175201194)
+float(0)
diff --git a/ext/standard/tests/math/tan_basic.phpt b/ext/standard/tests/math/tan_basic.phpt
new file mode 100644
index 000000000..e2934fb38
--- /dev/null
+++ b/ext/standard/tests/math/tan_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input tan()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+
+echo "tan 60 = ";
+var_dump(tan($sixty));
+if (allowed_rounding_error(tan($sixty),1.7320508075689)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tan 30 = ";
+var_dump(tan($thirty));
+if (allowed_rounding_error(tan($thirty),0.57735026918963)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+tan 60 = float(%f)
+Pass
+tan 30 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/tan_error.phpt b/ext/standard/tests/math/tan_error.phpt
new file mode 100644
index 000000000..58dcc2a43
--- /dev/null
+++ b/ext/standard/tests/math/tan_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for tan()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(tan($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(tan());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for tan() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for tan() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt
new file mode 100644
index 000000000..9628d7660
--- /dev/null
+++ b/ext/standard/tests/math/tan_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of tan()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test tan with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = tan($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(1.588153083)
+float(-1.588153083)
+float(8.895619796)
+float(-8.895619796)
+float(1.588153083)
+float(1.588153083)
+float(1.588153083)
+float(8.895619796)
+float(8.895619796)
+float(0)
+float(1.470324156)
+float(1.470324156)
+float(0)
+float(1.557407725)
+float(0)
diff --git a/ext/standard/tests/math/tanh_basic.phpt b/ext/standard/tests/math/tanh_basic.phpt
new file mode 100644
index 000000000..6b6a9dff7
--- /dev/null
+++ b/ext/standard/tests/math/tanh_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test return type and value for expected input tanh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+echo "tanh .5 = ";
+var_dump(tanh(0.5));
+if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh -0.5 = ";
+var_dump(tanh(-0.5));
+if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh 3 = ";
+var_dump(tanh(3.0));
+if (allowed_rounding_error(tanh(3.0),0.99505475368673 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh -3 = ";
+var_dump(tanh(-3.0));
+if (allowed_rounding_error(tanh(-3.0),-0.99505475368673 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+tanh .5 = float(%f)
+Pass
+tanh -0.5 = float(%f)
+Pass
+tanh 3 = float(%f)
+Pass
+tanh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/tanh_error.phpt b/ext/standard/tests/math/tanh_error.phpt
new file mode 100644
index 000000000..8ce3e9131
--- /dev/null
+++ b/ext/standard/tests/math/tanh_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test wrong number of arguments for tanh()
+--INI--
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(tanh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(tanh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: Wrong parameter count for tanh() in %s on line 11
+NULL
+
+Too few arguments
+
+Warning: Wrong parameter count for tanh() in %s on line 14
+NULL
diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt
new file mode 100644
index 000000000..5e4afad8f
--- /dev/null
+++ b/ext/standard/tests/math/tanh_variation.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test variations in usage of tanh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test tanh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = tanh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECT--
+float(1)
+float(-1)
+float(1)
+float(-1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(0)
+float(1)
+float(1)
+float(0)
+float(0.761594156)
+float(0)
diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt
new file mode 100644
index 000000000..bc3e72c2a
--- /dev/null
+++ b/ext/standard/tests/network/ip_x86_64.phpt
@@ -0,0 +1,67 @@
+--TEST--
+ip2long() & long2ip() tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only");
+?>
+--FILE--
+<?php
+
+$array = array(
+ "127.0.0.1",
+ "10.0.0.1",
+ "255.255.255.255",
+ "255.255.255.0",
+ "0.0.0.0",
+ "66.163.161.116",
+);
+
+foreach ($array as $ip) {
+ var_dump($long = ip2long($ip));
+ var_dump(long2ip($long));
+}
+
+var_dump(ip2long());
+var_dump(ip2long(""));
+var_dump(ip2long("777.777.777.777"));
+var_dump(ip2long("111.111.111.111"));
+var_dump(ip2long(array()));
+
+var_dump(long2ip());
+var_dump(long2ip(-110000));
+var_dump(long2ip(""));
+var_dump(long2ip(array()));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(2130706433)
+string(9) "127.0.0.1"
+int(167772161)
+string(8) "10.0.0.1"
+int(4294967295)
+string(15) "255.255.255.255"
+int(4294967040)
+string(13) "255.255.255.0"
+int(0)
+string(7) "0.0.0.0"
+int(1118019956)
+string(14) "66.163.161.116"
+
+Warning: Wrong parameter count for ip2long() in %s on line %d
+NULL
+bool(false)
+bool(false)
+int(1869573999)
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for long2ip() in %s on line %d
+NULL
+string(13) "255.254.82.80"
+string(7) "0.0.0.0"
+
+Notice: Array to string conversion in %s on line %d
+string(7) "0.0.0.0"
+Done
diff --git a/ext/standard/tests/strings/addcslashes.phpt b/ext/standard/tests/strings/addcslashes.phpt
deleted file mode 100644
index 2ff4c4024..000000000
--- a/ext/standard/tests/strings/addcslashes.phpt
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt
new file mode 100644
index 000000000..e1969e98d
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_001.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/addcslashes_002.phpt b/ext/standard/tests/strings/addcslashes_002.phpt
new file mode 100644
index 000000000..eb46803bb
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_002.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test addcslashes() function (variation 2)
+--INI--
+precision=14
+--FILE--
+<?php
+
+$string = "goodyear12345NULL\0truefalse\a\v\f\b\n\r\t";
+/* charlist "\0..\37" would escape all characters with ASCII code between 0 and 31 */
+echo "\n*** Testing addcslashes() with ASCII code between 0 and 31 ***\n";
+var_dump( addcslashes($string, "\0..\37") );
+
+/* Checking OBJECTS type */
+echo "\n*** Testing addcslashes() with objects ***\n";
+class string1
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+$obj = new string1;
+var_dump( addcslashes($obj, "b") );
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing addcslashes() with ASCII code between 0 and 31 ***
+string(44) "goodyear12345NULL\000truefalse\a\v\f\b\n\r\t"
+
+*** Testing addcslashes() with objects ***
+string(7) "O\bject"
+Done
diff --git a/ext/standard/tests/strings/addcslashes_003.phpt b/ext/standard/tests/strings/addcslashes_003.phpt
new file mode 100644
index 000000000..f1d658135
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_003.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/addcslashes_004.phpt b/ext/standard/tests/strings/addcslashes_004.phpt
new file mode 100644
index 000000000..8f314fb55
--- /dev/null
+++ b/ext/standard/tests/strings/addcslashes_004.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test addcslashes() function (errors)
+--INI--
+precision=14
+--FILE--
+<?php
+
+echo "\n*** Testing error conditions ***\n";
+/* zero argument */
+var_dump( addcslashes() );
+
+/* unexpected arguments */
+var_dump( addcslashes("foo[]") );
+var_dump( addcslashes('foo[]', "o", "foo") );
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for addcslashes() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for addcslashes() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for addcslashes() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/addslashes_basic.phpt b/ext/standard/tests/strings/addslashes_basic.phpt
new file mode 100644
index 000000000..6ed121067
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test addslashes() function : basic functionality
+--INI--
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters (single quotes, double quote,
+ * backslash and nul character) that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing addslashes() with strings containing characters that can be prefixed with backslash
+ * by the function
+*/
+
+echo "*** Testing addslashes() : basic functionality ***\n";
+
+// Initialize all required variables
+$str_array = array( "How's everybody", // string containing single quote
+ 'Are you "JOHN"?', // string with double quotes
+ 'c:\php\addslashes', // string with backslashes
+ "hello\0world" // string with nul character
+ );
+
+// Calling addslashes() with all arguments
+foreach( $str_array as $str ) {
+ var_dump( addslashes($str) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : basic functionality ***
+string(16) "How\'s everybody"
+string(17) "Are you \"JOHN\"?"
+string(19) "c:\\php\\addslashes"
+string(12) "hello\0world"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/addslashes_error.phpt b/ext/standard/tests/strings/addslashes_error.phpt
new file mode 100644
index 000000000..b51271693
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test addslashes() function : error conditions
+--INI--
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing addslashes() for error conditions
+*/
+
+echo "*** Testing addslashes() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing addslashes() function with Zero arguments --\n";
+var_dump( addslashes() );
+
+// More than expected number of arguments
+echo "\n-- Testing addslashes() function with more than expected no. of arguments --\n";
+$str = '"hello"\"world"';
+$extra_arg = 10;
+
+var_dump( addslashes($str, $extra_arg) );
+var_dump( $str );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : error conditions ***
+
+-- Testing addslashes() function with Zero arguments --
+
+Warning: Wrong parameter count for addslashes() in %s on line %d
+NULL
+
+-- Testing addslashes() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for addslashes() in %s on line %d
+NULL
+string(15) ""hello"\"world""
+Done
diff --git a/ext/standard/tests/strings/addslashes_variation1.phpt b/ext/standard/tests/strings/addslashes_variation1.phpt
new file mode 100644
index 000000000..a86f86d05
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_variation1.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test addslashes() function : usage variations - non-string type argument
+--INI--
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test addslashes() with non-string type argument such as int, float, etc
+*/
+
+echo "*** Testing addslashes() : with non-string type argument ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj'ct";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ "",
+ '',
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ NULL,
+ null
+);
+
+
+// loop through each element of the array and check the working of addslashes()
+// when $str arugment is supplied with different values
+echo "\n--- Testing addslashes() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( addslashes($str) );
+
+ $counter ++;
+}
+
+// closing the file
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : with non-string type argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing addslashes() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(5) "-10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+-- Iteration 20 --
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+-- Iteration 23 --
+string(7) "obj\'ct"
+-- Iteration 24 --
+string(%d) "Resource id #%d"
+-- Iteration 25 --
+string(0) ""
+-- Iteration 26 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/addslashes_variation2.phpt b/ext/standard/tests/strings/addslashes_variation2.phpt
new file mode 100644
index 000000000..285d9058a
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_variation2.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test addslashes() function : usage variations - strings with characters to be backslashed
+--INI--
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test addslashes() with various strings containing characters thats can be backslashed
+*/
+
+echo "*** Testing addslashes() : with various strings containing characters to be backslashed ***\n";
+
+// initialising a heredoc string
+$heredoc_string = <<<EOT
+This is line 1 of 'heredoc' string
+This is line 2 of "heredoc" string
+EOT;
+
+$heredoc_null_string =<<<EOT
+EOT;
+
+// initialising the string array
+
+$str_array = array(
+ // string without any characters that can be backslashed
+ 'Hello world',
+
+ // string with single quotes
+ "how're you doing?",
+ "don't disturb u'r neighbours",
+ "don't disturb u'r neighbours''",
+ '',
+ '\'',
+ "'",
+
+ // string with double quotes
+ 'he said, "he will be on leave"',
+ 'he said, ""he will be on leave"',
+ '"""PHP"""',
+ "",
+ "\"",
+ '"',
+ "hello\"",
+
+ // string with backslash characters
+ 'Is your name Ram\Krishna?',
+ '\\0.0.0.0',
+ 'c:\php\testcase\addslashes',
+ '\\',
+
+ // string with nul characters
+ 'hello'.chr(0).'world',
+ chr(0).'hello'.chr(0),
+ chr(0).chr(0).'hello',
+ chr(0),
+
+ // mixed strings
+ "'\\0.0.0.0'",
+ "'\\0.0.0.0'".chr(0),
+ chr(0)."'c:\php\'",
+ '"\\0.0.0.0"',
+ '"c:\php\"'.chr(0)."'",
+ '"hello"'."'world'".chr(0).'//',
+
+ // string with hexadecimal number
+ "0xABCDEF0123456789",
+ "\x00",
+ '!@#$%&*@$%#&/;:,<>',
+ "hello\x00world",
+
+ // heredoc strings
+ $heredoc_string,
+ $heredoc_null_string
+ );
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $str ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( addslashes($str) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : with various strings containing characters to be backslashed ***
+
+-- Iteration 1 --
+string(11) "Hello world"
+
+-- Iteration 2 --
+string(18) "how\'re you doing?"
+
+-- Iteration 3 --
+string(30) "don\'t disturb u\'r neighbours"
+
+-- Iteration 4 --
+string(34) "don\'t disturb u\'r neighbours\'\'"
+
+-- Iteration 5 --
+string(0) ""
+
+-- Iteration 6 --
+string(2) "\'"
+
+-- Iteration 7 --
+string(2) "\'"
+
+-- Iteration 8 --
+string(32) "he said, \"he will be on leave\""
+
+-- Iteration 9 --
+string(34) "he said, \"\"he will be on leave\""
+
+-- Iteration 10 --
+string(15) "\"\"\"PHP\"\"\""
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(2) "\""
+
+-- Iteration 13 --
+string(2) "\""
+
+-- Iteration 14 --
+string(7) "hello\""
+
+-- Iteration 15 --
+string(26) "Is your name Ram\\Krishna?"
+
+-- Iteration 16 --
+string(9) "\\0.0.0.0"
+
+-- Iteration 17 --
+string(29) "c:\\php\\testcase\\addslashes"
+
+-- Iteration 18 --
+string(2) "\\"
+
+-- Iteration 19 --
+string(12) "hello\0world"
+
+-- Iteration 20 --
+string(9) "\0hello\0"
+
+-- Iteration 21 --
+string(9) "\0\0hello"
+
+-- Iteration 22 --
+string(2) "\0"
+
+-- Iteration 23 --
+string(13) "\'\\0.0.0.0\'"
+
+-- Iteration 24 --
+string(15) "\'\\0.0.0.0\'\0"
+
+-- Iteration 25 --
+string(15) "\0\'c:\\php\\\'"
+
+-- Iteration 26 --
+string(13) "\"\\0.0.0.0\""
+
+-- Iteration 27 --
+string(17) "\"c:\\php\\\"\0\'"
+
+-- Iteration 28 --
+string(22) "\"hello\"\'world\'\0//"
+
+-- Iteration 29 --
+string(18) "0xABCDEF0123456789"
+
+-- Iteration 30 --
+string(2) "\0"
+
+-- Iteration 31 --
+string(18) "!@#$%&*@$%#&/;:,<>"
+
+-- Iteration 32 --
+string(12) "hello\0world"
+
+-- Iteration 33 --
+string(73) "This is line 1 of \'heredoc\' string
+This is line 2 of \"heredoc\" string"
+
+-- Iteration 34 --
+string(0) ""
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/addslashes_variation3.phpt b/ext/standard/tests/strings/addslashes_variation3.phpt
new file mode 100644
index 000000000..302ca7e18
--- /dev/null
+++ b/ext/standard/tests/strings/addslashes_variation3.phpt
@@ -0,0 +1,197 @@
+--TEST--
+Test addslashes() function : usage variations - with magic_quotes_sybase directive ON
+--INI--
+--FILE--
+<?php
+/* Prototype : string addslashes ( string $str )
+ * Description: Returns a string with backslashes before characters that need to be quoted in database queries etc.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test addslashes() with PHP directive magic_quotes_sybase set ON
+*/
+
+echo "*** Testing addslashes() : with php directive magic_quotes_sybase set ON ***\n";
+
+// setting ON the php directive magic_quotes_sybase
+ini_set("magic_quotes_sybase", "1");
+
+// initialising a heredoc string
+$heredoc_string = <<<EOT
+This is line 1 of 'heredoc' string
+This is line 2 of "heredoc" string
+EOT;
+
+$heredoc_null_string =<<<EOT
+EOT;
+
+// initialising the string array
+$str_array = array(
+ // string without any characters that can be backslashed
+ 'Hello world',
+
+ // string with single quotes
+ "how're you doing?",
+ "don't disturb u'r neighbours",
+ "don't disturb u'r neighbours''",
+ '',
+ '\'',
+ "'",
+
+ // string with double quotes
+ 'he said, "he will be on leave"',
+ 'he said, ""he will be on leave"',
+ '"""PHP"""',
+ "",
+ "\"",
+ '"',
+ "hello\"",
+
+ // string with backslash characters
+ 'Is your name Ram\Krishna?',
+ '\\0.0.0.0',
+ 'c:\php\testcase\addslashes',
+ '\\',
+
+ // string with nul characters
+ 'hello'.chr(0).'world',
+ chr(0).'hello'.chr(0),
+ chr(0).chr(0).'hello',
+ chr(0),
+
+ // mixed strings
+ "'\\0.0.0.0'",
+ "'\\0.0.0.0'".chr(0),
+ chr(0)."'c:\php\'",
+ '"\\0.0.0.0"',
+ '"c:\php\"'.chr(0)."'",
+ '"hello"'."'world'".chr(0).'//',
+
+ // string with hexadecimal number
+ "0xABCDEF0123456789",
+ "\xabcdef0123456789",
+ '!@#$%&*@$%#&/;:,<>',
+ "hello\x00world",
+
+ // heredoc strings
+ $heredoc_string,
+ $heredoc_null_string
+ );
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $str ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( addslashes($str) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing addslashes() : with php directive magic_quotes_sybase set ON ***
+
+-- Iteration 1 --
+string(11) "Hello world"
+
+-- Iteration 2 --
+string(18) "how''re you doing?"
+
+-- Iteration 3 --
+string(30) "don''t disturb u''r neighbours"
+
+-- Iteration 4 --
+string(34) "don''t disturb u''r neighbours''''"
+
+-- Iteration 5 --
+string(0) ""
+
+-- Iteration 6 --
+string(2) "''"
+
+-- Iteration 7 --
+string(2) "''"
+
+-- Iteration 8 --
+string(30) "he said, "he will be on leave""
+
+-- Iteration 9 --
+string(31) "he said, ""he will be on leave""
+
+-- Iteration 10 --
+string(9) """"PHP""""
+
+-- Iteration 11 --
+string(0) ""
+
+-- Iteration 12 --
+string(1) """
+
+-- Iteration 13 --
+string(1) """
+
+-- Iteration 14 --
+string(6) "hello""
+
+-- Iteration 15 --
+string(25) "Is your name Ram\Krishna?"
+
+-- Iteration 16 --
+string(8) "\0.0.0.0"
+
+-- Iteration 17 --
+string(26) "c:\php\testcase\addslashes"
+
+-- Iteration 18 --
+string(1) "\"
+
+-- Iteration 19 --
+string(12) "hello\0world"
+
+-- Iteration 20 --
+string(9) "\0hello\0"
+
+-- Iteration 21 --
+string(9) "\0\0hello"
+
+-- Iteration 22 --
+string(2) "\0"
+
+-- Iteration 23 --
+string(12) "''\0.0.0.0''"
+
+-- Iteration 24 --
+string(14) "''\0.0.0.0''\0"
+
+-- Iteration 25 --
+string(13) "\0''c:\php\''"
+
+-- Iteration 26 --
+string(10) ""\0.0.0.0""
+
+-- Iteration 27 --
+string(13) ""c:\php\"\0''"
+
+-- Iteration 28 --
+string(20) ""hello"''world''\0//"
+
+-- Iteration 29 --
+string(18) "0xABCDEF0123456789"
+
+-- Iteration 30 --
+string(15) "«cdef0123456789"
+
+-- Iteration 31 --
+string(18) "!@#$%&*@$%#&/;:,<>"
+
+-- Iteration 32 --
+string(12) "hello\0world"
+
+-- Iteration 33 --
+string(71) "This is line 1 of ''heredoc'' string
+This is line 2 of "heredoc" string"
+
+-- Iteration 34 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
index 31570bf2b..943114d51 100644
--- a/ext/standard/tests/strings/bug40754.phpt
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -32,25 +32,25 @@ string(6) "abcdex"
bool(false)
bool(false)
-Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
bool(false)
Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
bool(false)
-Warning: stripos(): Offset not contained in string. in %s on line %d
+Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
bool(false)
-Warning: substr_count(): Length value 2147483647 exceeds string length. in %s on line %d
+Warning: substr_count(): Length value 2147483647 exceeds string length in %s on line %d
bool(false)
-Warning: strpos(): Offset not contained in string. in %s on line %d
+Warning: strpos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: stripos(): Offset not contained in string. in %s on line %d
+Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
diff --git a/ext/standard/tests/strings/chop_basic.phpt b/ext/standard/tests/strings/chop_basic.phpt
new file mode 100644
index 000000000..99a03cb0f
--- /dev/null
+++ b/ext/standard/tests/strings/chop_basic.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_error.phpt b/ext/standard/tests/strings/chop_error.phpt
new file mode 100644
index 000000000..4269993a2
--- /dev/null
+++ b/ext/standard/tests/strings/chop_error.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test chop() function : error conditions
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : error conditions
+*/
+
+echo "*** Testing chop() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing chop() function with Zero arguments --\n";
+var_dump( chop() );
+
+// More than expected number of arguments
+echo "\n-- Testing chop() function with more than expected no. of arguments --\n";
+$str = 'string_val ';
+$charlist = 'string_val';
+$extra_arg = 10;
+
+var_dump( chop($str, $charlist, $extra_arg) );
+var_dump( $str );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : error conditions ***
+
+-- Testing chop() function with Zero arguments --
+
+Warning: Wrong parameter count for chop() in %s on line %d
+NULL
+
+-- Testing chop() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for chop() in %s on line %d
+NULL
+string(11) "string_val "
+Done
diff --git a/ext/standard/tests/strings/chop_variation1.phpt b/ext/standard/tests/strings/chop_variation1.phpt
new file mode 100644
index 000000000..8b1adccf0
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation1.phpt
@@ -0,0 +1,210 @@
+--TEST--
+Test chop() function : usage variations - unexpected values for str argument
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : with different unexpected values for $str argument passed to the function
+*/
+
+echo "*** Testing chop() : with unexpected values for str argument ***\n";
+// initialize all required variables
+
+$charlist = " @#$%1234567890";
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return " @#$%Object @#$%";
+ }
+}
+$sample_obj = new sample;
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // object
+ $sample_obj,
+
+ // resource
+ $file_handle
+);
+
+
+// loop through each element of the array and check the working of chop()
+// when $str arugment is supplied with different values
+
+echo "\n--- Testing chop() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( chop($str) );
+ var_dump( chop($str, $charlist) );
+
+ $counter ++;
+}
+
+// closing the resource
+fclose( $file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing chop() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+string(0) ""
+-- Iteration 2 --
+string(1) "1"
+string(0) ""
+-- Iteration 3 --
+string(5) "12345"
+string(0) ""
+-- Iteration 4 --
+string(5) "-2345"
+string(1) "-"
+-- Iteration 5 --
+string(4) "10.5"
+string(3) "10."
+-- Iteration 6 --
+string(5) "-10.5"
+string(4) "-10."
+-- Iteration 7 --
+string(12) "101234567000"
+string(0) ""
+-- Iteration 8 --
+string(13) "1.07654321E-9"
+string(12) "1.07654321E-"
+-- Iteration 9 --
+string(3) "0.5"
+string(2) "0."
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(1) "1"
+string(0) ""
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+string(0) ""
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+string(0) ""
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+-- Iteration 23 --
+string(0) ""
+string(0) ""
+-- Iteration 24 --
+string(0) ""
+string(0) ""
+-- Iteration 25 --
+string(16) " @#$%Object @#$%"
+string(11) " @#$%Object"
+-- Iteration 26 --
+string(%d) "Resource id #%d"
+string(11) "Resource id"
+Done
diff --git a/ext/standard/tests/strings/chop_variation2.phpt b/ext/standard/tests/strings/chop_variation2.phpt
new file mode 100644
index 000000000..cac25485c
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation2.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test chop() function : usage variations - unexpected values for charlist argument
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : with different unexpected values for charlist argument passes to the function
+*/
+
+echo "*** Testing chop() : with different unexpected values for charlist argument ***\n";
+// initialize all required variables
+$str = 'hello world12345 ';
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "@# $%12345";
+ }
+}
+
+// defining a resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null values
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var
+
+);
+
+
+// loop through each element of the array and check the working of chop()
+// when $charlist arugment is supplied with different values
+
+echo "\n--- Testing chop() by supplying different values for 'charlist' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $charlist = $values [$index];
+
+ var_dump( chop($str, $charlist) );
+
+ $counter ++;
+}
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : with different unexpected values for charlist argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing chop() by supplying different values for 'charlist' argument ---
+-- Iteration 1 --
+string(17) "hello world12345 "
+-- Iteration 2 --
+string(17) "hello world12345 "
+-- Iteration 3 --
+string(17) "hello world12345 "
+-- Iteration 4 --
+string(17) "hello world12345 "
+-- Iteration 5 --
+string(17) "hello world12345 "
+-- Iteration 6 --
+string(17) "hello world12345 "
+-- Iteration 7 --
+string(17) "hello world12345 "
+-- Iteration 8 --
+string(17) "hello world12345 "
+-- Iteration 9 --
+string(17) "hello world12345 "
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(17) "hello world12345 "
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(17) "hello world12345 "
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(17) "hello world12345 "
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(17) "hello world12345 "
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(17) "hello world12345 "
+-- Iteration 15 --
+string(17) "hello world12345 "
+-- Iteration 16 --
+string(17) "hello world12345 "
+-- Iteration 17 --
+string(17) "hello world12345 "
+-- Iteration 18 --
+string(17) "hello world12345 "
+-- Iteration 19 --
+string(11) "hello world"
+-- Iteration 20 --
+string(17) "hello world12345 "
+-- Iteration 21 --
+string(17) "hello world12345 "
+-- Iteration 22 --
+string(17) "hello world12345 "
+-- Iteration 23 --
+string(17) "hello world12345 "
+-- Iteration 24 --
+string(%d) "%s"
+-- Iteration 25 --
+string(17) "hello world12345 "
+-- Iteration 26 --
+string(17) "hello world12345 "
+Done
diff --git a/ext/standard/tests/strings/chop_variation3.phpt b/ext/standard/tests/strings/chop_variation3.phpt
new file mode 100644
index 000000000..9509fb80a
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_variation4.phpt b/ext/standard/tests/strings/chop_variation4.phpt
new file mode 100644
index 000000000..cd269dfa5
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_variation5.phpt b/ext/standard/tests/strings/chop_variation5.phpt
new file mode 100644
index 000000000..8f283e3c3
--- /dev/null
+++ b/ext/standard/tests/strings/chop_variation5.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test chop() function : usage variations - miscellaneous arguments
+--FILE--
+<?php
+/* Prototype : string chop ( string $str [, string $charlist] )
+ * Description: Strip whitespace (or other characters) from the end of a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing chop() : with miscellaneous arguments
+*/
+
+echo "*** Testing chop() : with miscellaneous arguments ***\n";
+
+ var_dump ( chop("chop test \t\0 ") ); /* without second Argument */
+ var_dump ( chop("chop test " , "") ); /* no characters in second Argument */
+ var_dump ( chop("chop test ", NULL) ); /* with NULL as second Argument */
+ var_dump ( chop("chop test ", true) ); /* with boolean value as second Argument */
+ var_dump ( chop("chop test ", " ") ); /* with single space as second Argument */
+ var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */
+ var_dump ( chop("chop testABCXYZ", "A..Z") ); /* with characters range as second Argument */
+ var_dump ( chop("chop test0123456789", "0..9") ); /* with numbers range as second Argument */
+ var_dump ( chop("chop test$#@", "#@$") ); /* with some special characters as second Argument */
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing chop() : with miscellaneous arguments ***
+string(9) "chop test"
+string(12) "chop test "
+string(17) "chop test "
+string(17) "chop test "
+string(9) "chop test"
+string(10) "chop test "
+string(9) "chop test"
+string(9) "chop test"
+string(9) "chop test"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_basic.phpt b/ext/standard/tests/strings/chunk_split_basic.phpt
new file mode 100644
index 000000000..14ad782ac
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_basic.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test chunk_split() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+*/
+
+/*
+* Testing chunk_split() for basic functionality by passing all possible
+* arguments as well as with default arguments chunklen and ending
+*/
+
+echo "*** Testing chunk_split() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = 'Testing';
+$chunklen = 2;
+$ending = '##';
+
+// Calling chunk_split() with all possible arguments
+echo "-- Testing chunk_split() with all possible arguments --\n";
+var_dump( chunk_split($str, $chunklen, $ending) );
+
+
+// Calling chunk_split() with default ending string
+echo "-- Testing chunk_split() with default ending string --\n";
+var_dump( chunk_split($str, $chunklen) );
+
+
+//Calling chunk_split() with default chunklen and ending string
+echo "-- Testing chunk_split() with default chunklen and ending string --\n";
+var_dump( chunk_split($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : basic functionality ***
+-- Testing chunk_split() with all possible arguments --
+string(15) "Te##st##in##g##"
+-- Testing chunk_split() with default ending string --
+string(15) "Te
+st
+in
+g
+"
+-- Testing chunk_split() with default chunklen and ending string --
+string(9) "Testing
+"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_error.phpt b/ext/standard/tests/strings/chunk_split_error.phpt
new file mode 100644
index 000000000..153250c1a
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test chunk_split() function : error conditions
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing error conditions of chunk_split() with zero arguments
+* and for more than expected number of argments
+*/
+
+echo "*** Testing chunk_split() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing chunk_split() function with Zero arguments --";
+var_dump( chunk_split() );
+
+// With one more than the expected number of arguments
+$str = 'Testing chunk_split';
+$chunklen = 5;
+$ending = '***';
+$extra_arg = 10;
+echo "-- Testing chunk_split() function with more than expected no. of arguments --";
+var_dump( chunk_split($str, $chunklen, $ending, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : error conditions ***
+-- Testing chunk_split() function with Zero arguments --
+Warning: Wrong parameter count for chunk_split() in %s on line %d
+NULL
+-- Testing chunk_split() function with more than expected no. of arguments --
+Warning: Wrong parameter count for chunk_split() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation1.phpt b/ext/standard/tests/strings/chunk_split_variation1.phpt
new file mode 100644
index 000000000..58cb0515c
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation1.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test chunk_split() function : usage variations - with unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line %d%d
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : with unexpected values for 'str' argument ***\n";
+
+// Initialising variables
+$chunklen = 2;
+$ending = ' ';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'str'
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $fp
+);
+
+// loop through each element of the array for 'str'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( chunk_split($values[$count], $chunklen, $ending) );
+};
+
+echo "Done";
+
+// close the resource
+fclose($fp);
+
+?>
+--EXPECTF--
+*** Testing chunk_split() : with unexpected values for 'str' argument ***
+-- Iteration 1 --
+string(2) "0 "
+-- Iteration 2 --
+string(2) "1 "
+-- Iteration 3 --
+string(8) "12 34 5 "
+-- Iteration 4 --
+string(8) "-2 34 5 "
+-- Iteration 5 --
+string(6) "10 .5 "
+-- Iteration 6 --
+string(8) "-1 0. 5 "
+-- Iteration 7 --
+string(18) "10 50 00 00 00 00 "
+-- Iteration 8 --
+string(11) "1. 06 E- 9 "
+-- Iteration 9 --
+string(5) "0. 5 "
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(8) "Ar ra y "
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(8) "Ar ra y "
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(8) "Ar ra y "
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(8) "Ar ra y "
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(8) "Ar ra y "
+-- Iteration 15 --
+string(1) " "
+-- Iteration 16 --
+string(1) " "
+-- Iteration 17 --
+string(2) "1 "
+-- Iteration 18 --
+string(1) " "
+-- Iteration 19 --
+string(2) "1 "
+-- Iteration 20 --
+string(1) " "
+-- Iteration 21 --
+string(1) " "
+-- Iteration 22 --
+string(1) " "
+-- Iteration 23 --
+string(9) "st ri ng "
+-- Iteration 24 --
+string(9) "st ri ng "
+-- Iteration 25 --
+string(9) "ob je ct "
+-- Iteration 26 --
+string(1) " "
+-- Iteration 27 --
+string(1) " "
+-- Iteration 28 --
+string(%d) "Re so ur ce i d #%d "
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation10.phpt b/ext/standard/tests/strings/chunk_split_variation10.phpt
new file mode 100644
index 000000000..36b9fe8a0
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation10.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test chunk_split() function : usage variations - different single quoted strings for 'ending' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different single quoted strings for 'ending' arguments to chunk_split()
+* 'chunklen' is set to 9.2 for this testcase
+*/
+
+echo "*** Testing chunk_split() : different single quoted strings as 'ending' ***\n";
+
+
+//Initializing variables
+$str = "This is to test chunk_split() with various 'single quoted' ending string.";
+$chunklen = 9.2;
+
+//different values for 'ending' argument
+$values = array (
+ '', //empty
+ ' ', //space
+ 'a', //Single char
+ 'ENDING', //String
+ '@#$%^', //Special chars
+
+
+ '\t',
+ '\n',
+ '\r',
+ '\r\n',
+
+ '\0', //Null char
+ '123', //Numeric
+ '(MSG)', //With ( and )
+ ') ending string (', //sentence as ending string
+ ') numbers 1234 (', //string with numbers
+ ') speci@! ch@r$ (' //string with special chars
+);
+
+
+//loop through each element of values for 'ending'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chunk_split($str, $chunklen, $values[$count]) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different single quoted strings as 'ending' ***
+-- Iteration 0 --
+string(73) "This is to test chunk_split() with various 'single quoted' ending string."
+-- Iteration 1 --
+string(82) "This is t o test ch unk_split () with v arious 's ingle quo ted' endi ng string . "
+-- Iteration 2 --
+string(82) "This is tao test chaunk_splita() with vaarious 'saingle quoated' endiang stringa.a"
+-- Iteration 3 --
+string(127) "This is tENDINGo test chENDINGunk_splitENDING() with vENDINGarious 'sENDINGingle quoENDINGted' endiENDINGng stringENDING.ENDING"
+-- Iteration 4 --
+string(118) "This is t@#$%^o test ch@#$%^unk_split@#$%^() with v@#$%^arious 's@#$%^ingle quo@#$%^ted' endi@#$%^ng string@#$%^.@#$%^"
+-- Iteration 5 --
+string(91) "This is t\to test ch\tunk_split\t() with v\tarious 's\tingle quo\tted' endi\tng string\t.\t"
+-- Iteration 6 --
+string(91) "This is t\no test ch\nunk_split\n() with v\narious 's\ningle quo\nted' endi\nng string\n.\n"
+-- Iteration 7 --
+string(91) "This is t\ro test ch\runk_split\r() with v\rarious 's\ringle quo\rted' endi\rng string\r.\r"
+-- Iteration 8 --
+string(109) "This is t\r\no test ch\r\nunk_split\r\n() with v\r\narious 's\r\ningle quo\r\nted' endi\r\nng string\r\n.\r\n"
+-- Iteration 9 --
+string(91) "This is t\0o test ch\0unk_split\0() with v\0arious 's\0ingle quo\0ted' endi\0ng string\0.\0"
+-- Iteration 10 --
+string(100) "This is t123o test ch123unk_split123() with v123arious 's123ingle quo123ted' endi123ng string123.123"
+-- Iteration 11 --
+string(118) "This is t(MSG)o test ch(MSG)unk_split(MSG)() with v(MSG)arious 's(MSG)ingle quo(MSG)ted' endi(MSG)ng string(MSG).(MSG)"
+-- Iteration 12 --
+string(226) "This is t) ending string (o test ch) ending string (unk_split) ending string (() with v) ending string (arious 's) ending string (ingle quo) ending string (ted' endi) ending string (ng string) ending string (.) ending string ("
+-- Iteration 13 --
+string(217) "This is t) numbers 1234 (o test ch) numbers 1234 (unk_split) numbers 1234 (() with v) numbers 1234 (arious 's) numbers 1234 (ingle quo) numbers 1234 (ted' endi) numbers 1234 (ng string) numbers 1234 (.) numbers 1234 ("
+-- Iteration 14 --
+string(226) "This is t) speci@! ch@r$ (o test ch) speci@! ch@r$ (unk_split) speci@! ch@r$ (() with v) speci@! ch@r$ (arious 's) speci@! ch@r$ (ingle quo) speci@! ch@r$ (ted' endi) speci@! ch@r$ (ng string) speci@! ch@r$ (.) speci@! ch@r$ ("
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation11.phpt b/ext/standard/tests/strings/chunk_split_variation11.phpt
new file mode 100644
index 000000000..418e607f4
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation11.phpt
@@ -0,0 +1,95 @@
+--TEST--
+Test chunk_split() function : usage variations - different strings for 'ending' with heredoc 'str'
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different strings for 'ending' and heredoc string as 'str' to chunk_split()
+* 'chunklen' is set to 6E0 for this testcase
+*/
+
+echo "*** Testing chunk_split() : different values for 'ending' with heredoc 'str'***\n";
+
+// Initializing required variables
+// heredoc string for 'str' argument
+$heredoc_str = <<<EOT
+This is heredoc string with \t and \n.It also contains
+sPeci@! ch@r$ :) & numbers 222.This is \k wrong escape char.
+EOT;
+
+$chunklen = 6E+0;
+
+//different values for 'ending'
+$values = array (
+ "", //empty
+ " ", //space
+ "a", //single char
+ "ENDING", //regular string
+ "\r\n", //White space char
+ "123", //Numeric
+ ")speci@! ch@r$(", //String with special chars
+);
+
+//loop through each values for 'ending'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split($heredoc_str, $chunklen, $values[$count]) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different values for 'ending' with heredoc 'str'***
+-- Iteration 1 --
+string(113) "This is heredoc string with and
+.It also contains
+sPeci@! ch@r$ :) & numbers 222.This is \k wrong escape char."
+-- Iteration 2 --
+string(132) "This i s here doc st ring w ith and
+. It als o cont ains
+s Peci@! ch@r$ :) & number s 222. This i s \k w rong e scape char. "
+-- Iteration 3 --
+string(132) "This ias hereadoc staring waith aand
+.aIt alsao contaains
+saPeci@!a ch@r$a :) & anumberas 222.aThis ias \k warong eascape achar.a"
+-- Iteration 4 --
+string(227) "This iENDINGs hereENDINGdoc stENDINGring wENDINGith ENDINGand
+.ENDINGIt alsENDINGo contENDINGains
+sENDINGPeci@!ENDING ch@r$ENDING :) & ENDINGnumberENDINGs 222.ENDINGThis iENDINGs \k wENDINGrong eENDINGscape ENDINGchar.ENDING"
+-- Iteration 5 --
+string(151) "This i
+s here
+doc st
+ring w
+ith
+and
+.
+It als
+o cont
+ains
+s
+Peci@!
+ ch@r$
+ :) &
+number
+s 222.
+This i
+s \k w
+rong e
+scape
+char.
+"
+-- Iteration 6 --
+string(170) "This i123s here123doc st123ring w123ith 123and
+.123It als123o cont123ains
+s123Peci@!123 ch@r$123 :) & 123number123s 222.123This i123s \k w123rong e123scape 123char.123"
+-- Iteration 7 --
+string(398) "This i)speci@! ch@r$(s here)speci@! ch@r$(doc st)speci@! ch@r$(ring w)speci@! ch@r$(ith )speci@! ch@r$(and
+.)speci@! ch@r$(It als)speci@! ch@r$(o cont)speci@! ch@r$(ains
+s)speci@! ch@r$(Peci@!)speci@! ch@r$( ch@r$)speci@! ch@r$( :) & )speci@! ch@r$(number)speci@! ch@r$(s 222.)speci@! ch@r$(This i)speci@! ch@r$(s \k w)speci@! ch@r$(rong e)speci@! ch@r$(scape )speci@! ch@r$(char.)speci@! ch@r$("
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation12.phpt b/ext/standard/tests/strings/chunk_split_variation12.phpt
new file mode 100644
index 000000000..e90287546
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation12.phpt
@@ -0,0 +1,145 @@
+--TEST--
+Test chunk_split() function : usage variations - different heredoc strings for 'ending' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different heredoc strings as 'ending' argument to chunk_split()
+* 'chunklen' argument is set to 10
+*/
+
+echo "*** Testing chunk_split() : different heredoc strings for 'ending' argument ***\n";
+
+// Initializing required variables
+$chunklen = 10;
+$str = "This is str to check with heredoc ending.This\tcontains,\nspeci@! ch@r$ __with wrong \k escape char 222.";
+
+// Null heredoc string
+$heredoc_null = <<<EOT1
+EOT1;
+
+// heredoc string with single character
+$heredoc_char = <<<EOT2
+a
+EOT2;
+
+// simple heredoc string
+$heredoc_str = <<<EOT3
+This is simple heredoc string
+EOT3;
+
+// heredoc with special characters
+$heredoc_spchar = <<<EOT4
+This checks with $, %, &, chars
+EOT4;
+
+// blank heredoc string
+$heredoc_blank = <<<EOT5
+
+EOT5;
+
+// heredoc with different white space characters
+$heredoc_escchar = <<<EOT6
+This checks\t and \nwhite space chars
+EOT6;
+
+// heredoc with multiline
+$heredoc_multiline= <<<EOT7
+This is to check chunk_split
+function with multiline
+heredoc
+EOT7;
+
+// heredoc with quotes and slashes
+$heredoc_quote_slash = <<<EOT8
+"To check " in heredoc".I'm sure it'll \work!
+EOT8;
+
+// different heredoc strings for 'ending'
+$heredoc_arr = array(
+ $heredoc_null,
+ $heredoc_blank,
+ $heredoc_char,
+ $heredoc_str,
+ $heredoc_multiline,
+ $heredoc_spchar,
+ $heredoc_escchar,
+ $heredoc_quote_slash
+);
+
+
+// loop through each element of the heredoc_arr for str
+$count = 0;
+foreach($heredoc_arr as $value) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split( $str, $chunklen, $value) );
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different heredoc strings for 'ending' argument ***
+-- Iteration 1 --
+string(102) "This is str to check with heredoc ending.This contains,
+speci@! ch@r$ __with wrong \k escape char 222."
+-- Iteration 2 --
+string(102) "This is str to check with heredoc ending.This contains,
+speci@! ch@r$ __with wrong \k escape char 222."
+-- Iteration 3 --
+string(113) "This is star to checka with hereadoc endinga.This contaains,
+specai@! ch@r$ a__with wroang \k escaape char 22a2.a"
+-- Iteration 4 --
+string(421) "This is stThis is simple heredoc stringr to checkThis is simple heredoc string with hereThis is simple heredoc stringdoc endingThis is simple heredoc string.This contThis is simple heredoc stringains,
+specThis is simple heredoc stringi@! ch@r$ This is simple heredoc string__with wroThis is simple heredoc stringng \k escaThis is simple heredoc stringpe char 22This is simple heredoc string2.This is simple heredoc string"
+-- Iteration 5 --
+string(762) "This is stThis is to check chunk_split
+function with multiline
+heredocr to checkThis is to check chunk_split
+function with multiline
+heredoc with hereThis is to check chunk_split
+function with multiline
+heredocdoc endingThis is to check chunk_split
+function with multiline
+heredoc.This contThis is to check chunk_split
+function with multiline
+heredocains,
+specThis is to check chunk_split
+function with multiline
+heredoci@! ch@r$ This is to check chunk_split
+function with multiline
+heredoc__with wroThis is to check chunk_split
+function with multiline
+heredocng \k escaThis is to check chunk_split
+function with multiline
+heredocpe char 22This is to check chunk_split
+function with multiline
+heredoc2.This is to check chunk_split
+function with multiline
+heredoc"
+-- Iteration 6 --
+string(443) "This is stThis checks with $, %, &, charsr to checkThis checks with $, %, &, chars with hereThis checks with $, %, &, charsdoc endingThis checks with $, %, &, chars.This contThis checks with $, %, &, charsains,
+specThis checks with $, %, &, charsi@! ch@r$ This checks with $, %, &, chars__with wroThis checks with $, %, &, charsng \k escaThis checks with $, %, &, charspe char 22This checks with $, %, &, chars2.This checks with $, %, &, chars"
+-- Iteration 7 --
+string(487) "This is stThis checks and
+white space charsr to checkThis checks and
+white space chars with hereThis checks and
+white space charsdoc endingThis checks and
+white space chars.This contThis checks and
+white space charsains,
+specThis checks and
+white space charsi@! ch@r$ This checks and
+white space chars__with wroThis checks and
+white space charsng \k escaThis checks and
+white space charspe char 22This checks and
+white space chars2.This checks and
+white space chars"
+-- Iteration 8 --
+string(597) "This is st"To check " in heredoc".I'm sure it'll \work!r to check"To check " in heredoc".I'm sure it'll \work! with here"To check " in heredoc".I'm sure it'll \work!doc ending"To check " in heredoc".I'm sure it'll \work!.This cont"To check " in heredoc".I'm sure it'll \work!ains,
+spec"To check " in heredoc".I'm sure it'll \work!i@! ch@r$ "To check " in heredoc".I'm sure it'll \work!__with wro"To check " in heredoc".I'm sure it'll \work!ng \k esca"To check " in heredoc".I'm sure it'll \work!pe char 22"To check " in heredoc".I'm sure it'll \work!2."To check " in heredoc".I'm sure it'll \work!"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation13.phpt b/ext/standard/tests/strings/chunk_split_variation13.phpt
new file mode 100644
index 000000000..3cbcbe466
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation13.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test chunk_split() function : usage variations - default 'chunklen' with long string as 'str'argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+*/
+
+/*
+* passing long string as 'str' and testing default value of chunklen which is 76
+*/
+
+echo "*** Testing chunk_split() : default 'chunklen' with long string 'str' ***\n";
+
+//Initializing variables
+$values = array (
+ "123456789012345678901234567890123456789012345678901234567890123456789012345678901",
+ "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
+);
+
+//loop through each element of values for 'str' and default value of 'chunklen'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chunk_split($values[$count]) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : default 'chunklen' with long string 'str' ***
+-- Iteration 0 --
+string(85) "1234567890123456789012345678901234567890123456789012345678901234567890123456
+78901
+"
+-- Iteration 1 --
+string(217) "1234567890123456789012345678901234567890123456789012345678901234567890123456
+7890123456789012345678901234567890123456789012345678901234567890123456789012
+34567890123456789012345678901234567890123456789012345678901
+"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt
new file mode 100644
index 000000000..3498f5fce
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation2.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796)
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : with unexpected values for 'chunklen' argument ***\n";
+
+// Initialise function arguments
+$str = 'This is chuklen variation';
+$ending = '*';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get resource variable
+$fp = fopen(__FILE__, 'r');
+
+//Class to get object variable
+class MyClass
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+ $fp
+);
+
+// loop through each element of the values for 'chunklen'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( chunk_split($str, $values[$count], $ending) );
+}
+
+echo "Done";
+
+//closing resource
+fclose($fp);
+
+?>
+--EXPECTF--
+*** Testing chunk_split() : with unexpected values for 'chunklen' argument ***
+-- Iteration 1 --
+string(28) "This is ch*uklen vari*ation*"
+-- Iteration 2 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 3 --
+string(26) "This is chuklen variation*"
+-- Iteration 4 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 7 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 8 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 9 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 10 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 11 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 13 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 14 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 15 --
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 16 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Notice: Object of class MyClass could not be converted to int in %s on line %d
+string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*"
+-- Iteration 22 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 24 --
+string(30) "This *is ch*uklen* vari*ation*"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt
new file mode 100644
index 000000000..00dbbdeee
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation3.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected values for 'ending' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : unexpected values for 'ending' ***\n";
+
+// Initializing variables
+$str = 'This is simple string.';
+$chunklen = 4.9;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//resource variable
+$fp = fopen(__FILE__,'r');
+
+//Class to get object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//different values for 'ending'
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $fp
+);
+
+// loop through each element of values for 'ending'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( chunk_split($str, $chunklen, $values[$count]) );
+}
+
+echo "Done";
+
+//closing resource
+fclose($fp);
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected values for 'ending' ***
+-- Iteration 1 --
+string(28) "This0 is 0simp0le s0trin0g.0"
+-- Iteration 2 --
+string(28) "This1 is 1simp1le s1trin1g.1"
+-- Iteration 3 --
+string(52) "This12345 is 12345simp12345le s12345trin12345g.12345"
+-- Iteration 4 --
+string(52) "This-2345 is -2345simp-2345le s-2345trin-2345g.-2345"
+-- Iteration 5 --
+string(46) "This10.5 is 10.5simp10.5le s10.5trin10.5g.10.5"
+-- Iteration 6 --
+string(52) "This-10.5 is -10.5simp-10.5le s-10.5trin-10.5g.-10.5"
+-- Iteration 7 --
+string(94) "This105000000000 is 105000000000simp105000000000le s105000000000trin105000000000g.105000000000"
+-- Iteration 8 --
+string(64) "This1.06E-9 is 1.06E-9simp1.06E-9le s1.06E-9trin1.06E-9g.1.06E-9"
+-- Iteration 9 --
+string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array"
+-- Iteration 15 --
+string(22) "This is simple string."
+-- Iteration 16 --
+string(22) "This is simple string."
+-- Iteration 17 --
+string(28) "This1 is 1simp1le s1trin1g.1"
+-- Iteration 18 --
+string(22) "This is simple string."
+-- Iteration 19 --
+string(28) "This1 is 1simp1le s1trin1g.1"
+-- Iteration 20 --
+string(22) "This is simple string."
+-- Iteration 21 --
+string(22) "This is simple string."
+-- Iteration 22 --
+string(22) "This is simple string."
+-- Iteration 23 --
+string(58) "Thisobject is objectsimpobjectle sobjecttrinobjectg.object"
+-- Iteration 24 --
+string(22) "This is simple string."
+-- Iteration 25 --
+string(22) "This is simple string."
+-- Iteration 26 --
+string(%d) "ThisResource id #%d is Resource id #%dsimpResource id #%dle sResource id #%dtrinResource id #%dg.Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation4.phpt b/ext/standard/tests/strings/chunk_split_variation4.phpt
new file mode 100644
index 000000000..cfa62698b
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation4.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test chunk_split() function : usage variations - different heredoc strings as 'str' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Passing different heredoc strings as 'str' argument to the chunk_split()
+* with 'chunklen' 4 and default value of 'ending' that is "\r\n"
+*/
+
+echo "*** Testing chunk_split() : heredoc strings as 'str' argument ***\n";
+
+// Initializing required variables
+$chunklen = 4;
+
+// Null heredoc string
+$heredoc_null = <<<EOT1
+EOT1;
+
+// heredoc string with single character
+$heredoc_char = <<<EOT2
+a
+EOT2;
+
+// simple heredoc string
+$heredoc_str = <<<EOT3
+This is simple heredoc string
+EOT3;
+
+// heredoc with special characters
+$heredoc_spchar = <<<EOT4
+This checks heredoc with $, %, &, chars
+EOT4;
+
+// blank heredoc string
+$heredoc_blank = <<<EOT5
+
+EOT5;
+
+// heredoc with different white space characters
+$heredoc_escchar = <<<EOT6
+This checks\t chunk_split()\nEscape\rchars
+EOT6;
+
+// heredoc with multiline
+$heredoc_multiline= <<<EOT7
+This is to check chunk_split
+function with multiline
+heredoc
+EOT7;
+
+// heredoc with quotes and slashes
+$heredoc_quote_slash = <<<EOT8
+"To check " in heredoc"
+I'm sure it'll work also with \
+which is single slash
+EOT8;
+
+//different heredoc strings for 'str'
+$heredoc_arr = array(
+ $heredoc_null,
+ $heredoc_blank,
+ $heredoc_char,
+ $heredoc_str,
+ $heredoc_multiline,
+ $heredoc_spchar,
+ $heredoc_escchar,
+ $heredoc_quote_slash
+);
+
+
+// loop through each element of the heredoc_arr for 'str'
+$count = 0;
+foreach($heredoc_arr as $str) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split( $str, $chunklen) );
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : heredoc strings as 'str' argument ***
+-- Iteration 1 --
+string(2) "
+"
+-- Iteration 2 --
+string(2) "
+"
+-- Iteration 3 --
+string(3) "a
+"
+-- Iteration 4 --
+string(45) "This
+ is
+simp
+le h
+ered
+oc s
+trin
+g
+"
+-- Iteration 5 --
+string(90) "This
+ is
+to c
+heck
+ chu
+nk_s
+plit
+
+fun
+ctio
+n wi
+th m
+ulti
+line
+
+her
+edoc
+"
+-- Iteration 6 --
+string(59) "This
+ che
+cks
+here
+doc
+with
+ $,
+%, &
+, ch
+ars
+"
+-- Iteration 7 --
+string(59) "This
+ che
+cks
+ chu
+nk_s
+plit
+()
+E
+scap
+e ch
+ars
+"
+-- Iteration 8 --
+string(117) ""To
+chec
+k "
+in h
+ered
+oc"
+
+I'm
+sure
+ it'
+ll w
+ork
+also
+ wit
+h \
+
+whic
+h is
+ sin
+gle
+slas
+h
+"
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt
new file mode 100644
index 000000000..69308ea30
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split_variation6.phpt b/ext/standard/tests/strings/chunk_split_variation6.phpt
new file mode 100644
index 000000000..705bb31fc
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation6.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test chunk_split() function : usage variations - single quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different single quoted strings as 'str' argument to the function
+* 'chunklen' is set to 7 and 'ending' is '):('
+*/
+
+echo "*** Testing chunk_split() : with different single quoted 'str' ***\n";
+
+//Initializing variables
+$chunklen = 7;
+$ending = "):(";
+
+//different single quoted string for 'str'
+$values = array(
+ '', //empty
+ ' ', //space
+ 'This is simple string', //regular string
+ 'It\'s string with quotes',
+ 'This contains @ # $ % ^ & chars', //special characters
+ 'This string\tcontains\rwhite space\nchars', //with white space chars
+ 'This is string with 1234 numbers',
+ 'This is string with \0 and ".chr(0)."null chars', //for binary safe
+ 'This is string with multiple space char',
+ 'This is to check string with ()',
+ ' Testing with multiple spaces ',
+ 'Testing invalid \k and \m escape char',
+ 'This is to check with \\n and \\t'
+);
+
+
+//Loop through each element of values for 'str'
+for($count = 0;$count < count($values);$count++) {
+ echo "-- Iteration $count --\n";
+ var_dump( chunk_split($values[$count], $chunklen, $ending) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : with different single quoted 'str' ***
+-- Iteration 0 --
+string(3) "):("
+-- Iteration 1 --
+string(4) " ):("
+-- Iteration 2 --
+string(30) "This is):( simple):( string):("
+-- Iteration 3 --
+string(35) "It's st):(ring wi):(th quot):(es):("
+-- Iteration 4 --
+string(46) "This co):(ntains ):(@ # $ %):( ^ & ch):(ars):("
+-- Iteration 5 --
+string(59) "This st):(ring\tc):(ontains):(\rwhite):( space\):(nchars):("
+-- Iteration 6 --
+string(47) "This is):( string):( with 1):(234 num):(bers):("
+-- Iteration 7 --
+string(68) "This is):( string):( with \):(0 and "):(.chr(0)):(."null ):(chars):("
+-- Iteration 8 --
+string(74) "This is):( string):( with ):( multi):(ple ):( sp):(ace cha):(r):("
+-- Iteration 9 --
+string(46) "This is):( to che):(ck stri):(ng with):( ()):("
+-- Iteration 10 --
+string(59) " Te):(sting w):(ith ):(multipl):(e space):(s ):("
+-- Iteration 11 --
+string(55) "Testing):( invali):(d \k an):(d \m es):(cape ch):(ar):("
+-- Iteration 12 --
+string(46) "This is):( to che):(ck with):( \n and):( \t):("
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/chunk_split_variation7.phpt b/ext/standard/tests/strings/chunk_split_variation7.phpt
new file mode 100644
index 000000000..a27ff3cac
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation7.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt
new file mode 100644
index 000000000..cc6eeef98
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation8.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Test chunk_split() function : usage variations - different integer values for 'chunklen' with heredoc string as 'str'(Bug#42796)
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions:
+*/
+
+/*
+* passing different integer values for 'chunklen' and heredoc string for 'str' to chunk_split()
+*/
+
+echo "*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***\n";
+
+
+// Initializing required variables
+//heredoc string as str
+$heredoc_str = <<<EOT
+This's heredoc string with \t and \n white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split()
+EOT;
+
+$ending = ':::';
+
+// different values for 'chunklen'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+
+);
+
+
+// loop through each element of values for 'chunklen'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
+-- Iteration 1 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: :::
+::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.:::
+:::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t:::
+:::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::"
+-- Iteration 3 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+string(129) "This's heredoc string with and
+ white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split():::"
+-- Iteration 5 --
+string(141) "This's heredoc string with::: and
+ white space char.:::
+It has _speci@l ch@r$ 222:::2 !!!Now \k as escape char::: to test
+chunk_split():::"
+-- Iteration 6 --
+string(129) "This's heredoc string with and
+ white space char.
+It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
+chunk_split():::"
+-- Iteration 7 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/chunk_split_variation9.phpt b/ext/standard/tests/strings/chunk_split_variation9.phpt
new file mode 100644
index 000000000..5601bbc1e
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/crc32_basic.phpt b/ext/standard/tests/strings/crc32_basic.phpt
new file mode 100644
index 000000000..52a3f89f4
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test crc32() function : basic functionality
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : basic functionality
+*/
+
+echo "*** Testing crc32() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = 'string_val1234';
+
+// Calling crc32() with all possible arguments
+
+// checking for the return type of the function
+var_dump( is_int(crc32($str)) );
+
+// Printing the returned value from the function
+printf("%u\n", crc32($str) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : basic functionality ***
+bool(true)
+256895812
+Done
diff --git a/ext/standard/tests/strings/crc32_error.phpt b/ext/standard/tests/strings/crc32_error.phpt
new file mode 100644
index 000000000..45378204c
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_error.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test crc32() function : error conditions
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : error conditions
+*/
+
+echo "*** Testing crc32() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing crc32() function with Zero arguments --\n";
+var_dump( crc32() );
+
+//Test crc32 with one more than the expected number of arguments
+echo "\n-- Testing crc32() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( crc32($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : error conditions ***
+
+-- Testing crc32() function with Zero arguments --
+
+Warning: crc32() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing crc32() function with more than expected no. of arguments --
+
+Warning: crc32() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/crc32_variation1.phpt b/ext/standard/tests/strings/crc32_variation1.phpt
new file mode 100644
index 000000000..de7ca5d25
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation1.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test crc32() function : usage variations - unexpected values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with unexpected values for str argument
+*/
+
+echo "*** Testing crc32() : with unexpected values for str argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for str
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($value) );
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration 1 --
+int(-186917087)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(-873121252)
+
+-- Iteration 1 --
+int(1860518047)
+
+-- Iteration 1 --
+int(269248583)
+
+-- Iteration 1 --
+int(-834950157)
+
+-- Iteration 1 --
+int(-638440228)
+
+-- Iteration 1 --
+int(-742287383)
+
+-- Iteration 1 --
+int(-2036403827)
+
+-- Iteration 1 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 1 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 1 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 1 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 1 --
+
+Warning: crc32() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-1465013268)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+
+Warning: crc32() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/crc32_variation2.phpt b/ext/standard/tests/strings/crc32_variation2.phpt
new file mode 100644
index 000000000..6d57a9445
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation2.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test crc32() function : usage variations - single quoted strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing crc32() : with different strings in single quotes passed to the function
+*/
+
+echo "*** Testing crc32() : with different strings in single quotes ***\n";
+
+// defining an array of strings
+$string_array = array(
+ '',
+ ' ',
+ 'hello world',
+ 'HELLO WORLD',
+ ' helloworld ',
+
+ '(hello world)',
+ 'hello(world)',
+ 'helloworld()',
+ 'hello()(world',
+
+ '"hello" world',
+ 'hello "world"',
+ 'hello""world',
+
+ 'hello\tworld',
+ 'hellowor\\tld',
+ '\thello world\t',
+ 'hello\nworld',
+ 'hellowor\\nld',
+ '\nhello world\n',
+ '\n\thelloworld',
+ 'hel\tlo\n world',
+
+ '!@#$%&',
+ '#hello@world.com',
+ '$hello$world',
+
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+ eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+ gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+ 111111111111111111111122222222222222222222222222222222222222222222
+ 333333333333333333333333333333333334444444444444444444444444444444
+ 555555555555555555555555555555555555555555556666666666666666666666
+ 777777777777777777777777777777777777777777777777777777777777777777
+ /t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
+ /n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n'
+);
+
+// looping to check the behaviour of the function for each string in the array
+
+$count = 1;
+foreach($string_array as $str) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($str) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different strings in single quotes ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(135755572)
+
+-- Iteration 11 --
+int(27384015)
+
+-- Iteration 12 --
+int(-497244052)
+
+-- Iteration 13 --
+int(-2065897232)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-856440615)
+
+-- Iteration 16 --
+int(647088397)
+
+-- Iteration 17 --
+int(523630053)
+
+-- Iteration 18 --
+int(-2062229676)
+
+-- Iteration 19 --
+int(1169918910)
+
+-- Iteration 20 --
+int(-618551732)
+
+-- Iteration 21 --
+int(-1828940657)
+
+-- Iteration 22 --
+int(-1654468652)
+
+-- Iteration 23 --
+int(-1648442217)
+
+-- Iteration 24 --
+int(1431761713)
+Done
diff --git a/ext/standard/tests/strings/crc32_variation3.phpt b/ext/standard/tests/strings/crc32_variation3.phpt
new file mode 100644
index 000000000..639254a5f
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation3.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test crc32() function : usage variations - double quoted strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with different strings in double quotes passed to the function
+*/
+
+echo "*** Testing crc32() : with different strings in double quotes ***\n";
+
+// defining an array of strings
+$string_array = array(
+ "",
+ " ",
+ "hello world",
+ "HELLO WORLD",
+ " helloworld ",
+
+ "(hello world)",
+ "hello(world)",
+ "helloworld()",
+ "hello()(world",
+
+ "'hello' world",
+ "hello 'world'",
+ "hello''world",
+
+ "hello\tworld",
+ "hellowor\\tld",
+ "\thello world\t",
+ "helloworld",
+ "hellowor\\ld",
+ "hello\nworld",
+ "hellowor\\nld",
+ "\nhello world\n",
+ "\n\thelloworld",
+ "hel\tlo\n world",
+
+ "!@#$%&",
+ "#hello@world.com",
+ "$hello$world",
+
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+ eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+ gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+ 111111111111111111111122222222222222222222222222222222222222222222
+ 333333333333333333333333333333333334444444444444444444444444444444
+ 555555555555555555555555555555555555555555556666666666666666666666
+ 777777777777777777777777777777777777777777777777777777777777777777
+ /t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
+ /n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n"
+);
+
+// looping to check the behaviour of the function for each string in the array
+
+$count = 1;
+foreach($string_array as $str) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($str) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different strings in double quotes ***
+
+Notice: Undefined variable: hello in %s on line %d
+
+Notice: Undefined variable: world in %s on line %d
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(1191242624)
+
+-- Iteration 11 --
+int(603128807)
+
+-- Iteration 12 --
+int(-525789576)
+
+-- Iteration 13 --
+int(770262395)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-986324846)
+
+-- Iteration 16 --
+int(-102031187)
+
+-- Iteration 17 --
+int(-588181215)
+
+-- Iteration 18 --
+int(-1417857067)
+
+-- Iteration 19 --
+int(523630053)
+
+-- Iteration 20 --
+int(-503915034)
+
+-- Iteration 21 --
+int(-254912432)
+
+-- Iteration 22 --
+int(-1581578467)
+
+-- Iteration 23 --
+int(-1828940657)
+
+-- Iteration 24 --
+int(-1654468652)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+int(1431761713)
+Done
diff --git a/ext/standard/tests/strings/crc32_variation4.phpt b/ext/standard/tests/strings/crc32_variation4.phpt
new file mode 100644
index 000000000..35c3b0a71
--- /dev/null
+++ b/ext/standard/tests/strings/crc32_variation4.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Test crc32() function : usage variations - heredoc strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+ die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with different heredoc strings passed to the str argument
+*/
+
+echo "*** Testing crc32() : with different heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_long_string = <<<EOT
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+111111111111111111111122222222222222222222222222222222222222222222
+333333333333333333333333333333333334444444444444444444444444444444
+555555555555555555555555555555555555555555556666666666666666666666
+777777777777777777777777777777777777777777777777777777777777777777
+/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
+/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal,
+ $heredoc_with_long_string
+ );
+
+// loop to test the function with each heredoc string in the array
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( crc32($str) );
+ $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different heredoc strings ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1541608299)
+
+-- Iteration 3 --
+int(1588851550)
+
+-- Iteration 4 --
+int(-1726108239)
+
+-- Iteration 5 --
+int(-1847303891)
+
+-- Iteration 6 --
+int(-1260053120)
+
+-- Iteration 7 --
+int(-1718044186)
+
+-- Iteration 8 --
+int(1646793751)
+Done
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
index 27de79ae2..2d56cd0aa 100644
--- a/ext/standard/tests/strings/explode1.phpt
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -88,29 +88,29 @@ echo "Done\n";
*** Testing explode() for basic operations ***
-- Iteration 1 --
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-- Iteration 2 --
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-- Iteration 3 --
array(1) {
@@ -214,16 +214,16 @@ array(2) {
}
-- Iteration 7 --
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-Warning: explode(): Empty delimiter. in %s on line %d
+Warning: explode(): Empty delimiter in %s on line %d
bool(false)
-- Iteration 8 --
array(2) {
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic1-win32.phpt b/ext/standard/tests/strings/get_html_translation_table_basic1-win32.phpt
new file mode 100644
index 000000000..700b8e335
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic1-win32.phpt
@@ -0,0 +1,269 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - with default args
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN"){
+ die('skip only for Windows');
+}
+
+if( !setlocale(LC_ALL, "English_United States.1252") ) {
+ die('skip failed to set locale settings to "English_United States.1252"');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+//set locale
+setlocale(LC_ALL, "English_United States.1252");
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// Calling get_html_translation_table() with default arguments
+echo "-- with default arguments --\n";
+var_dump( get_html_translation_table() );
+
+// Calling get_html_translation_table() with all possible optional arguments
+echo "-- with table = HTML_ENTITIES --\n";
+$table = HTML_ENTITIES;
+var_dump( get_html_translation_table($table) );
+
+echo "-- with table = HTML_SPECIALCHARS --\n";
+$table = HTML_SPECIALCHARS;
+var_dump( get_html_translation_table($table) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with default arguments --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic1.phpt b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
new file mode 100644
index 000000000..a3dd50712
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic1.phpt
@@ -0,0 +1,269 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - with default args
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == 'WIN'){
+ die('skip Not for Windows');
+}
+
+if( !setlocale(LC_ALL, "en_US.UTF-8") ) {
+ die('skip failed to set locale settings to "en-US.UTF-8"');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// Calling get_html_translation_table() with default arguments
+echo "-- with default arguments --\n";
+var_dump( get_html_translation_table() );
+
+// Calling get_html_translation_table() with all possible optional arguments
+echo "-- with table = HTML_ENTITIES --\n";
+$table = HTML_ENTITIES;
+var_dump( get_html_translation_table($table) );
+
+echo "-- with table = HTML_SPECIALCHARS --\n";
+$table = HTML_SPECIALCHARS;
+var_dump( get_html_translation_table($table) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with default arguments --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_SPECIALCHARS --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic2-win32.phpt b/ext/standard/tests/strings/get_html_translation_table_basic2-win32.phpt
new file mode 100644
index 000000000..1b1a53a41
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic2-win32.phpt
@@ -0,0 +1,673 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_ENTITIES & diff quote_style
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN"){
+ die('skip only for Windows');
+}
+
+if( !setlocale(LC_ALL, "English_United States.1252") ) {
+ die('skip failed to set locale settings to "English_United States.1252"');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+//set locale
+setlocale(LC_ALL, "English_United States.1252");
+
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// Calling get_html_translation_table() with default arguments
+echo "-- with default arguments --\n";
+var_dump( get_html_translation_table() );
+
+// Calling get_html_translation_table() with all arguments
+// $table as HTML_ENTITIES and different quote style
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$quote_style = ENT_COMPAT;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --\n";
+$quote_style = ENT_QUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --\n";
+$quote_style = ENT_NOQUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with default arguments --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --
+array(101) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --
+array(99) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic2.phpt b/ext/standard/tests/strings/get_html_translation_table_basic2.phpt
new file mode 100644
index 000000000..3e04638cc
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic2.phpt
@@ -0,0 +1,672 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_ENTITIES & diff quote_style
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN"){
+ die('skip Not for Windows');
+}
+
+if( !setlocale(LC_ALL, "en_US.UTF-8") ) {
+ die('skip failed to set locale settings to "en-US.UTF-8"');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* Test get_html_translation_table() when table is specified as HTML_ENTITIES */
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// Calling get_html_translation_table() with default arguments
+echo "-- with default arguments --\n";
+var_dump( get_html_translation_table() );
+
+// Calling get_html_translation_table() with all arguments
+// $table as HTML_ENTITIES and different quote style
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --\n";
+$table = HTML_ENTITIES;
+$quote_style = ENT_COMPAT;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --\n";
+$quote_style = ENT_QUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --\n";
+$quote_style = ENT_NOQUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with default arguments --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_COMPAT --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_QUOTES --
+array(101) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_ENTITIES & quote_style = ENT_NOQUOTES --
+array(99) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic3-win32.phpt b/ext/standard/tests/strings/get_html_translation_table_basic3-win32.phpt
new file mode 100644
index 000000000..f3fb8b433
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic3-win32.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN"){
+ die('skip only for Windows');
+}
+
+if( !setlocale(LC_ALL, "English_United States.1252") ) {
+ die('skip failed to set locale settings to "English_United States.1252"');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
+
+//set locale
+setlocale(LC_ALL, "English_United States.1252");
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// $table as HTML_SEPCIALCHARS and different quote style
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$quote_style = ENT_COMPAT;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTE --\n";
+$quote_style = ENT_QUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTE --\n";
+$quote_style = ENT_NOQUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTE --
+array(5) {
+ ["""]=>
+ string(6) "&quot;"
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTE --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_basic3.phpt b/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
new file mode 100644
index 000000000..58394eb9c
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_basic3.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test get_html_translation_table() function : basic functionality - table as HTML_SPECIALCHARS
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN"){
+ die('skip Not for Windows');
+}
+
+if( !setlocale(LC_ALL, "en_US.UTF-8") ) {
+ die('skip failed to set locale settings to "en-US.UTF-8"');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/* test get_html_translation_table() when $table argument is specified as HTML_SPECIALCHARS */
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+echo "*** Testing get_html_translation_table() : basic functionality ***\n";
+
+// $table as HTML_SEPCIALCHARS and different quote style
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --\n";
+$table = HTML_SPECIALCHARS;
+$quote_style = ENT_COMPAT;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTE --\n";
+$quote_style = ENT_QUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTE --\n";
+$quote_style = ENT_NOQUOTES;
+var_dump( get_html_translation_table($table, $quote_style) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : basic functionality ***
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_COMPAT --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_QUOTE --
+array(5) {
+ ["""]=>
+ string(6) "&quot;"
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- with table = HTML_SPECIALCHARS & quote_style = ENT_NOQUOTE --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_error.phpt b/ext/standard/tests/strings/get_html_translation_table_error.phpt
new file mode 100644
index 000000000..5f1871448
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test get_html_translation_table() function : error conditions
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing get_html_translation_table() : error conditions ***\n";
+
+// More than expected number of arguments
+echo "\n-- Testing get_html_translation_table() function with more than expected no. of arguments --\n";
+$table = HTML_ENTITIES;
+$quote_style = ENT_COMPAT;
+$extra_arg = 10;
+
+var_dump( get_html_translation_table($table, $quote_style, $extra_arg) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : error conditions ***
+
+-- Testing get_html_translation_table() function with more than expected no. of arguments --
+
+Warning: get_html_translation_table() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_variation1-win32.phpt b/ext/standard/tests/strings/get_html_translation_table_variation1-win32.phpt
new file mode 100644
index 000000000..2217efb63
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_variation1-win32.phpt
@@ -0,0 +1,1117 @@
+--TEST--
+Test get_html_translation_table() function : usage variations - unexpected table values
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN"){
+ die('skip only for Windows');
+}
+
+if( !setlocale(LC_ALL, "English_United States.1252") ) {
+ die('skip failed to set locale settings to "English_United States.1252"');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * test get_html_translation_table() with unexpected value for argument $table
+*/
+
+//set locale
+setlocale(LC_ALL, "English_United States.1252");
+
+echo "*** Testing get_html_translation_table() : usage variations ***\n";
+// initialize all required variables
+$quote_style = ENT_COMPAT;
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// a resource variable
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new stdclass(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of get_html_translation_table()
+// when $table arugment is supplied with different values
+echo "\n--- Testing get_html_translation_table() by supplying different values for 'table' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $table = $values [$index];
+
+ var_dump( get_html_translation_table($table) );
+ var_dump( get_html_translation_table($table, $quote_style) );
+
+ $counter ++;
+}
+
+// close resource
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : usage variations ***
+
+--- Testing get_html_translation_table() by supplying different values for 'table' argument ---
+-- Iteration 1 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 2 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 3 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 4 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 5 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 6 --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 7 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 8 --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 9 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 10 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 11 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 12 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %s
+NULL
+-- Iteration 13 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 14 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 15 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 16 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 17 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %s
+NULL
+-- Iteration 18 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 19 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_variation1.phpt b/ext/standard/tests/strings/get_html_translation_table_variation1.phpt
new file mode 100644
index 000000000..7bf919e35
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_variation1.phpt
@@ -0,0 +1,1116 @@
+--TEST--
+Test get_html_translation_table() function : usage variations - unexpected table values
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN"){
+ die('skip Not for Windows');
+}
+
+if( !setlocale(LC_ALL, "en_US.UTF-8") ) {
+ die('skip failed to set locale settings to "en-US.UTF-8"');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * test get_html_translation_table() with unexpected value for argument $table
+*/
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+echo "*** Testing get_html_translation_table() : usage variations ***\n";
+// initialize all required variables
+$quote_style = ENT_COMPAT;
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// a resource variable
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new stdclass(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of get_html_translation_table()
+// when $table arugment is supplied with different values
+echo "\n--- Testing get_html_translation_table() by supplying different values for 'table' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $table = $values [$index];
+
+ var_dump( get_html_translation_table($table) );
+ var_dump( get_html_translation_table($table, $quote_style) );
+
+ $counter ++;
+}
+
+// close resource
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : usage variations ***
+
+--- Testing get_html_translation_table() by supplying different values for 'table' argument ---
+-- Iteration 1 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 2 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 3 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 4 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 5 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, array given in %s on line %s
+NULL
+-- Iteration 6 --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 7 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 8 --
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(100) {
+ [" "]=>
+ string(6) "&nbsp;"
+ ["¡"]=>
+ string(7) "&iexcl;"
+ ["¢"]=>
+ string(6) "&cent;"
+ ["£"]=>
+ string(7) "&pound;"
+ ["¤"]=>
+ string(8) "&curren;"
+ ["¥"]=>
+ string(5) "&yen;"
+ ["¦"]=>
+ string(8) "&brvbar;"
+ ["§"]=>
+ string(6) "&sect;"
+ ["¨"]=>
+ string(5) "&uml;"
+ ["©"]=>
+ string(6) "&copy;"
+ ["ª"]=>
+ string(6) "&ordf;"
+ ["«"]=>
+ string(7) "&laquo;"
+ ["¬"]=>
+ string(5) "&not;"
+ ["­"]=>
+ string(5) "&shy;"
+ ["®"]=>
+ string(5) "&reg;"
+ ["¯"]=>
+ string(6) "&macr;"
+ ["°"]=>
+ string(5) "&deg;"
+ ["±"]=>
+ string(8) "&plusmn;"
+ ["²"]=>
+ string(6) "&sup2;"
+ ["³"]=>
+ string(6) "&sup3;"
+ ["´"]=>
+ string(7) "&acute;"
+ ["µ"]=>
+ string(7) "&micro;"
+ ["¶"]=>
+ string(6) "&para;"
+ ["·"]=>
+ string(8) "&middot;"
+ ["¸"]=>
+ string(7) "&cedil;"
+ ["¹"]=>
+ string(6) "&sup1;"
+ ["º"]=>
+ string(6) "&ordm;"
+ ["»"]=>
+ string(7) "&raquo;"
+ ["¼"]=>
+ string(8) "&frac14;"
+ ["½"]=>
+ string(8) "&frac12;"
+ ["¾"]=>
+ string(8) "&frac34;"
+ ["¿"]=>
+ string(8) "&iquest;"
+ ["À"]=>
+ string(8) "&Agrave;"
+ ["Á"]=>
+ string(8) "&Aacute;"
+ ["Â"]=>
+ string(7) "&Acirc;"
+ ["Ã"]=>
+ string(8) "&Atilde;"
+ ["Ä"]=>
+ string(6) "&Auml;"
+ ["Å"]=>
+ string(7) "&Aring;"
+ ["Æ"]=>
+ string(7) "&AElig;"
+ ["Ç"]=>
+ string(8) "&Ccedil;"
+ ["È"]=>
+ string(8) "&Egrave;"
+ ["É"]=>
+ string(8) "&Eacute;"
+ ["Ê"]=>
+ string(7) "&Ecirc;"
+ ["Ë"]=>
+ string(6) "&Euml;"
+ ["Ì"]=>
+ string(8) "&Igrave;"
+ ["Í"]=>
+ string(8) "&Iacute;"
+ ["Î"]=>
+ string(7) "&Icirc;"
+ ["Ï"]=>
+ string(6) "&Iuml;"
+ ["Ð"]=>
+ string(5) "&ETH;"
+ ["Ñ"]=>
+ string(8) "&Ntilde;"
+ ["Ò"]=>
+ string(8) "&Ograve;"
+ ["Ó"]=>
+ string(8) "&Oacute;"
+ ["Ô"]=>
+ string(7) "&Ocirc;"
+ ["Õ"]=>
+ string(8) "&Otilde;"
+ ["Ö"]=>
+ string(6) "&Ouml;"
+ ["×"]=>
+ string(7) "&times;"
+ ["Ø"]=>
+ string(8) "&Oslash;"
+ ["Ù"]=>
+ string(8) "&Ugrave;"
+ ["Ú"]=>
+ string(8) "&Uacute;"
+ ["Û"]=>
+ string(7) "&Ucirc;"
+ ["Ü"]=>
+ string(6) "&Uuml;"
+ ["Ý"]=>
+ string(8) "&Yacute;"
+ ["Þ"]=>
+ string(7) "&THORN;"
+ ["ß"]=>
+ string(7) "&szlig;"
+ ["à"]=>
+ string(8) "&agrave;"
+ ["á"]=>
+ string(8) "&aacute;"
+ ["â"]=>
+ string(7) "&acirc;"
+ ["ã"]=>
+ string(8) "&atilde;"
+ ["ä"]=>
+ string(6) "&auml;"
+ ["å"]=>
+ string(7) "&aring;"
+ ["æ"]=>
+ string(7) "&aelig;"
+ ["ç"]=>
+ string(8) "&ccedil;"
+ ["è"]=>
+ string(8) "&egrave;"
+ ["é"]=>
+ string(8) "&eacute;"
+ ["ê"]=>
+ string(7) "&ecirc;"
+ ["ë"]=>
+ string(6) "&euml;"
+ ["ì"]=>
+ string(8) "&igrave;"
+ ["í"]=>
+ string(8) "&iacute;"
+ ["î"]=>
+ string(7) "&icirc;"
+ ["ï"]=>
+ string(6) "&iuml;"
+ ["ð"]=>
+ string(5) "&eth;"
+ ["ñ"]=>
+ string(8) "&ntilde;"
+ ["ò"]=>
+ string(8) "&ograve;"
+ ["ó"]=>
+ string(8) "&oacute;"
+ ["ô"]=>
+ string(7) "&ocirc;"
+ ["õ"]=>
+ string(8) "&otilde;"
+ ["ö"]=>
+ string(6) "&ouml;"
+ ["÷"]=>
+ string(8) "&divide;"
+ ["ø"]=>
+ string(8) "&oslash;"
+ ["ù"]=>
+ string(8) "&ugrave;"
+ ["ú"]=>
+ string(8) "&uacute;"
+ ["û"]=>
+ string(7) "&ucirc;"
+ ["ü"]=>
+ string(6) "&uuml;"
+ ["ý"]=>
+ string(8) "&yacute;"
+ ["þ"]=>
+ string(7) "&thorn;"
+ ["ÿ"]=>
+ string(6) "&yuml;"
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 9 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 10 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 11 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 12 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, object given in %s on line %s
+NULL
+-- Iteration 13 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 14 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, string given in %s on line %s
+NULL
+-- Iteration 15 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 16 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 17 --
+
+Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %s
+NULL
+
+Warning: get_html_translation_table() expects parameter 1 to be long, resource given in %s on line %s
+NULL
+-- Iteration 18 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 19 --
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+array(4) {
+ ["""]=>
+ string(6) "&quot;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_variation2-win32.phpt b/ext/standard/tests/strings/get_html_translation_table_variation2-win32.phpt
new file mode 100644
index 000000000..109a40c32
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_variation2-win32.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test get_html_translation_table() function : usage variations - unexpected quote_style values
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) != "WIN"){
+ die('skip only for Windows');
+}
+
+if( !setlocale(LC_ALL, "English_United States.1252") ) {
+ die('skip failed to set locale settings to "English_United States.1252"');
+}
+
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * test get_html_translation_table() with unexpteced value for argument $quote_style
+*/
+
+//set locale
+setlocale(LC_ALL, "English_United States.1252");
+
+echo "*** Testing get_html_translation_table() : usage variations ***\n";
+// initialize all required variables
+$table = HTML_SPECIALCHARS;
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// a resource var
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new stdclass(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of get_html_translation_table()
+// when $quote_style arugment is supplied with different values
+echo "\n--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $quote_style = $values [$index];
+
+ var_dump( get_html_translation_table($table, $quote_style) );
+
+ $counter ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : usage variations ***
+
+--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---
+-- Iteration 1 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 2 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 3 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 4 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 5 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 6 --
+array(4) {
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 7 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 8 --
+array(4) {
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 9 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 10 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 11 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 12 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, object given in %s on line %s
+NULL
+-- Iteration 13 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 14 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 15 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 16 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 17 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, resource given in %s on line %s
+NULL
+-- Iteration 18 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 19 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/get_html_translation_table_variation2.phpt b/ext/standard/tests/strings/get_html_translation_table_variation2.phpt
new file mode 100644
index 000000000..cc055f37f
--- /dev/null
+++ b/ext/standard/tests/strings/get_html_translation_table_variation2.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test get_html_translation_table() function : usage variations - unexpected quote_style values
+--SKIPIF--
+<?php
+if( substr(PHP_OS, 0, 3) == "WIN"){
+ die('skip Not for Windows');
+}
+
+if( !setlocale(LC_ALL, "en_US.UTF-8") ) {
+ die('skip failed to set locale settings to "en-US.UTF-8"');
+}
+?>
+--FILE--
+<?php
+/* Prototype : array get_html_translation_table ( [int $table [, int $quote_style]] )
+ * Description: Returns the internal translation table used by htmlspecialchars and htmlentities
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * test get_html_translation_table() with unexpteced value for argument $quote_style
+*/
+
+//set locale to en_US.UTF-8
+setlocale(LC_ALL, "en_US.UTF-8");
+
+echo "*** Testing get_html_translation_table() : usage variations ***\n";
+// initialize all required variables
+$table = HTML_SPECIALCHARS;
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+// a resource var
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new stdclass(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of get_html_translation_table()
+// when $quote_style arugment is supplied with different values
+echo "\n--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $quote_style = $values [$index];
+
+ var_dump( get_html_translation_table($table, $quote_style) );
+
+ $counter ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing get_html_translation_table() : usage variations ***
+
+--- Testing get_html_translation_table() by supplying different values for 'quote_style' argument ---
+-- Iteration 1 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 2 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 3 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 4 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 5 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, array given in %s on line %s
+NULL
+-- Iteration 6 --
+array(4) {
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 7 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 8 --
+array(4) {
+ ["'"]=>
+ string(5) "&#39;"
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 9 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 10 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 11 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 12 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, object given in %s on line %s
+NULL
+-- Iteration 13 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 14 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, string given in %s on line %s
+NULL
+-- Iteration 15 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 16 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 17 --
+
+Warning: get_html_translation_table() expects parameter 2 to be long, resource given in %s on line %s
+NULL
+-- Iteration 18 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+-- Iteration 19 --
+array(3) {
+ ["<"]=>
+ string(4) "&lt;"
+ [">"]=>
+ string(4) "&gt;"
+ ["&"]=>
+ string(5) "&amp;"
+}
+Done
diff --git a/ext/standard/tests/strings/htmlentities-utf.phpt b/ext/standard/tests/strings/htmlentities-utf.phpt
new file mode 100755
index 000000000..6b83afc77
--- /dev/null
+++ b/ext/standard/tests/strings/htmlentities-utf.phpt
@@ -0,0 +1,34 @@
+--TEST--
+HTML entities with invalid chars
+--INI--
+output_handler=
+--FILE--
+<?php
+setlocale (LC_CTYPE, "C");
+$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x80\xBE");
+foreach($strings as $string) {
+ $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8");
+ var_dump(bin2hex($sc_encoded));
+ $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8");
+ var_dump(bin2hex($ent_encoded));
+}
+?>
+--EXPECT--
+string(8) "266c743b"
+string(8) "266c743b"
+string(0) ""
+string(0) ""
+string(4) "d090"
+string(4) "d090"
+string(0) ""
+string(0) ""
+string(8) "d090d0b0"
+string(8) "d090d0b0"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(8) "2667743b"
+string(8) "2667743b" \ No newline at end of file
diff --git a/ext/standard/tests/strings/htmlentities04.phpt b/ext/standard/tests/strings/htmlentities04.phpt
index 8e362d073..2d67c77f0 100644
--- a/ext/standard/tests/strings/htmlentities04.phpt
+++ b/ext/standard/tests/strings/htmlentities04.phpt
@@ -6,6 +6,7 @@ $result = (bool)setlocale(LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP");
if (!$result || preg_match('/EUC[^a-zA-Z]*JP/i', setlocale(LC_CTYPE, 0)) == 0) {
die("skip setlocale() failed\n");
}
+echo "warn possibly braindead libc\n";
?>
--INI--
output_handler=
diff --git a/ext/standard/tests/strings/htmlentities15.phpt b/ext/standard/tests/strings/htmlentities15.phpt
index 2dc36e6f7..a15948fbe 100644
--- a/ext/standard/tests/strings/htmlentities15.phpt
+++ b/ext/standard/tests/strings/htmlentities15.phpt
@@ -10,6 +10,7 @@ $result = (bool)setlocale(LC_CTYPE, "ru_RU.koi8r", "ru_RU.KOI8-R");
if (!$result || preg_match('/koi8/i', setlocale(LC_CTYPE, 0)) == 0) {
die("skip setlocale() failed\n");
}
+echo "warn possibly braindead libc\n";
?>
--FILE--
<?php
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
new file mode 100644
index 000000000..dc027398d
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test htmlspecialchars_decode() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing htmlspecialchars_decode() : basic functionality ***\n";
+
+
+// Initialise arguments
+//value initialized = Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. "double quoted string"
+$single_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
+$double_quote_string = "Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 25. 1111 &amp; 0000 = 0000. &quot; double quoted string &quot;";
+
+// Calling htmlspecialchars_decode() with default arguments
+var_dump( htmlspecialchars_decode($single_quote_string) );
+var_dump( htmlspecialchars_decode($double_quote_string) );
+
+// Calling htmlspecialchars_decode() with optional 'quote_style' argument
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_COMPAT) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_COMPAT) );
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_NOQUOTES) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_NOQUOTES) );
+var_dump( htmlspecialchars_decode($single_quote_string, ENT_QUOTES) );
+var_dump( htmlspecialchars_decode($double_quote_string, ENT_QUOTES) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : basic functionality ***
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(92) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
+string(102) "Roy&#039;s height > Sam&#039;s height. 13 < 25. 1111 & 0000 = 0000. &quot; double quoted string &quot;"
+string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt
new file mode 100644
index 000000000..f4201d284
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test htmlspecialchars_decode() function : error conditions
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+echo "*** Testing htmlspecialchars_decode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing htmlspecialchars_decode() function with Zero arguments --\n";
+var_dump( htmlspecialchars_decode() );
+
+//Test htmlspecialchars_decode with one more than the expected number of arguments
+echo "\n-- Testing htmlspecialchars_decode() function with more than expected no. of arguments --\n";
+$string = "<html>hello &amp; &gt; &lt; &quot; &#039; world</html>";
+$quote_style = ENT_COMPAT;
+$extra_arg = 10;
+var_dump( htmlspecialchars_decode($string, $quote_style, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : error conditions ***
+
+-- Testing htmlspecialchars_decode() function with Zero arguments --
+
+Warning: htmlspecialchars_decode() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing htmlspecialchars_decode() function with more than expected no. of arguments --
+
+Warning: htmlspecialchars_decode() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt
new file mode 100644
index 000000000..5f0582d51
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - unexpected values for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() with unexpected input values for $string argument
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+//get a class
+class classA
+{
+ function __toString() {
+ return "ClassAObject";
+ }
+}
+
+//get a resource variable
+$file_handle=fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource
+ $file_handle
+);
+
+// loop through each element of the array for string
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iterator $iterator --\n";
+ var_dump( htmlspecialchars_decode($value) );
+ $iterator++;
+};
+
+// close the file resource used
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iterator 1 --
+string(1) "0"
+-- Iterator 2 --
+string(1) "1"
+-- Iterator 3 --
+string(5) "12345"
+-- Iterator 4 --
+string(5) "-2345"
+-- Iterator 5 --
+string(4) "10.5"
+-- Iterator 6 --
+string(5) "-10.5"
+-- Iterator 7 --
+string(12) "105000000000"
+-- Iterator 8 --
+string(7) "1.06E-9"
+-- Iterator 9 --
+string(3) "0.5"
+-- Iterator 10 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 11 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 12 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 13 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 14 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iterator 15 --
+string(0) ""
+-- Iterator 16 --
+string(0) ""
+-- Iterator 17 --
+string(1) "1"
+-- Iterator 18 --
+string(0) ""
+-- Iterator 19 --
+string(1) "1"
+-- Iterator 20 --
+string(0) ""
+-- Iterator 21 --
+string(0) ""
+-- Iterator 22 --
+string(0) ""
+-- Iterator 23 --
+string(12) "ClassAObject"
+-- Iterator 24 --
+string(0) ""
+-- Iterator 25 --
+string(0) ""
+-- Iterator 26 --
+
+Warning: htmlspecialchars_decode() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt
new file mode 100644
index 000000000..2ef7dd1bb
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - unexpected values for 'quote_style' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() by giving unexpected input values for $quote_style argument
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+// Initialise function arguments
+// value initialized = Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "
+$string = "<html>Roy&#039;s height &gt; Sam&#039;s height. 13 &lt; 15. 1111 &amp; 0000 = 0000. &quot; double quote string &quot;</html>";
+
+//get a class
+class classA {
+ function __toString() {
+ return "Class A Object";
+ }
+}
+
+//get a resource variable
+$file_handle = fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource
+ $file_handle
+);
+
+// loop through each element of the array for quote_style
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( htmlspecialchars_decode($string, $value) );
+ $iterator++;
+}
+
+// close the file resource used
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+
+-- Iteration 1 --
+string(104) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>"
+
+-- Iteration 2 --
+string(104) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. " double quote string "</html>"
+
+-- Iteration 3 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 4 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 5 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 6 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 7 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 8 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 9 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 10 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 12 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 13 --
+string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 14 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 15 --
+string(104) "<html>Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 16 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 17 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 22 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 23 --
+string(114) "<html>Roy&#039;s height > Sam&#039;s height. 13 < 15. 1111 & 0000 = 0000. &quot; double quote string &quot;</html>"
+
+-- Iteration 24 --
+
+Warning: htmlspecialchars_decode() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt
new file mode 100644
index 000000000..b15307614
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - heredoc strings for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() with various heredoc strings as argument for $string
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+// empty heredoc string
+$empty_string = <<<EOT
+EOT;
+
+// Heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// heredoc with multiline string
+$multiline_string = <<<EOT
+<html>Roy&#039;s height &gt; Sam&#039;s height
+13 &lt; 25
+1111 &amp; 0000 = 0000
+&quot;This is a double quoted string&quot;
+EOT;
+
+// heredoc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+<html>Roy&#039;s height\r &gt; Sam\t&#039;s height
+1111\t\t &amp; 0000\v\v = \f0000
+&quot; heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces&quot;
+EOT;
+
+// heredoc with numeric values
+$numeric_string = <<<EOT
+<html>11 &lt; 12. 123 string 4567
+&quot;string&quot; 1111\t &amp; 0000\t = 0000\n;
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+<html>&lt; This's a string with quotes:
+"strings in double quote" &amp;
+'strings in single quote' &quot;
+this\line is &#039;single quoted&#039; /with\slashes </html>
+EOT;
+
+$res_heredoc_strings = array(
+ //heredoc strings
+ $empty_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// loop through $res_heredoc_strings array and check the working on htmlspecialchars_decode()
+$count = 1;
+for($index =0; $index < count($res_heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( htmlspecialchars_decode($res_heredoc_strings[$index]) );
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(103) "<html>Roy&#039;s height > Sam&#039;s height
+13 < 25
+1111 & 0000 = 0000
+"This is a double quoted string""
+-- Iteration 4 --
+string(130) "<html>Roy&#039;s height > Sam &#039;s height
+1111 & 0000 = 0000
+" heredoc
+double quoted string. with different white spaces""
+-- Iteration 5 --
+string(62) "<html>11 < 12. 123 string 4567
+"string" 1111 & 0000 = 0000
+;"
+-- Iteration 6 --
+string(153) "<html>< This's a string with quotes:
+"strings in double quote" &
+'strings in single quote' "
+this\line is &#039;single quoted&#039; /with\slashes </html>"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt
new file mode 100644
index 000000000..e51e904fe
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - single quoted strings for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * Testing htmlspecialchars_decode() with various single quoted strings as argument for $string
+*/
+
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+//single quoted strings
+$values = array (
+ 'Roy&#039s height &gt; Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;',
+ 'Roy&#039;s height &gt; Sam&#039;s height... \t\t 13 &lt; 15...\n\r &quot; double quote\f\v string &quot;',
+ '\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f',
+ '\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height',
+ '\n 1\t3 &\tgt; 11 but 11 &\tlt; 12',
+);
+
+// loop through each element of the values array to check htmlspecialchars_decode() function with all possible arguments
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( htmlspecialchars_decode($value) );
+ var_dump( htmlspecialchars_decode($value, ENT_COMPAT) );
+ var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) );
+ var_dump( htmlspecialchars_decode($value, ENT_QUOTES) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iteration 1 --
+string(90) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(90) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(100) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;"
+string(85) "Roy&#039s height > Sam's \$height... 1111 &ap; 0000 = 0000... " double quote string ""
+-- Iteration 2 --
+string(88) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r " double quote\f\v string ""
+string(88) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r " double quote\f\v string ""
+string(98) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r &quot; double quote\f\v string &quot;"
+string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
+-- Iteration 3 --
+string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
+string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
+string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
+string(38) "\nRoy's height &gt\t; Sam's\v height\f"
+-- Iteration 4 --
+string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
+string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
+string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
+string(38) "\r\tRoy's height &gt\r; Sam\t's height"
+-- Iteration 5 --
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
+Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt
new file mode 100644
index 000000000..307cfe6d9
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test htmlspecialchars_decode() function : usage variations - double quoted strings for 'string' argument
+--FILE--
+<?php
+/* Prototype : string htmlspecialchars_decode(string $string [, int $quote_style])
+ * Description: Convert special HTML entities back to characters
+ * Source code: ext/standard/html.c
+*/
+
+/*
+ * testing htmlspecialchars_decode() for various double quoted strings as argument for $string
+*/
+echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
+
+//double quoted strings
+$strings = array (
+ "Roy&#039s height &gt; Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;",
+ "Roy&#039;s height &gt; Sam&#039;s height... \t\t 13 &lt; 15...\n\r &quot; double quote\f\v string &quot;",
+ "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f",
+ "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height",
+ "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12",
+);
+
+// loop through each element of the array to check htmlspecialchars_decode() function with all possible arguments
+$iterator = 1;
+foreach($strings as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( htmlspecialchars_decode($value) );
+ var_dump( htmlspecialchars_decode($value, ENT_COMPAT) );
+ var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) );
+ var_dump( htmlspecialchars_decode($value, ENT_QUOTES) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing htmlspecialchars_decode() : usage variations ***
+-- Iteration 1 --
+string(89) "Roy&#039s height > Sam&#039;s $height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(89) "Roy&#039s height > Sam&#039;s $height... 1111 &ap; 0000 = 0000... " double quote string ""
+string(99) "Roy&#039s height > Sam&#039;s $height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;"
+string(84) "Roy&#039s height > Sam's $height... 1111 &ap; 0000 = 0000... " double quote string ""
+-- Iteration 2 --
+string(82) "Roy&#039;s height > Sam&#039;s height... 13 < 15...
+ " double quote string ""
+string(82) "Roy&#039;s height > Sam&#039;s height... 13 < 15...
+ " double quote string ""
+string(92) "Roy&#039;s height > Sam&#039;s height... 13 < 15...
+ &quot; double quote string &quot;"
+string(72) "Roy's height > Sam's height... 13 < 15...
+ " double quote string ""
+-- Iteration 3 --
+string(44) "
+Roy&#039;s height &gt ; Sam&#039;s height "
+string(44) "
+Roy&#039;s height &gt ; Sam&#039;s height "
+string(44) "
+Roy&#039;s height &gt ; Sam&#039;s height "
+string(34) "
+Roy's height &gt ; Sam's height "
+-- Iteration 4 --
+string(44) " Roy&#039;s height &gt ; Sam &#039;s height"
+string(44) " Roy&#039;s height &gt ; Sam &#039;s height"
+string(44) " Roy&#039;s height &gt ; Sam &#039;s height"
+string(34) " Roy's height &gt ; Sam 's height"
+-- Iteration 5 --
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+string(30) "
+ 1 3 & gt; 11 but 11 & lt; 12"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
new file mode 100644
index 000000000..d1636eb15
--- /dev/null
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
index 2aaed8d05..fccb09e62 100644
--- a/ext/standard/tests/strings/implode1.phpt
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_basic.phpt b/ext/standard/tests/strings/join_basic.phpt
new file mode 100644
index 000000000..164c4613a
--- /dev/null
+++ b/ext/standard/tests/strings/join_basic.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test join() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+echo "*** Testing join() : basic functionality ***\n";
+
+// Initialize all required variables
+$glue = ',';
+$pieces = array(1, 2, 3, 4);
+
+// pieces as arry with numeric values
+var_dump( join($glue, $pieces) );
+
+// pieces as array with strings values
+$glue = ", "; // multiple car as glue
+$pieces = array("Red", "Green", "Blue", "Black", "White");
+var_dump( join($glue, $pieces) );
+
+// pices as associative array (numeric values)
+$pieces = array("Hour" => 10, "Minute" => 20, "Second" => 40);
+$glue = ':';
+var_dump( join($glue, $pieces) );
+
+// pices as associative array (string/numeric values)
+$pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007);
+$glue = '/';
+var_dump( join($glue, $pieces) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : basic functionality ***
+string(7) "1,2,3,4"
+string(30) "Red, Green, Blue, Black, White"
+string(8) "10:20:40"
+string(21) "Friday/September/2007"
+Done
diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt
new file mode 100644
index 000000000..aa6bdc230
--- /dev/null
+++ b/ext/standard/tests/strings/join_error.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test join() function: error conditions
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+echo "*** Testing join() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing join() function with Zero arguments --\n";
+var_dump( join() );
+
+// More than expected number of arguments
+echo "\n-- Testing join() function with more than expected no. of arguments --\n";
+$glue = 'string_val';
+$pieces = array(1, 2);
+$extra_arg = 10;
+
+var_dump( join($glue, $pieces, $extra_arg) );
+
+// Less than expected number of arguments
+echo "\n-- Testing join() with less than expected no. of arguments --\n";
+$glue = 'string_val';
+
+var_dump( join($glue));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : error conditions ***
+
+-- Testing join() function with Zero arguments --
+
+Warning: Wrong parameter count for join() in %s on line %d
+NULL
+
+-- Testing join() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for join() in %s on line %d
+NULL
+
+-- Testing join() with less than expected no. of arguments --
+
+Warning: join(): Argument must be an array in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt
new file mode 100644
index 000000000..a42c543b5
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation1.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test join() function : usage variations - unexpected values for 'glue' argument
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * testing join() by passing different unexpected value for glue argument
+*/
+
+echo "*** Testing join() : usage variations ***\n";
+// initialize all required variables
+$pieces = array("element1", "element2");
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// define a class
+class test
+{
+ var $t = 10;
+ function __toString() {
+ return "testObject";
+ }
+}
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new test(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource variable
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of join()
+// when $glue arugment is supplied with different values
+echo "\n--- Testing join() by supplying different values for 'glue' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $glue = $values [$index];
+
+ var_dump( join($glue, $pieces) );
+
+ $counter ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : usage variations ***
+
+--- Testing join() by supplying different values for 'glue' argument ---
+-- Iteration 1 --
+string(17) "element10element2"
+-- Iteration 2 --
+string(17) "element11element2"
+-- Iteration 3 --
+string(21) "element112345element2"
+-- Iteration 4 --
+string(21) "element1-2345element2"
+-- Iteration 5 --
+string(20) "element110.5element2"
+-- Iteration 6 --
+string(21) "element1-10.5element2"
+-- Iteration 7 --
+string(28) "element1105000000000element2"
+-- Iteration 8 --
+string(23) "element11.06E-9element2"
+-- Iteration 9 --
+string(19) "element10.5element2"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(0) ""
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "0"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "1"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(7) "1Array2"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(11) "redArraypen"
+-- Iteration 15 --
+string(17) "element11element2"
+-- Iteration 16 --
+string(16) "element1element2"
+-- Iteration 17 --
+string(17) "element11element2"
+-- Iteration 18 --
+string(16) "element1element2"
+-- Iteration 19 --
+string(26) "element1testObjectelement2"
+-- Iteration 20 --
+string(16) "element1element2"
+-- Iteration 21 --
+string(16) "element1element2"
+-- Iteration 22 --
+string(16) "element1element2"
+-- Iteration 23 --
+string(16) "element1element2"
+-- Iteration 24 --
+string(%d) "element1Resource id #%delement2"
+-- Iteration 25 --
+string(16) "element1element2"
+-- Iteration 26 --
+string(16) "element1element2"
+Done
diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt
new file mode 100644
index 000000000..50395f176
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation2.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test join() function : usage variations - unexpected values for 'pieces' argument(Bug#42789)
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * test join() by passing different unexpected value for pieces argument
+*/
+
+echo "*** Testing join() : usage variations ***\n";
+// initialize all required variables
+$glue = '::';
+
+// get an unset variable
+$unset_var = array(1, 2);
+unset($unset_var);
+
+// get a resouce variable
+$fp = fopen(__FILE__, "r");
+
+// define a class
+class test
+{
+ var $t = 10;
+ var $p = 10;
+ function __toString() {
+ return "testObject";
+ }
+}
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new test(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource variable
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of join()
+// when $pieces arugment is supplied with different values
+echo "\n--- Testing join() by supplying different values for 'pieces' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $pieces = $values [$index];
+
+ var_dump( join($glue, $pieces) );
+
+ $counter ++;
+}
+
+// close the resources used
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : usage variations ***
+
+--- Testing join() by supplying different values for 'pieces' argument ---
+-- Iteration 1 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 2 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 3 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 4 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 18 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 22 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+-- Iteration 23 --
+
+Warning: join(): Invalid arguments passed in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/join_variation3.phpt b/ext/standard/tests/strings/join_variation3.phpt
new file mode 100644
index 000000000..5b0ad5a52
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation3.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test join() function : usage variations - different values for 'pieces' argument
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * test join() by giving different pieces values
+*/
+
+echo "*** Testing join() : usage variations ***\n";
+
+$pieces_arrays = array (
+ array(1, 2), // array with default keys and numrice values
+ array(1.1, 2.2), // array with default keys & float values
+ array( array(2), array(1)), // sub arrays
+ array(false,true), // array with default keys and boolean values
+ array(), // empty array
+ array(NULL), // array with NULL
+ array("a","aaaa","b","bbbb","c","ccccc"),
+
+ // associative arrays
+ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
+ array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
+ array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
+ array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
+ array("one" => 1, 2 => "two", 4 => "four"), //mixed
+
+ // associative array, containing null/empty/boolean values as key/value
+ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
+ array(true => "true", false => "false", "false" => false, "true" => true),
+ array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
+ array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
+ array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
+
+ // array with repetative keys
+ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
+);
+
+// a multichar glue value
+$glue = "], [";
+
+// loop through each $pieces_arrays element and call join()
+$iteration = 1;
+for($index = 0; $index < count($pieces_arrays); $index ++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( join($glue, $pieces_arrays[$index]) );
+ $iteration ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing join() : usage variations ***
+-- Iteration 1 --
+string(6) "1], [2"
+-- Iteration 2 --
+string(10) "1.1], [2.2"
+-- Iteration 3 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(14) "Array], [Array"
+-- Iteration 4 --
+string(5) "], [1"
+-- Iteration 5 --
+string(0) ""
+-- Iteration 6 --
+string(0) ""
+-- Iteration 7 --
+string(36) "a], [aaaa], [b], [bbbb], [c], [ccccc"
+-- Iteration 8 --
+string(19) "one], [two], [three"
+-- Iteration 9 --
+string(11) "1], [2], [3"
+-- Iteration 10 --
+string(20) "10], [20], [40], [30"
+-- Iteration 11 --
+string(23) "ten], [twenty], [thirty"
+-- Iteration 12 --
+string(16) "1], [two], [four"
+-- Iteration 13 --
+string(12) "null], [], ["
+-- Iteration 14 --
+string(22) "true], [false], [], [1"
+-- Iteration 15 --
+string(14) "emptys], [], ["
+-- Iteration 16 --
+string(21) "], [], [], [], [], [1"
+-- Iteration 17 --
+string(11) "4], [5], [6"
+-- Iteration 18 --
+string(13) "10], [20], [3"
+Done
diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt
new file mode 100644
index 000000000..b4c4b052f
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_variation5.phpt b/ext/standard/tests/strings/join_variation5.phpt
new file mode 100644
index 000000000..a02efd776
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation5.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test join() function : usage variations - sub array as argument
+--FILE--
+<?php
+/* Prototype : string join( string $glue, array $pieces )
+ * Description: Join array elements with a string
+ * Source code: ext/standard/string.c
+ * Alias of function: implode()
+*/
+
+/*
+ * test join() by passing pieces as array containing sub array(s)
+*/
+
+echo "*** Testing implode() : usage variations - sub arrays ***\n";
+$sub_array = array(array(1,2,3,4), array(1 => "one", 2 => "two"), "PHP", 50);
+
+// pieces as array containing sub array
+var_dump( join("TEST", $sub_array) );
+
+// glue as array & pieces as array containing sub array
+var_dump( join(array(1, 2, 3, 4), $sub_array) );
+
+// numeric value as glue, pieces as array containg sub array
+var_dump( join(2, $sub_array) );
+
+// using directly the sub_array as pieces
+var_dump( join(", ", $sub_array[0]) );
+var_dump( join(", ", $sub_array[1]) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing implode() : usage variations - sub arrays ***
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(27) "ArrayTESTArrayTESTPHPTEST50"
+
+Notice: Array to string conversion in %s on line %d
+string(19) "1Array2Array3Array4"
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(18) "Array2Array2PHP250"
+string(10) "1, 2, 3, 4"
+string(8) "one, two"
+Done
diff --git a/ext/standard/tests/strings/join_variation6.phpt b/ext/standard/tests/strings/join_variation6.phpt
new file mode 100644
index 000000000..e8d098115
--- /dev/null
+++ b/ext/standard/tests/strings/join_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/nl2br_error.phpt b/ext/standard/tests/strings/nl2br_error.phpt
new file mode 100644
index 000000000..c600dddda
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test nl2br() function : error conditions
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str)
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing nl2br() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing nl2br() function with Zero arguments --";
+var_dump( nl2br() );
+
+//Test nl2br with one more than the expected number of arguments
+echo "\n-- Testing nl2br() function with more than expected no. of arguments --";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( nl2br($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : error conditions ***
+
+-- Testing nl2br() function with Zero arguments --
+Warning: Wrong parameter count for nl2br() in %s on line %d
+NULL
+
+-- Testing nl2br() function with more than expected no. of arguments --
+Warning: Wrong parameter count for nl2br() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation1.phpt b/ext/standard/tests/strings/nl2br_variation1.phpt
new file mode 100644
index 000000000..ab15ca1fe
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation1.phpt
@@ -0,0 +1,80 @@
+--TEST--
+Test nl2br() function : usage variations - double quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str);
+ * Description: Inserts HTML line breaks before all newlines in a string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test nl2br() function by passing double quoted strings containing various
+ * combinations of new line chars to 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+
+$strings = array(
+ //new line chars embedded in strings
+ "Hello\nWorld",
+ "\nHello\nWorld\n",
+ "Hello\rWorld",
+ "\rHello\rWorld\r",
+ "Hello\r\nWorld",
+ "\r\nHello\r\nWorld\r\n",
+
+ //one blank line
+ "
+",
+
+ //two blank lines
+ "
+
+",
+
+ //inserted new line in a string
+ "Hello
+World"
+);
+
+//loop through $strings array to test nl2br() function with each element
+$count = 1;
+foreach( $strings as $str ){
+ echo "-- Iteration $count --\n";
+ var_dump(nl2br($str) );
+ $count ++ ;
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+-- Iteration 1 --
+string(17) "Hello<br />
+World"
+-- Iteration 2 --
+string(31) "<br />
+Hello<br />
+World<br />
+"
+-- Iteration 3 --
+string(17) "Hello<br /> World"
+-- Iteration 4 --
+string(31) "<br /> Hello<br /> World<br /> "
+-- Iteration 5 --
+string(18) "Hello<br />
+World"
+-- Iteration 6 --
+string(34) "<br />
+Hello<br />
+World<br />
+"
+-- Iteration 7 --
+string(7) "<br />
+"
+-- Iteration 8 --
+string(14) "<br />
+<br />
+"
+-- Iteration 9 --
+string(17) "Hello<br />
+World"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation2.phpt b/ext/standard/tests/strings/nl2br_variation2.phpt
new file mode 100644
index 000000000..a4423df31
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation2.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test nl2br() function : usage variations - single quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str);
+ * Description: Inserts HTML line breaks before all newlines in a string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test nl2br() function by passing single quoted strings containing various
+ * combinations of new line chars to 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+$strings = array(
+ '\n',
+ '\r',
+ '\r\n',
+ 'Hello\nWorld',
+ 'Hello\rWorld',
+ 'Hello\r\nWorld',
+
+ //one blank line
+ '
+',
+
+ //two blank lines
+ '
+
+',
+
+ //inserted new line
+ 'Hello
+World'
+);
+
+//loop through $strings array to test nl2br() function with each element
+$count = 1;
+foreach( $strings as $str ){
+ echo "-- Iteration $count --\n";
+ var_dump(nl2br($str) );
+ $count ++ ;
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+-- Iteration 1 --
+string(2) "\n"
+-- Iteration 2 --
+string(2) "\r"
+-- Iteration 3 --
+string(4) "\r\n"
+-- Iteration 4 --
+string(12) "Hello\nWorld"
+-- Iteration 5 --
+string(12) "Hello\rWorld"
+-- Iteration 6 --
+string(14) "Hello\r\nWorld"
+-- Iteration 7 --
+string(7) "<br />
+"
+-- Iteration 8 --
+string(14) "<br />
+<br />
+"
+-- Iteration 9 --
+string(17) "Hello<br />
+World"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation3.phpt b/ext/standard/tests/strings/nl2br_variation3.phpt
new file mode 100644
index 000000000..b1341d13d
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation3.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test nl2br() function : usage variations - heredoc strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str);
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test nl2br() function by passing heredoc strings containing various
+ * combinations of new line chars to 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+//heredoc string containing new line chars(\n, \r and combinations of \r & \n) and new lines
+$heredoc_str1 = <<<EOD
+\n
+\r
+\r\n
+\nnn\n\n\nn
+\rrr\r\r\rr
+\n\r\n\r\r\n\nr\rn
+EOD;
+
+//heredoc string containing embedded 'new line chars'/'new lines' in the string
+$heredoc_str2 = <<<EOD
+Hello\nWorld\r
+This is \tes\t for \n \new lines
+like \n \r\n \r \n\r and etc
+EOD;
+
+var_dump(nl2br($heredoc_str1) );
+var_dump(nl2br($heredoc_str2) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+string(147) "<br />
+<br />
+ <br />
+ <br />
+<br />
+<br />
+nn<br />
+<br />
+<br />
+n<br />
+ rr<br /> <br /> <br /> r<br />
+<br />
+ <br />
+ <br />
+<br />
+r<br /> n"
+string(118) "Hello<br />
+World<br />
+This is es for <br />
+ <br />
+ew lines<br />
+like <br />
+ <br />
+ <br /> <br />
+ and etc"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation4.phpt b/ext/standard/tests/strings/nl2br_variation4.phpt
new file mode 100644
index 000000000..63931afaf
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation4.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test nl2br() function : usage variations - html values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str)
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+* Test nl2br() function by passing html string inputs containing line breaks and
+* new line chars for 'str'
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+
+//array of html strings
+$strings = array(
+ "<html>Hello<br />world</html>",
+ "<html><br /></html>",
+ "<html>\nHello\r\nworld\r</html>",
+ "<html>\n \r\n \r</html>",
+);
+
+//loop through $strings array to test nl2br() function with each element
+foreach( $strings as $str ){
+ var_dump(nl2br($str) );
+}
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+string(29) "<html>Hello<br />world</html>"
+string(19) "<html><br /></html>"
+string(45) "<html><br />
+Hello<br />
+world<br /> </html>"
+string(37) "<html><br />
+ <br />
+ <br /> </html>"
+Done
diff --git a/ext/standard/tests/strings/nl2br_variation5.phpt b/ext/standard/tests/strings/nl2br_variation5.phpt
new file mode 100644
index 000000000..066d642cd
--- /dev/null
+++ b/ext/standard/tests/strings/nl2br_variation5.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test nl2br() function : usage variations - unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : string nl2br(string $str)
+ * Description: Inserts HTML line breaks before all newlines in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/*
+* Test nl2br() function by passing different types of values other than
+* expected type for 'str' argument
+*/
+
+echo "*** Testing nl2br() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//getting resource
+$file_handle = fopen(__FILE__, "r");
+
+//defining class
+class Sample {
+ public function __toString() {
+ return "My String";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ //resource
+ $file_handle,
+
+ // object data
+ new Sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+);
+
+// loop through $values array to test nl2br() function with each element
+$count = 1;
+foreach($values as $value) {
+ echo "-- Iteration $count --\n";
+ var_dump( nl2br($value) );
+ $count ++ ;
+};
+
+//closing the file handle
+fclose( $file_handle );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing nl2br() : usage variations ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(5) "-10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(1) "1"
+-- Iteration 20 --
+string(0) ""
+-- Iteration 21 --
+string(%d) "Resource id #%d"
+-- Iteration 22 --
+string(9) "My String"
+-- Iteration 23 --
+string(0) ""
+-- Iteration 24 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/setlocale_basic1.phpt b/ext/standard/tests/strings/setlocale_basic1.phpt
new file mode 100644
index 000000000..28bea0bf8
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_basic1.phpt
@@ -0,0 +1,121 @@
+--TEST--
+Test setlocale() function : basic functionality - setting system locale to a specific
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale ,
+ * or FALSE if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* test setlocale by specifying a specific locale as input */
+
+/* Prototype : array list_system_locales( void )
+ Description: To get the currently installed locle in this platform
+ Arguments : Nil
+ Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and set one among them,
+ Check the currency settings in the new locale */
+echo "*** Testing setlocale() : basic functionality - set to a specific locale ***\n";
+
+//set of locales to be used
+$common_locales = array(
+ "english_US"=> "en_US.utf8gfd",
+ "english_AU" => "en_AU.utf8hgg",
+ "korean_KR" => "ko_KR.utf8",
+ "Chinese_zh" => "zh_CN.utf8",
+ "germen_DE" => "de_DE.utf8",
+ "spanish_es" => "es_EC.utf8",
+ "french_FR" => "fr_FR.utf8",
+ "japanees_JP" => "ja_JP.utf8",
+ "greek_GR" => "el_GR.utf8",
+ "dutch_NL" => "nl_NL.utf8"
+);
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// set the system locale to a locale, choose the right locale by
+// finding a common locale in commonly used locale stored in
+// $common_locales & locales that are available in the system, stored
+// in $all_system_locales.
+echo "Setting system locale(LC_ALL) to ";
+foreach($common_locales as $value) {
+ // check if a commonly used locale is installed in the system
+ if(in_array($value, $all_system_locales)){
+ echo "$value\n"; // print, this is found
+ // set the found locale as current locale
+ var_dump(setlocale(LC_ALL, $value ));
+ // stop here
+ break;
+ }
+ else{
+ // continue to check if next commonly locale is installed in the system
+ continue;
+ }
+}
+
+// check that new locale setting is effective
+// use localeconv() to get the details of currently set locale
+$locale_info = localeconv();
+
+//checking currency settings in the new locale to see if the setlocale() was effective
+$new_currency = trim($locale_info['int_curr_symbol']);
+echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$value].", Found: ".$new_currency."\n";
+echo "Test ";
+if(trim($currency_symbol[$value]) == $new_currency){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : basic functionality - set to a specific locale ***
+Setting system locale(LC_ALL) to %s
+string(%d) %s
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_basic2.phpt b/ext/standard/tests/strings/setlocale_basic2.phpt
new file mode 100644
index 000000000..22629eb93
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_basic2.phpt
@@ -0,0 +1,126 @@
+--TEST--
+Test setlocale() function : basic functionality - set locale using an array
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test the setlocale() when an array is provided as input containing list of locales */
+
+/* Prototype : array list_system_locales( void )
+ * Description: To get the currently installed locle in this platform
+ * Arguments : Nil
+ * Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and prepare a list of locales that can be used as
+ input to setlocale() */
+
+echo "*** Testing setlocale() with an array containing list of locales ***\n";
+
+//set of locales to be used
+$common_locales = array(
+ "english_US"=> "en_US.utf8",
+ "english_AU" => "en_AU.utf8",
+ "korean_KR" => "ko_KR.utf8",
+ "Chinese_zh" => "zh_CN.utf8",
+ "germen_DE" => "de_DE.utf8",
+ "spanish_es" => "es_EC.utf8",
+ "french_FR" => "fr_FR.utf8",
+ "japanees_JP" => "ja_JP.utf8",
+ "greek_GR" => "el_GR.utf8",
+ "dutch_NL" => "nl_NL.utf8"
+);
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// prepare the list of locales based on list of locales found in the system
+// and those known to this script ( as stored $common_locales) which can be
+// given as input to setlocale(), later verify the new locale setting by
+// checking the currency setting of the system(use localconv())
+$list_of_locales = array();
+foreach($common_locales as $value) {
+ if( in_array($value, $all_system_locales) ) {
+ $list_of_locales[] = $value;
+ }
+}
+
+// Now $list_of_locales array contains the locales that can be passed to
+// setlocale() function.
+echo "-- Testing setlocale() : 'category' argument as LC_ALL & 'locale' argument as an array --\n";
+if ( count($list_of_locales) > 0 ) {
+ // set locale to $list_of_locales
+ $new_locale = setlocale(LC_ALL, $list_of_locales);
+
+ // dump the current locale
+ var_dump($new_locale);
+
+ // check that new locale setting is effective
+ // use localeconv() to get the details of currently set locale
+ $locale_info = localeconv();
+ $new_currency = trim($locale_info['int_curr_symbol']);
+
+ echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n";
+ echo "Test ";
+
+ if(trim($currency_symbol[$new_locale]) == $new_currency){
+ echo "PASSED.\n";
+ } else {
+ echo "FAILED.\n";
+ }
+} else {
+ echo "Test FAILED.\n";
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() with an array containing list of locales ***
+-- Testing setlocale() : 'category' argument as LC_ALL & 'locale' argument as an array --
+string(%d) "%s"
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_basic3.phpt b/ext/standard/tests/strings/setlocale_basic3.phpt
new file mode 100644
index 000000000..a8c53fd9e
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_basic3.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Test setlocale() function : basic functionality - passing multiple locales as argument
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test the setlocale() when multiple locales are provided as argument */
+
+/* Prototype : array list_system_locales( void )
+ Description: To get the currently installed locle in this platform
+ Arguments : Nil
+ Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and get three locales that can be use to
+ pass as argument to setlocale() */
+echo "*** Testing setlocale() by passing multiple locales as argument ***\n";
+
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// Now check for three locales that is present in the system and use that as argument to setlocale()
+if( in_array("en_US.utf8",$all_system_locales) ||
+ in_array("Ko_KR.utf8",$all_system_locales) ||
+ in_array("zh_CN.utf8",$all_system_locales) ) {
+ echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --\n";
+
+ // call setlocale()
+ $new_locale = setlocale(LC_ALL, "en_US.utf8", "Ko_KR.utf8", "zh_CN.utf8");
+
+ // dump the name of the new locale set by setlocale()
+ var_dump($new_locale);
+
+ // check that new locale setting is effective
+ // use localeconv() to get the details of currently set locale
+ $locale_info = localeconv();
+ $new_currency = trim($locale_info['int_curr_symbol']);
+
+ echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n";
+ echo "Test ";
+ if( trim($currency_symbol[$new_locale]) == $new_currency) {
+ echo "PASSED.\n";
+ } else {
+ echo "FAILED.\n";
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() by passing multiple locales as argument ***
+-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --
+string(%d) "%s"
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt
new file mode 100644
index 000000000..02010e3eb
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_error.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test setlocale() function : error condition
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing setlocale() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing setlocale() function with Zero arguments --";
+var_dump( setlocale());
+
+// One argument
+echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --";
+var_dump( setlocale(LC_ALL) );
+
+echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n";
+//Invalid array of locales
+$invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid");
+var_dump( setlocale(LC_ALL,$invalid_locales) );
+
+echo "\n-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --\n";
+//Invalid array of locales
+var_dump( setlocale(LC_ALL,"en_US.invalid", "en_AU.invalid", "ko_KR.invalid") );
+
+echo "\n-- Testing setlocale() function with invalid category --\n";
+//invalid $category
+$invalid_category = "TEST";
+var_dump( setlocale($invalid_category,"en_US.utf8") );
+
+echo "\nDone";
+?>
+--EXPECTF--
+
+*** Testing setlocale() : error conditions ***
+
+-- Testing setlocale() function with Zero arguments --
+Warning: Wrong parameter count for setlocale() in %s on line %d
+NULL
+
+-- Testing setlocale() function with One argument, 'category' = LC_ALL --
+Warning: Wrong parameter count for setlocale() in %s on line %d
+NULL
+
+-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --
+bool(false)
+
+-- Testing setlocale() function with invalid multiple locales, 'category' = LC_ALL --
+bool(false)
+
+-- Testing setlocale() function with invalid category --
+
+Warning: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in %s on line %d
+
+Warning: setlocale(): Invalid locale category name TEST, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME in %s on line %d
+bool(false)
+
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation1.phpt b/ext/standard/tests/strings/setlocale_variation1.phpt
new file mode 100644
index 000000000..92cf43927
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation1.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Test setlocale() function : usage variations - passing multiple valid/invlaid locales as argument
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test the setlocale() when multiple valid/invalid locales are provided as argument */
+
+/* Prototype : array list_system_locales( void )
+ Description: To get the currently installed locle in this platform
+ Arguments : Nil
+ Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+/* Collect existing system locales and get 2 valid locales that can be use to
+ pass as argument to setlocale(), pass 2 invalid arguments along with two valid arguments*/
+echo "*** Testing setlocale() by passing multiple valid/invalid locales as argument ***\n";
+
+//set of currency symbol according to above list of locales
+$currency_symbol = array(
+ "en_US.utf8" => "USD",
+ "en_AU.utf8" => "AUD",
+ "ko_KR.utf8" => "KRW",
+ "zh_CN.utf8" => "CNY",
+ "de_DE.utf8" => "EUR",
+ "es_EC.utf8" => "USD",
+ "fr_FR.utf8" => "EUR",
+ "ja_JP.utf8" => "JPY",
+ "el_GR.utf8" => "EUR",
+ "nl_NL.utf8" =>"EUR"
+);
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+// Now check for three locales that is present in the system and use that as argument to setlocale()
+if( in_array("en_US.utf8",$all_system_locales) ||
+ in_array("Ko_KR.utf8",$all_system_locales) ||
+ in_array("zh_CN.utf8",$all_system_locales) ) {
+ echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) --\n";
+
+ // call setlocale()
+ $new_locale = setlocale(LC_ALL, "en_US.invalid", "en_US.utf8", "Ko_KR.utf8", "KO_KR.invalid", "zh_CN.utf8");
+
+ // dump the name of the new locale set by setlocale()
+ var_dump($new_locale);
+
+ // check that new locale setting is effective
+ // use localeconv() to get the details of currently set locale
+ $locale_info = localeconv();
+ $new_currency = trim($locale_info['int_curr_symbol']);
+
+ echo "Checking currency settings in the new locale, expected: ".$currency_symbol[$new_locale].", Found: ".$new_currency."\n";
+ echo "Test ";
+ if( trim($currency_symbol[$new_locale]) == $new_currency) {
+ echo "PASSED.\n";
+ } else {
+ echo "FAILED.\n";
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() by passing multiple valid/invalid locales as argument ***
+-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) --
+string(%d) "%s"
+Checking currency settings in the new locale, expected: %s, Found: %s
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt
new file mode 100644
index 000000000..98c405b70
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation2.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test setlocale() function : usage variations - Setting all available locales in the platform
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* setlocale() to set all available locales in the system and check the success count */
+echo "*** Testing setlocale() : usage variations ***\n";
+
+/* Prototype : array list_system_locales( void )
+ * Description: To get the currently installed locle in this platform
+ * Arguments : Nil
+ * Returns : set of locale as array
+*/
+function list_system_locales() {
+ // start the buffering of next command to internal output buffer
+ ob_start();
+
+ // run the command 'locale -a' to fetch all locales available in the system
+ system('locale -a');
+
+ // get the contents from the internal output buffer
+ $all_locales = ob_get_contents();
+
+ // fflush and end the output buffering to internal output buffer
+ ob_end_clean();
+
+ $system_locales = explode("\n", $all_locales);
+
+ // return all the locale found in the system
+ return $system_locales;
+}
+
+// gather all the locales installed in the system
+$all_system_locales = list_system_locales();
+
+//try different locale names
+$failure_locale = array();
+$success_count = 0;
+
+echo "-- Test setlocale() with all available locale in the system --\n";
+// gather all locales installed in the system(stored $all_system_locales),
+// try n set each locale using setlocale() and keep track failures, if any
+foreach($all_system_locales as $value){
+ //set locale to $value, if success, count increments
+ if(setlocale(LC_ALL,$value )){
+ $success_count++;
+ }
+ else{
+ //failure values are put in to an array $failure_locale
+ $failure_locale[] = $value;
+ }
+}
+
+echo "No of locales found on the machine = ".count($all_system_locales)."\n";
+echo "No of setlocale() success = ".$success_count."\n";
+echo "Expected no of failures = 0\n";
+echo "Test ";
+// check if there were any failure of setlocale() function earlier, if any
+// failure then dump the list of failing locales
+if($success_count != count($all_system_locales)){
+ echo "FAILED\n";
+ echo "Names of locale() for which setlocale() failed ...\n";
+ var_dump($failure_locale);
+}
+else{
+ echo "PASSED\n";
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations ***
+-- Test setlocale() with all available locale in the system --
+No of locales found on the machine = %d
+No of setlocale() success = %d
+Expected no of failures = 0
+Test PASSED
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation3.phpt b/ext/standard/tests/strings/setlocale_variation3.phpt
new file mode 100644
index 000000000..bfcdf3761
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation3.phpt
@@ -0,0 +1,156 @@
+--TEST--
+Test setlocale() function : usage variations - setting system locale = 0
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ * : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ * if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* If locale is "0", the locale setting is not affected, only the current setting is returned */
+
+echo "*** Testing setlocale() : usage variations - setting system locale = 0 ***\n";
+$locale_info_before = array();
+$locale_info_after = array();
+
+//initially giving the locale
+setlocale(LC_ALL,"en_US.utf8");
+
+echo "Locale info, before setting the locale\n";
+//returns current locale,before executing setlocale().
+$locale_info_before = localeconv();
+
+var_dump($locale_info_before);
+
+//Testing setlocale() by giving locale = 0
+echo "Setting system locale, category = LC_ALL and locale = 0\n";
+setlocale(LC_ALL, 0);
+
+echo "Locale info, after setting the locale\n";
+//returns current locale,after executing setlocale().
+$locale_info_after = localeconv();
+
+var_dump($locale_info_after);
+
+echo "Checking locale in the system, Expected : no change in the existing locale\n";
+echo "Test ";
+if($locale_info_before == $locale_info_after){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations - setting system locale = 0 ***
+Locale info, before setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Setting system locale, category = LC_ALL and locale = 0
+Locale info, after setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Checking locale in the system, Expected : no change in the existing locale
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation4.phpt b/ext/standard/tests/strings/setlocale_variation4.phpt
new file mode 100644
index 000000000..3968be102
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation4.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Test setlocale() function : usage variations - setting system locale as null
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--ENV--
+LC_ALL=en_US.utf8;
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ * : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ * if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/*If locale is NULL, the locale names will be set from the values of environment variables with the same names as the above ENV settings */
+
+echo "*** Testing setlocale() : usage variations - Setting system locale = null ***\n";
+
+//initially setting the locale
+setlocale(LC_ALL,"en_AU.utf8");
+
+echo "Locale info, before setting the locale\n";
+//returns current locale,before executing setlocale() .
+$locale_info_before = localeconv();
+var_dump($locale_info_before);
+
+//Testing setlocale() by giving locale = null
+echo "Setting system locale, category = LC_ALL and locale = null\n";
+setlocale(LC_ALL, null);
+
+echo "Locale info, after setting the locale\n";
+//Returns Current locale,after executing setlocale().
+$locale_info_after = localeconv();
+var_dump($locale_info_after);
+
+echo "Checking new locale in the system, Expected : the locale names will be set from the values of environment variables\n";
+echo "Test ";
+if($locale_info_before != $locale_info_after){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations - Setting system locale = null ***
+Locale info, before setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "AUD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Setting system locale, category = LC_ALL and locale = null
+Locale info, after setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Checking new locale in the system, Expected : the locale names will be set from the values of environment variables
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/setlocale_variation5.phpt b/ext/standard/tests/strings/setlocale_variation5.phpt
new file mode 100644
index 000000000..d2c3cf08a
--- /dev/null
+++ b/ext/standard/tests/strings/setlocale_variation5.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test setlocale() function : usage variations - Setting system locale as empty string
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Not valid for windows');
+}
+?>
+--ENV--
+LC_ALL=en_US.utf8;
+--FILE--
+<?php
+/* Prototype : string setlocale (int $category , string $locale [,string $..] )
+ * : string setlocale(int $category , array $locale);
+ * Description: Sets locale information.Returns the new current locale , or FALSE
+ * if locale functinality is not implemented in this platform.
+ * Source code: ext/standard/string.c
+*/
+
+/* If locale is empty string "", the locale names will be set from the values of environment variables with the same names as from ENV */
+
+echo "*** Testing setlocale() : usage variations - setting system locale = \"\" ***\n";
+
+//initially setting the locale
+setlocale(LC_ALL,'en_AU.utf8');
+
+echo "Locale info, before setting the locale\n";
+
+//returns current locale,before executing setlocale() .
+$locale_info_before = localeconv();
+
+var_dump($locale_info_before);
+
+//Testing setlocale() by giving locale = null
+echo "Setting system locale, category = LC_ALL and locale = \"\"\n";
+setlocale(LC_ALL, "");
+
+echo "Locale info, after setting the locale\n";
+
+//Returns Current locale,after executing setlocale().
+$locale_info_after = localeconv();
+
+var_dump($locale_info_after);
+
+echo "Checking new locale in the system, Expected : the locale names will be set from the values of environment variables\n";
+echo "Test ";
+if($locale_info_before != $locale_info_after){
+ echo "PASSED.";
+} else {
+ echo "FAILED.";
+}
+
+echo "\nDone\n";
+?>
+--EXPECTF--
+*** Testing setlocale() : usage variations - setting system locale = "" ***
+Locale info, before setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "AUD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Setting system locale, category = LC_ALL and locale = ""
+Locale info, after setting the locale
+array(18) {
+ ["decimal_point"]=>
+ string(1) "."
+ ["thousands_sep"]=>
+ string(1) ","
+ ["int_curr_symbol"]=>
+ string(4) "USD "
+ ["currency_symbol"]=>
+ string(1) "$"
+ ["mon_decimal_point"]=>
+ string(1) "."
+ ["mon_thousands_sep"]=>
+ string(1) ","
+ ["positive_sign"]=>
+ string(0) ""
+ ["negative_sign"]=>
+ string(1) "-"
+ ["int_frac_digits"]=>
+ int(2)
+ ["frac_digits"]=>
+ int(2)
+ ["p_cs_precedes"]=>
+ int(1)
+ ["p_sep_by_space"]=>
+ int(0)
+ ["n_cs_precedes"]=>
+ int(1)
+ ["n_sep_by_space"]=>
+ int(0)
+ ["p_sign_posn"]=>
+ int(1)
+ ["n_sign_posn"]=>
+ int(1)
+ ["grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+ ["mon_grouping"]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+Checking new locale in the system, Expected : the locale names will be set from the values of environment variables
+Test PASSED.
+Done
diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt
index ed8f47457..68a8a080c 100644
--- a/ext/standard/tests/strings/sha1.phpt
+++ b/ext/standard/tests/strings/sha1.phpt
@@ -44,8 +44,8 @@ bool(true)
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
bool(true)
-string(20) "%s"
-string(20) "%s"
+string(20) "%a"
+string(20) "%a"
Warning: sha1_file(%ssha1.dat): failed to open stream: No such file or directory in %s on line %d
Done
diff --git a/ext/standard/tests/strings/sprintf_basic1.phpt b/ext/standard/tests/strings/sprintf_basic1.phpt
new file mode 100644
index 000000000..b1c6194f0
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic1.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - string format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = "arg1 argument";
+$arg2 = "arg2 argument";
+$arg3 = "arg3 argument";
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using string format ***
+string(6) "format"
+string(13) "arg1 argument"
+string(27) "arg1 argument arg2 argument"
+string(41) "arg1 argument arg2 argument arg3 argument"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic2.phpt b/ext/standard/tests/strings/sprintf_basic2.phpt
new file mode 100644
index 000000000..94b177f5a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - integer format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using integer format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = 111;
+$arg2 = 222;
+$arg3 = 333;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using integer format ***
+string(6) "format"
+string(3) "111"
+string(7) "111 222"
+string(11) "111 222 333"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic3.phpt b/ext/standard/tests/strings/sprintf_basic3.phpt
new file mode 100644
index 000000000..52582abbe
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic3.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test sprintf() function : basic functionality - float format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : basic functionality - using float format ***\n";
+
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = 11.11;
+$arg2 = 22.22;
+$arg3 = 33.33;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+var_dump( sprintf($format11, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+var_dump( sprintf($format22, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using float format ***
+string(6) "format"
+string(9) "11.110000"
+string(9) "11.110000"
+string(19) "11.110000 22.220000"
+string(19) "11.110000 22.220000"
+string(29) "11.110000 22.220000 33.330000"
+string(29) "11.110000 22.220000 33.330000"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic4.phpt b/ext/standard/tests/strings/sprintf_basic4.phpt
new file mode 100644
index 000000000..ee0a4b565
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic4.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - bool format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using bool format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = TRUE;
+$arg2 = FALSE;
+$arg3 = true;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using bool format ***
+string(6) "format"
+string(1) "1"
+string(3) "1 0"
+string(5) "1 0 1"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic5.phpt b/ext/standard/tests/strings/sprintf_basic5.phpt
new file mode 100644
index 000000000..7f06cbe47
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic5.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test sprintf() function : basic functionality - char format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using char format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = 65;
+$arg2 = 66;
+$arg3 = 67;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using char format ***
+string(6) "format"
+string(1) "A"
+string(3) "A B"
+string(5) "A B C"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic6.phpt b/ext/standard/tests/strings/sprintf_basic6.phpt
new file mode 100644
index 000000000..c6d691cec
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic6.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test sprintf() function : basic functionality - exponential format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%E %e";
+$format3 = "%e %E %e";
+$arg1 = 1000;
+$arg2 = 2e3;
+$arg3 = +3e3;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using exponential format ***
+string(6) "format"
+string(11) "1.000000e+3"
+string(23) "1.000000E+3 2.000000e+3"
+string(35) "1.000000e+3 2.000000E+3 3.000000e+3"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic7.phpt b/ext/standard/tests/strings/sprintf_basic7.phpt
new file mode 100644
index 000000000..56bae8bd8
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic7.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test sprintf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n";
+
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = -1111;
+$arg2 = -1234567;
+$arg3 = +2345432;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using unsigned format ***
+string(6) "format"
+string(10) "4294966185"
+string(21) "4294966185 4293732729"
+string(29) "4294966185 4293732729 2345432"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic8.phpt b/ext/standard/tests/strings/sprintf_basic8.phpt
new file mode 100644
index 000000000..bb9ecd1a6
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic8.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test sprintf() function : basic functionality - octal format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = 021;
+$arg2 = -0347;
+$arg3 = 05678;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using octal format ***
+string(6) "format"
+string(2) "21"
+string(14) "21 37777777431"
+string(18) "21 37777777431 567"
+Done
diff --git a/ext/standard/tests/strings/sprintf_basic9.phpt b/ext/standard/tests/strings/sprintf_basic9.phpt
new file mode 100644
index 000000000..1e16bf810
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_basic9.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test sprintf() function : basic functionality - hexadecimal format
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialise all required variables
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = 11;
+$arg2 = 132;
+$arg3 = 177;
+
+// Calling sprintf() with default arguments
+var_dump( sprintf($format) );
+
+// Calling sprintf() with two arguments
+var_dump( sprintf($format1, $arg1) );
+var_dump( sprintf($format11, $arg1) );
+
+// Calling sprintf() with three arguments
+var_dump( sprintf($format2, $arg1, $arg2) );
+var_dump( sprintf($format22, $arg1, $arg2) );
+
+// Calling sprintf() with four arguments
+var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
+var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : basic functionality - using hexadecimal format ***
+string(6) "format"
+string(1) "b"
+string(1) "B"
+string(4) "b 84"
+string(4) "B 84"
+string(7) "b 84 b1"
+string(7) "B 84 B1"
+Done
diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt
new file mode 100644
index 000000000..1200ab27a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_error.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test sprintf() function : error conditions
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing sprintf() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing sprintf() function with Zero arguments --\n";
+var_dump( sprintf() );
+
+echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n";
+$format1 = '%s';
+$format2 = '%s%s';
+$format3 = '%s%s%s';
+$arg1 = 'one';
+$arg2 = 'two';
+
+// with one argument less than expected
+var_dump( sprintf($format1) );
+var_dump( sprintf($format2,$arg1) );
+var_dump( sprintf($format3,$arg1,$arg2) );
+
+// with two argument less than expected
+var_dump( sprintf($format2) );
+var_dump( sprintf($format3,$arg1) );
+
+// with three argument less than expected
+var_dump( sprintf($format3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : error conditions ***
+
+-- Testing sprintf() function with Zero arguments --
+
+Warning: Wrong parameter count for sprintf() in %s on line %d
+bool(false)
+
+-- Testing sprintf() function with less than expected no. of arguments --
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+
+Warning: sprintf(): Too few arguments in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt
new file mode 100644
index 000000000..a226bba7e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation1.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test sprintf() function : usage variations - unexpected values for format argument
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+* Testing sprintf() : with different unexpected values for format argument other than the strings
+*/
+
+echo "*** Testing sprintf() : with unexpected values for format argument ***\n";
+
+// initialing required variables
+$arg1 = "second arg";
+$arg2 = "third arg";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for format
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with default argument
+ var_dump( sprintf($value) );
+
+ // with two arguments
+ var_dump( sprintf($value, $arg1) );
+
+ // with three arguments
+ var_dump( sprintf($value, $arg1, $arg2) );
+
+ $count++;
+};
+
+// close the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with unexpected values for format argument ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "105000000000"
+string(12) "105000000000"
+string(12) "105000000000"
+
+-- Iteration 8 --
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+string(3) "0.5"
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 15 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 19 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 23 --
+string(6) "Object"
+string(6) "Object"
+string(6) "Object"
+
+-- Iteration 24 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 25 --
+string(0) ""
+string(0) ""
+string(0) ""
+
+-- Iteration 26 --
+string(%d) "Resource id #%d"
+string(%d) "Resource id #%d"
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation10.phpt b/ext/standard/tests/strings/sprintf_variation10.phpt
new file mode 100644
index 000000000..702dc34c7
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation10.phpt
@@ -0,0 +1,327 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with integer values ***\n";
+
+// array of int type values
+$integer_values = 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
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($integer_values as $int_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $int_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with integer values ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(9) "-1.000000"
+string(1) "f"
+string(9) "-1.000000"
+string(1) "f"
+string(10) " -1.000000"
+string(10) "-1.000000 "
+string(10) " -1.000000"
+string(10) "
+-1.000000"
+string(9) "-1.000000"
+string(30) " -1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(18) "-2147483647.000000"
+string(1) "f"
+string(18) "-2147483647.000000"
+string(1) "f"
+string(19) " -2147483647.000000"
+string(19) "-2147483647.000000 "
+string(19) " -2147483647.000000"
+string(19) "
+-2147483647.000000"
+string(18) "-2147483647.000000"
+string(30) " -2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(17) "2147483640.000000"
+string(1) "f"
+string(17) "2147483640.000000"
+string(1) "f"
+string(18) " 2147483640.000000"
+string(18) "2147483640.000000 "
+string(18) " 2147483640.000000"
+string(18) "
+2147483640.000000"
+string(17) "2147483640.000000"
+string(30) " 2147483640.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(11) "4667.000000"
+string(1) "f"
+string(11) "4667.000000"
+string(1) "f"
+string(12) " 4667.000000"
+string(12) "4667.000000 "
+string(12) " 4667.000000"
+string(12) "
+4667.000000"
+string(11) "4667.000000"
+string(30) " 4667.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(11) "4779.000000"
+string(1) "f"
+string(11) "4779.000000"
+string(1) "f"
+string(12) " 4779.000000"
+string(12) "4779.000000 "
+string(12) " 4779.000000"
+string(12) "
+4779.000000"
+string(11) "4779.000000"
+string(30) " 4779.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(11) "4095.000000"
+string(1) "f"
+string(11) "4095.000000"
+string(1) "f"
+string(12) " 4095.000000"
+string(12) "4095.000000 "
+string(12) " 4095.000000"
+string(12) "
+4095.000000"
+string(11) "4095.000000"
+string(30) " 4095.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(10) "250.000000"
+string(1) "f"
+string(10) "250.000000"
+string(1) "f"
+string(11) " 250.000000"
+string(11) "250.000000 "
+string(11) " 250.000000"
+string(11) "
+250.000000"
+string(10) "250.000000"
+string(30) " 250.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(9) "83.000000"
+string(1) "f"
+string(9) "83.000000"
+string(1) "f"
+string(10) " 83.000000"
+string(10) "83.000000 "
+string(10) " 83.000000"
+string(10) "
+83.000000"
+string(9) "83.000000"
+string(30) " 83.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(18) "-2147483648.000000"
+string(1) "f"
+string(18) "-2147483648.000000"
+string(1) "f"
+string(19) " -2147483648.000000"
+string(19) "-2147483648.000000 "
+string(19) " -2147483648.000000"
+string(19) "
+-2147483648.000000"
+string(18) "-2147483648.000000"
+string(30) " -2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(17) "2147483647.000000"
+string(1) "f"
+string(17) "2147483647.000000"
+string(1) "f"
+string(18) " 2147483647.000000"
+string(18) "2147483647.000000 "
+string(18) " 2147483647.000000"
+string(18) "
+2147483647.000000"
+string(17) "2147483647.000000"
+string(30) " 2147483647.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation11.phpt b/ext/standard/tests/strings/sprintf_variation11.phpt
new file mode 100644
index 000000000..d15928dd9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation11.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) " %d.000000"
+string(%d) "%d.000000 "
+string(%d) " %d.000000"
+string(%d) "
+%d.000000"
+string(%d) "%d.000000"
+string(%d) " %d.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) "%d.000000"
+string(1) "f"
+string(%d) " %d.000000"
+string(%d) "%d.000000 "
+string(%d) " %d.000000"
+string(%d) "
+%d.000000"
+string(%d) "%d.000000"
+string(%d) " %d.000000"
+string(4) "0-9]"
+string(1) "f"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation12.phpt b/ext/standard/tests/strings/sprintf_variation12.phpt
new file mode 100644
index 000000000..b1b186c44
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation12.phpt
@@ -0,0 +1,263 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with arrays
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with arrays ***\n";
+
+// array of array types
+$array_values = array (
+ 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("123.456abc"),
+ array('123.456abc'),
+ array(1 => "One", "two" => 2)
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with arrays ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation13.phpt b/ext/standard/tests/strings/sprintf_variation13.phpt
new file mode 100644
index 000000000..60ae89c61
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation13.phpt
@@ -0,0 +1,358 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with strings ***\n";
+
+// array of string type values
+$string_values = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+ "123.456abc",
+ "+123.456abc"
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with strings ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 19 --
+string(10) "123.456000"
+string(1) "f"
+string(10) "123.456000"
+string(1) "f"
+string(11) " 123.456000"
+string(11) "123.456000 "
+string(11) " 123.456000"
+string(11) "
+123.456000"
+string(10) "123.456000"
+string(30) " 123.456000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 20 --
+string(10) "123.456000"
+string(1) "f"
+string(10) "123.456000"
+string(1) "f"
+string(11) " 123.456000"
+string(11) "123.456000 "
+string(11) " 123.456000"
+string(11) "
+123.456000"
+string(10) "123.456000"
+string(30) " 123.456000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation14.phpt b/ext/standard/tests/strings/sprintf_variation14.phpt
new file mode 100644
index 000000000..40704d289
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation14.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with boolean values ***\n";
+
+// array of boolean type values
+$boolean_values = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with boolean values ***
+
+-- Iteration 1 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(8) "1.000000"
+string(1) "f"
+string(8) "1.000000"
+string(1) "f"
+string(9) " 1.000000"
+string(9) "1.000000 "
+string(9) " 1.000000"
+string(9) "
+1.000000"
+string(8) "1.000000"
+string(30) " 1.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation15.phpt b/ext/standard/tests/strings/sprintf_variation15.phpt
new file mode 100644
index 000000000..3769ae90d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation15.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation16.phpt b/ext/standard/tests/strings/sprintf_variation16.phpt
new file mode 100644
index 000000000..523eb5fb9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation16.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ -2147483649,
+ 2147483648,
+ -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
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with float values ***
+
+-- Iteration 1 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(10) "2147483648"
+string(1) "s"
+string(10) "2147483648"
+string(1) "s"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(11) "34359738369"
+string(1) "s"
+string(11) "34359738369"
+string(1) "s"
+string(12) " 34359738369"
+string(12) "34359738369 "
+string(12) " 34359738369"
+string(12) "
+34359738369"
+string(11) "34359738369"
+string(30) " 34359738369"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(10) "2147483649"
+string(1) "s"
+string(10) "2147483649"
+string(1) "s"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(11) "-2147483649"
+string(1) "s"
+string(11) "-2147483649"
+string(1) "s"
+string(12) " -2147483649"
+string(12) "-2147483649 "
+string(12) " -2147483649"
+string(12) "
+-2147483649"
+string(11) "-2147483649"
+string(30) " -2147483649"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(1) "0"
+string(1) "s"
+string(1) "0"
+string(1) "s"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(4) "-0.1"
+string(1) "s"
+string(4) "-0.1"
+string(1) "s"
+string(5) " -0.1"
+string(5) "-0.1 "
+string(5) " -0.1"
+string(5) "
+-0.1"
+string(4) "-0.1"
+string(30) " -0.1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(6) "100000"
+string(1) "s"
+string(6) "100000"
+string(1) "s"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(8) "-1000000"
+string(1) "s"
+string(8) "-1000000"
+string(1) "s"
+string(9) " -1000000"
+string(9) "-1000000 "
+string(9) " -1000000"
+string(9) "
+-1000000"
+string(8) "-1000000"
+string(30) " -1000000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(9) "100000000"
+string(1) "s"
+string(9) "100000000"
+string(1) "s"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 13 --
+string(11) "-1000000000"
+string(1) "s"
+string(11) "-1000000000"
+string(1) "s"
+string(12) " -1000000000"
+string(12) "-1000000000 "
+string(12) " -1000000000"
+string(12) "
+-1000000000"
+string(11) "-1000000000"
+string(30) " -1000000000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 14 --
+string(2) "10"
+string(1) "s"
+string(2) "10"
+string(1) "s"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 15 --
+string(7) "1050000"
+string(1) "s"
+string(7) "1050000"
+string(1) "s"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation17.phpt b/ext/standard/tests/strings/sprintf_variation17.phpt
new file mode 100644
index 000000000..08028f8fe
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation17.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource values
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) " Resource id #%d"
+string(%d) "Resource id #%d "
+string(%d) " Resource id #%d"
+string(%d) "
+Resource id #%d"
+string(%d) "Resource id #%d"
+string(%d) " Resource id #%d"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) "Resource id #%d"
+string(1) "s"
+string(%d) " Resource id #%d"
+string(%d) "Resource id #%d "
+string(%d) " Resource id #%d"
+string(%d) "
+Resource id #%d"
+string(%d) "Resource id #%d"
+string(%d) " Resource id #%d"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation18.phpt b/ext/standard/tests/strings/sprintf_variation18.phpt
new file mode 100644
index 000000000..b0013a4e9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation18.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with array values ***\n";
+
+// different arrays used to test he function
+$array_values = array(
+ 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)
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with array values ***
+
+-- Iteration 1 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(5) "Array"
+string(1) "s"
+string(5) "Array"
+string(1) "s"
+string(6) " Array"
+string(6) "Array "
+string(6) " Array"
+string(6) "
+Array"
+string(5) "Array"
+string(30) " Array"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation19.phpt b/ext/standard/tests/strings/sprintf_variation19.phpt
new file mode 100644
index 000000000..ae7b91057
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation19.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with integer values ***\n";
+
+// array of integer values
+$integer_values = 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
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "s"
+string(1) "0"
+string(1) "s"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(2) "-1"
+string(1) "s"
+string(2) "-1"
+string(1) "s"
+string(3) " -1"
+string(3) "-1 "
+string(3) " -1"
+string(3) "
+-1"
+string(4) " -1"
+string(30) " -1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 5 --
+string(11) "-2147483647"
+string(1) "s"
+string(11) "-2147483647"
+string(1) "s"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "s"
+string(10) "2147483640"
+string(1) "s"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "s"
+string(4) "4667"
+string(1) "s"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "s"
+string(4) "4779"
+string(1) "s"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "s"
+string(4) "4095"
+string(1) "s"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "s"
+string(3) "250"
+string(1) "s"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 12 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "s"
+string(2) "83"
+string(1) "s"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 17 --
+string(11) "-2147483648"
+string(1) "s"
+string(11) "-2147483648"
+string(1) "s"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "s"
+string(10) "2147483647"
+string(1) "s"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt
new file mode 100644
index 000000000..fcd3f2123
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation2.phpt
@@ -0,0 +1,219 @@
+--TEST--
+Test sprintf() function : usage variations - with all types of values for arg1 argument
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with different types of values passed for arg1 argument ***\n";
+
+// initialing required variables
+$format = '%s';
+$arg2 = 'third argument';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample
+{
+ public function __toString() {
+ return "Object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for arg1
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $count --\n";
+
+ // with two arguments
+ var_dump( sprintf($format, $value) );
+
+ // with three arguments
+ var_dump( sprintf($format, $value, $arg2) );
+
+ $count++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with different types of values passed for arg1 argument ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "105000000000"
+string(12) "105000000000"
+
+-- Iteration 8 --
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+
+-- Iteration 10 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 11 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 12 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 13 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 14 --
+string(5) "Array"
+string(5) "Array"
+
+-- Iteration 15 --
+string(0) ""
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+
+-- Iteration 19 --
+string(1) "1"
+string(1) "1"
+
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+
+-- Iteration 23 --
+string(6) "string"
+string(6) "string"
+
+-- Iteration 24 --
+string(6) "string"
+string(6) "string"
+
+-- Iteration 25 --
+string(6) "Object"
+string(6) "Object"
+
+-- Iteration 26 --
+string(0) ""
+string(0) ""
+
+-- Iteration 27 --
+string(0) ""
+string(0) ""
+
+-- Iteration 28 --
+string(%d) "Resource id #%d"
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation20.phpt b/ext/standard/tests/strings/sprintf_variation20.phpt
new file mode 100644
index 000000000..fc82fefa2
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation20.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - string formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : string formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of string formats
+$string_formats = array(
+ "%s", "%hs", "%ls",
+ "%Ls"," %s", "%s ",
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($string_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : string formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 2 --
+string(0) ""
+string(1) "s"
+string(0) ""
+string(1) "s"
+string(1) " "
+string(1) " "
+string(1) " "
+string(1) "
+"
+string(4) " "
+string(30) " "
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "s"
+string(1) "1"
+string(1) "s"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+
+-- Iteration 4 --
+string(0) ""
+string(1) "s"
+string(0) ""
+string(1) "s"
+string(1) " "
+string(1) " "
+string(1) " "
+string(1) "
+"
+string(4) " "
+string(30) " "
+string(10) "a-zA-Z0-9]"
+string(1) "s"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation21.phpt b/ext/standard/tests/strings/sprintf_variation21.phpt
new file mode 100644
index 000000000..afedfcaf7
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation21.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation22.phpt b/ext/standard/tests/strings/sprintf_variation22.phpt
new file mode 100644
index 000000000..868476525
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation22.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation23.phpt b/ext/standard/tests/strings/sprintf_variation23.phpt
new file mode 100644
index 000000000..bf88ba68c
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation23.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - char formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : char formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of char formats
+$char_formats = array(
+ "%c", "%hc", "%lc",
+ "%Lc", " %c", "%c ",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-bA-B@#$&]", "%*c"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($char_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : char formats with resource values ***
+
+-- Iteration 1 --
+string(1) ""
+string(1) "c"
+string(1) ""
+string(1) "c"
+string(2) " "
+string(2) " "
+string(2) " "
+string(2) "
+"
+string(1) ""
+string(1) ""
+string(11) "a-bA-B@#$&]"
+string(1) "c"
+
+-- Iteration 2 --
+string(1) ""
+string(1) "c"
+string(1) ""
+string(1) "c"
+string(2) " "
+string(2) " "
+string(2) " "
+string(2) "
+"
+string(1) ""
+string(1) ""
+string(11) "a-bA-B@#$&]"
+string(1) "c"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation24.phpt b/ext/standard/tests/strings/sprintf_variation24.phpt
new file mode 100644
index 000000000..6bb3e0e37
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation24.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation25.phpt b/ext/standard/tests/strings/sprintf_variation25.phpt
new file mode 100644
index 000000000..456344c3f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation25.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation26.phpt b/ext/standard/tests/strings/sprintf_variation26.phpt
new file mode 100644
index 000000000..b5881ea5e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation26.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation27.phpt b/ext/standard/tests/strings/sprintf_variation27.phpt
new file mode 100644
index 000000000..88602dbdb
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation27.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/sprintf_variation28.phpt b/ext/standard/tests/strings/sprintf_variation28.phpt
new file mode 100644
index 000000000..8fad68b0d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation28.phpt
@@ -0,0 +1,332 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with integer values ***\n";
+
+// array of integer values
+$integer_values = 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
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(11) "37777777777"
+string(1) "o"
+string(11) "37777777777"
+string(1) "o"
+string(12) " 37777777777"
+string(12) "37777777777 "
+string(12) " 37777777777"
+string(12) "
+37777777777"
+string(11) "37777777777"
+string(30) " 37777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(11) "20000000001"
+string(1) "o"
+string(11) "20000000001"
+string(1) "o"
+string(12) " 20000000001"
+string(12) "20000000001 "
+string(12) " 20000000001"
+string(12) "
+20000000001"
+string(11) "20000000001"
+string(30) " 20000000001"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "17777777770"
+string(1) "o"
+string(11) "17777777770"
+string(1) "o"
+string(12) " 17777777770"
+string(12) "17777777770 "
+string(12) " 17777777770"
+string(12) "
+17777777770"
+string(11) "17777777770"
+string(30) " 17777777770"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(5) "11073"
+string(1) "o"
+string(5) "11073"
+string(1) "o"
+string(6) " 11073"
+string(6) "11073 "
+string(6) " 11073"
+string(6) "
+11073"
+string(5) "11073"
+string(30) " 11073"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(5) "11253"
+string(1) "o"
+string(5) "11253"
+string(1) "o"
+string(6) " 11253"
+string(6) "11253 "
+string(6) " 11253"
+string(6) "
+11253"
+string(5) "11253"
+string(30) " 11253"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(4) "7777"
+string(1) "o"
+string(4) "7777"
+string(1) "o"
+string(5) " 7777"
+string(5) "7777 "
+string(5) " 7777"
+string(5) "
+7777"
+string(4) "7777"
+string(30) " 7777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(3) "372"
+string(1) "o"
+string(3) "372"
+string(1) "o"
+string(4) " 372"
+string(4) "372 "
+string(4) " 372"
+string(4) "
+372"
+string(4) " 372"
+string(30) " 372"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(3) "123"
+string(1) "o"
+string(3) "123"
+string(1) "o"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(11) "20000000000"
+string(1) "o"
+string(11) "20000000000"
+string(1) "o"
+string(12) " 20000000000"
+string(12) "20000000000 "
+string(12) " 20000000000"
+string(12) "
+20000000000"
+string(11) "20000000000"
+string(30) " 20000000000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(11) "17777777777"
+string(1) "o"
+string(11) "17777777777"
+string(1) "o"
+string(12) " 17777777777"
+string(12) "17777777777 "
+string(12) " 17777777777"
+string(12) "
+17777777777"
+string(11) "17777777777"
+string(30) " 17777777777"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation29.phpt b/ext/standard/tests/strings/sprintf_variation29.phpt
new file mode 100644
index 000000000..87ee835b7
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation29.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.5e+5
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with float values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(6) "303240"
+string(1) "o"
+string(6) "303240"
+string(1) "o"
+string(7) " 303240"
+string(7) "303240 "
+string(7) " 303240"
+string(7) "
+303240"
+string(6) "303240"
+string(30) " 303240"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(11) "37774136700"
+string(1) "o"
+string(11) "37774136700"
+string(1) "o"
+string(12) " 37774136700"
+string(12) "37774136700 "
+string(12) " 37774136700"
+string(12) "
+37774136700"
+string(11) "37774136700"
+string(30) " 37774136700"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(9) "575360400"
+string(1) "o"
+string(9) "575360400"
+string(1) "o"
+string(10) " 575360400"
+string(10) "575360400 "
+string(10) " 575360400"
+string(10) "
+575360400"
+string(9) "575360400"
+string(30) " 575360400"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(11) "30431233000"
+string(1) "o"
+string(11) "30431233000"
+string(1) "o"
+string(12) " 30431233000"
+string(12) "30431233000 "
+string(12) " 30431233000"
+string(12) "
+30431233000"
+string(11) "30431233000"
+string(30) " 30431233000"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(7) "4002620"
+string(1) "o"
+string(7) "4002620"
+string(1) "o"
+string(8) " 4002620"
+string(8) "4002620 "
+string(8) " 4002620"
+string(8) "
+4002620"
+string(7) "4002620"
+string(30) " 4002620"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation3.phpt b/ext/standard/tests/strings/sprintf_variation3.phpt
new file mode 100644
index 000000000..51a89ea08
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation3.phpt
@@ -0,0 +1,325 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with int values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with 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
+);
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($valid_ints as $int_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $int_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(2) "-1"
+string(1) "d"
+string(2) "-1"
+string(1) "d"
+string(3) " -1"
+string(3) "-1 "
+string(3) " -1"
+string(3) "
+-1"
+string(4) " -1"
+string(30) " -1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(11) "-2147483647"
+string(1) "d"
+string(11) "-2147483647"
+string(1) "d"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "d"
+string(10) "2147483640"
+string(1) "d"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "d"
+string(4) "4667"
+string(1) "d"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "d"
+string(4) "4779"
+string(1) "d"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "d"
+string(4) "4095"
+string(1) "d"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "d"
+string(3) "250"
+string(1) "d"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "d"
+string(2) "83"
+string(1) "d"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 17 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "d"
+string(10) "2147483647"
+string(1) "d"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation30.phpt b/ext/standard/tests/strings/sprintf_variation30.phpt
new file mode 100644
index 000000000..57c5abbd8
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation30.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "o"
+string(%d) "%d"
+string(1) "o"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "o"
+string(%d) "%d"
+string(1) "o"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-7]"
+string(1) "o"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation31.phpt b/ext/standard/tests/strings/sprintf_variation31.phpt
new file mode 100644
index 000000000..a081273a2
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation31.phpt
@@ -0,0 +1,246 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with array values ***\n";
+
+// different arrays used to test the function
+$array_values = array(
+ 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(0123),
+ array(1 => "One", "two" => 2)
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation32.phpt b/ext/standard/tests/strings/sprintf_variation32.phpt
new file mode 100644
index 000000000..6caf8ee6a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation32.phpt
@@ -0,0 +1,342 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "0123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 7 --
+string(3) "173"
+string(1) "o"
+string(3) "173"
+string(1) "o"
+string(4) " 173"
+string(4) "173 "
+string(4) " 173"
+string(4) "
+173"
+string(4) " 173"
+string(30) " 173"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 8 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation33.phpt b/ext/standard/tests/strings/sprintf_variation33.phpt
new file mode 100644
index 000000000..e903108f9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation33.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - octal formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : octal formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of octal formats
+$octal_formats = array(
+ "%o", "%ho", "%lo",
+ "%Lo", " %o", "%o ",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($octal_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : octal formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "o"
+string(1) "1"
+string(1) "o"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-7]"
+string(1) "o"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "o"
+string(1) "0"
+string(1) "o"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-7]"
+string(1) "o"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation34.phpt b/ext/standard/tests/strings/sprintf_variation34.phpt
new file mode 100644
index 000000000..c6186b678
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation34.phpt
@@ -0,0 +1,332 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with integer values ***\n";
+
+// array of integer values
+$integer_values = 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
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "ffffffff"
+string(9) "ffffffffx"
+string(8) "ffffffff"
+string(1) "x"
+string(9) " ffffffff"
+string(9) "ffffffff "
+string(9) " ffffffff"
+string(9) "
+ffffffff"
+string(8) "ffffffff"
+string(30) " ffffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(8) "7ffffff8"
+string(9) "7ffffff8x"
+string(8) "7ffffff8"
+string(1) "x"
+string(9) " 7ffffff8"
+string(9) "7ffffff8 "
+string(9) " 7ffffff8"
+string(9) "
+7ffffff8"
+string(8) "7ffffff8"
+string(30) " 7ffffff8"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(4) "123b"
+string(5) "123bx"
+string(4) "123b"
+string(1) "x"
+string(5) " 123b"
+string(5) "123b "
+string(5) " 123b"
+string(5) "
+123b"
+string(4) "123b"
+string(30) " 123b"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(4) "12ab"
+string(5) "12abx"
+string(4) "12ab"
+string(1) "x"
+string(5) " 12ab"
+string(5) "12ab "
+string(5) " 12ab"
+string(5) "
+12ab"
+string(4) "12ab"
+string(30) " 12ab"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(3) "fff"
+string(4) "fffx"
+string(3) "fff"
+string(1) "x"
+string(4) " fff"
+string(4) "fff "
+string(4) " fff"
+string(4) "
+fff"
+string(4) " fff"
+string(30) " fff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(2) "fa"
+string(3) "fax"
+string(2) "fa"
+string(1) "x"
+string(3) " fa"
+string(3) "fa "
+string(3) " fa"
+string(3) "
+fa"
+string(4) " fa"
+string(30) " fa"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(2) "53"
+string(3) "53x"
+string(2) "53"
+string(1) "x"
+string(3) " 53"
+string(3) "53 "
+string(3) " 53"
+string(3) "
+53"
+string(4) " 53"
+string(30) " 53"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(8) "80000000"
+string(9) "80000000x"
+string(8) "80000000"
+string(1) "x"
+string(9) " 80000000"
+string(9) "80000000 "
+string(9) " 80000000"
+string(9) "
+80000000"
+string(8) "80000000"
+string(30) " 80000000"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation35.phpt b/ext/standard/tests/strings/sprintf_variation35.phpt
new file mode 100644
index 000000000..ca6ba891d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation35.phpt
@@ -0,0 +1,237 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ // with two arguments
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with float values ***
+
+-- Iteration 1 --
+string(8) "7fffffff"
+string(9) "7fffffffx"
+string(8) "7fffffff"
+string(1) "x"
+string(9) " 7fffffff"
+string(9) "7fffffff "
+string(9) " 7fffffff"
+string(9) "
+7fffffff"
+string(8) "7fffffff"
+string(30) " 7fffffff"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(8) "80000001"
+string(9) "80000001x"
+string(8) "80000001"
+string(1) "x"
+string(9) " 80000001"
+string(9) "80000001 "
+string(9) " 80000001"
+string(9) "
+80000001"
+string(8) "80000001"
+string(30) " 80000001"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(5) "186a0"
+string(6) "186a0x"
+string(5) "186a0"
+string(1) "x"
+string(6) " 186a0"
+string(6) "186a0 "
+string(6) " 186a0"
+string(6) "
+186a0"
+string(5) "186a0"
+string(30) " 186a0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(8) "fff0bdc0"
+string(9) "fff0bdc0x"
+string(8) "fff0bdc0"
+string(1) "x"
+string(9) " fff0bdc0"
+string(9) "fff0bdc0 "
+string(9) " fff0bdc0"
+string(9) "
+fff0bdc0"
+string(8) "fff0bdc0"
+string(30) " fff0bdc0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(7) "5f5e100"
+string(8) "5f5e100x"
+string(7) "5f5e100"
+string(1) "x"
+string(8) " 5f5e100"
+string(8) "5f5e100 "
+string(8) " 5f5e100"
+string(8) "
+5f5e100"
+string(7) "5f5e100"
+string(30) " 5f5e100"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(8) "c4653600"
+string(9) "c4653600x"
+string(8) "c4653600"
+string(1) "x"
+string(9) " c4653600"
+string(9) "c4653600 "
+string(9) " c4653600"
+string(9) "
+c4653600"
+string(8) "c4653600"
+string(30) " c4653600"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "a"
+string(2) "ax"
+string(1) "a"
+string(1) "x"
+string(2) " a"
+string(2) "a "
+string(2) " a"
+string(2) "
+a"
+string(4) " a"
+string(30) " a"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(6) "100590"
+string(7) "100590x"
+string(6) "100590"
+string(1) "x"
+string(7) " 100590"
+string(7) "100590 "
+string(7) " 100590"
+string(7) "
+100590"
+string(6) "100590"
+string(30) " 100590"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation36.phpt b/ext/standard/tests/strings/sprintf_variation36.phpt
new file mode 100644
index 000000000..b7b16d7d9
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation36.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(%d) "%dx"
+string(%d) "%d"
+string(1) "x"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(%d) "%dx"
+string(%d) "%d"
+string(1) "x"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation37.phpt b/ext/standard/tests/strings/sprintf_variation37.phpt
new file mode 100644
index 000000000..d1ecbfc0d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation37.phpt
@@ -0,0 +1,230 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ 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)
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation38.phpt b/ext/standard/tests/strings/sprintf_variation38.phpt
new file mode 100644
index 000000000..f9b4a7f6a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation38.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 5 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 6 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 7 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 8 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 9 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 10 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 11 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 12 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 13 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 14 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 15 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 16 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 17 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 18 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation39.phpt b/ext/standard/tests/strings/sprintf_variation39.phpt
new file mode 100644
index 000000000..dac434617
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation39.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - hexa formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : hexa formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of hexa formats
+$hexa_formats = array(
+ "%x", "%xx", "%lx",
+ "%Lx", " %x", "%x ",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($hexa_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : hexa formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 2 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 3 --
+string(1) "1"
+string(2) "1x"
+string(1) "1"
+string(1) "x"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+
+-- Iteration 4 --
+string(1) "0"
+string(2) "0x"
+string(1) "0"
+string(1) "x"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(10) "0-9A-Fa-f]"
+string(1) "x"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation4.phpt b/ext/standard/tests/strings/sprintf_variation4.phpt
new file mode 100644
index 000000000..7fc66f910
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation4.phpt
@@ -0,0 +1,237 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with float values ***\n";
+
+// array of float type values
+
+$float_values = array (
+ 2147483648,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ 1e5,
+ -1e6,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with float values ***
+
+-- Iteration 1 --
+string(11) "-2147483648"
+string(1) "d"
+string(11) "-2147483648"
+string(1) "d"
+string(12) " -2147483648"
+string(12) "-2147483648 "
+string(12) " -2147483648"
+string(12) "
+-2147483648"
+string(11) "-2147483648"
+string(30) " -2147483648"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(11) "-2147483647"
+string(1) "d"
+string(11) "-2147483647"
+string(1) "d"
+string(12) " -2147483647"
+string(12) "-2147483647 "
+string(12) " -2147483647"
+string(12) "
+-2147483647"
+string(11) "-2147483647"
+string(30) " -2147483647"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "d"
+string(6) "100000"
+string(1) "d"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(8) "-1000000"
+string(1) "d"
+string(8) "-1000000"
+string(1) "d"
+string(9) " -1000000"
+string(9) "-1000000 "
+string(9) " -1000000"
+string(9) "
+-1000000"
+string(8) "-1000000"
+string(30) " -1000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(9) "100000000"
+string(1) "d"
+string(9) "100000000"
+string(1) "d"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(11) "-1000000000"
+string(1) "d"
+string(11) "-1000000000"
+string(1) "d"
+string(12) " -1000000000"
+string(12) "-1000000000 "
+string(12) " -1000000000"
+string(12) "
+-1000000000"
+string(11) "-1000000000"
+string(30) " -1000000000"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(2) "10"
+string(1) "d"
+string(2) "10"
+string(1) "d"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(7) "1050000"
+string(1) "d"
+string(7) "1050000"
+string(1) "d"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation40.phpt b/ext/standard/tests/strings/sprintf_variation40.phpt
new file mode 100644
index 000000000..0da6a10b8
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation40.phpt
@@ -0,0 +1,333 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with integer values ***\n";
+
+// array of integer values
+$integer_values = 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
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with integer values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "4294967295"
+string(1) "u"
+string(10) "4294967295"
+string(1) "u"
+string(11) " 4294967295"
+string(11) "4294967295 "
+string(11) " 4294967295"
+string(11) "
+4294967295"
+string(10) "4294967295"
+string(30) " 4294967295"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "2147483640"
+string(1) "u"
+string(10) "2147483640"
+string(1) "u"
+string(11) " 2147483640"
+string(11) "2147483640 "
+string(11) " 2147483640"
+string(11) "
+2147483640"
+string(10) "2147483640"
+string(30) " 2147483640"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(4) "4667"
+string(1) "u"
+string(4) "4667"
+string(1) "u"
+string(5) " 4667"
+string(5) "4667 "
+string(5) " 4667"
+string(5) "
+4667"
+string(4) "4667"
+string(30) " 4667"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(4) "4779"
+string(1) "u"
+string(4) "4779"
+string(1) "u"
+string(5) " 4779"
+string(5) "4779 "
+string(5) " 4779"
+string(5) "
+4779"
+string(4) "4779"
+string(30) " 4779"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(4) "4095"
+string(1) "u"
+string(4) "4095"
+string(1) "u"
+string(5) " 4095"
+string(5) "4095 "
+string(5) " 4095"
+string(5) "
+4095"
+string(4) "4095"
+string(30) " 4095"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(3) "250"
+string(1) "u"
+string(3) "250"
+string(1) "u"
+string(4) " 250"
+string(4) "250 "
+string(4) " 250"
+string(4) "
+250"
+string(4) " 250"
+string(30) " 250"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(2) "83"
+string(1) "u"
+string(2) "83"
+string(1) "u"
+string(3) " 83"
+string(3) "83 "
+string(3) " 83"
+string(3) "
+83"
+string(4) " 83"
+string(30) " 83"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(10) "2147483648"
+string(1) "u"
+string(10) "2147483648"
+string(1) "u"
+string(11) " 2147483648"
+string(11) "2147483648 "
+string(11) " 2147483648"
+string(11) "
+2147483648"
+string(10) "2147483648"
+string(30) " 2147483648"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation41.phpt b/ext/standard/tests/strings/sprintf_variation41.phpt
new file mode 100644
index 000000000..219ea0f02
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation41.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with float values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ 2147483647,
+ 0x800000001, // float value, beyond max positive int
+ 020000000001, // float value, beyond max positive int
+ 0.0,
+ -0.1,
+ 1.0,
+ +1e5,
+ +5e+5,
+ +0e-5,
+ -1e5,
+ -1e+5,
+ -1e-2,
+ 1e5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with float values ***
+
+-- Iteration 1 --
+string(10) "2147483647"
+string(1) "u"
+string(10) "2147483647"
+string(1) "u"
+string(11) " 2147483647"
+string(11) "2147483647 "
+string(11) " 2147483647"
+string(11) "
+2147483647"
+string(10) "2147483647"
+string(30) " 2147483647"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(10) "2147483649"
+string(1) "u"
+string(10) "2147483649"
+string(1) "u"
+string(11) " 2147483649"
+string(11) "2147483649 "
+string(11) " 2147483649"
+string(11) "
+2147483649"
+string(10) "2147483649"
+string(30) " 2147483649"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(6) "500000"
+string(1) "u"
+string(6) "500000"
+string(1) "u"
+string(7) " 500000"
+string(7) "500000 "
+string(7) " 500000"
+string(7) "
+500000"
+string(6) "500000"
+string(30) " 500000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(10) "4294867296"
+string(1) "u"
+string(10) "4294867296"
+string(1) "u"
+string(11) " 4294867296"
+string(11) "4294867296 "
+string(11) " 4294867296"
+string(11) "
+4294867296"
+string(10) "4294867296"
+string(30) " 4294867296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(10) "4294867296"
+string(1) "u"
+string(10) "4294867296"
+string(1) "u"
+string(11) " 4294867296"
+string(11) "4294867296 "
+string(11) " 4294867296"
+string(11) "
+4294867296"
+string(10) "4294867296"
+string(30) " 4294867296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(6) "100000"
+string(1) "u"
+string(6) "100000"
+string(1) "u"
+string(7) " 100000"
+string(7) "100000 "
+string(7) " 100000"
+string(7) "
+100000"
+string(6) "100000"
+string(30) " 100000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(9) "100000000"
+string(1) "u"
+string(9) "100000000"
+string(1) "u"
+string(10) " 100000000"
+string(10) "100000000 "
+string(10) " 100000000"
+string(10) "
+100000000"
+string(9) "100000000"
+string(30) " 100000000"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(10) "3294967296"
+string(1) "u"
+string(10) "3294967296"
+string(1) "u"
+string(11) " 3294967296"
+string(11) "3294967296 "
+string(11) " 3294967296"
+string(11) "
+3294967296"
+string(10) "3294967296"
+string(30) " 3294967296"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(2) "10"
+string(1) "u"
+string(2) "10"
+string(1) "u"
+string(3) " 10"
+string(3) "10 "
+string(3) " 10"
+string(3) "
+10"
+string(4) " 10"
+string(30) " 10"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(7) "1050000"
+string(1) "u"
+string(7) "1050000"
+string(1) "u"
+string(8) " 1050000"
+string(8) "1050000 "
+string(8) " 1050000"
+string(8) "
+1050000"
+string(7) "1050000"
+string(30) " 1050000"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation42.phpt b/ext/standard/tests/strings/sprintf_variation42.phpt
new file mode 100644
index 000000000..a1c01ff6b
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation42.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "u"
+string(%d) "%d"
+string(1) "u"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "u"
+string(%d) "%d"
+string(1) "u"
+string(%d) " %d"
+string(%d) "%d "
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation43.phpt b/ext/standard/tests/strings/sprintf_variation43.phpt
new file mode 100644
index 000000000..86527a52d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation43.phpt
@@ -0,0 +1,262 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(-12345),
+ array(+12345),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with array values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation44.phpt b/ext/standard/tests/strings/sprintf_variation44.phpt
new file mode 100644
index 000000000..fd4e0bc5a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation44.phpt
@@ -0,0 +1,365 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with string values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) {
+ die("skip this test is for 32bit platform only");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "-123",
+ "+123",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 7 --
+string(10) "4294967173"
+string(1) "u"
+string(10) "4294967173"
+string(1) "u"
+string(11) " 4294967173"
+string(11) "4294967173 "
+string(11) " 4294967173"
+string(11) "
+4294967173"
+string(10) "4294967173"
+string(30) " 4294967173"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 8 --
+string(3) "123"
+string(1) "u"
+string(3) "123"
+string(1) "u"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 9 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 20 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation45.phpt b/ext/standard/tests/strings/sprintf_variation45.phpt
new file mode 100644
index 000000000..e8219fc95
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation45.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - unsigned formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : unsigned formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of unsigned formats
+$unsigned_formats = array(
+ "%u", "%hu", "%lu",
+ "%Lu", " %u", "%u ",
+ "\t%u", "\n%u", "%4u",
+ "%30u", "%[0-9]", "%*u"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($unsigned_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : unsigned formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "u"
+string(1) "1"
+string(1) "u"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "u"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "u"
+string(1) "0"
+string(1) "u"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "u"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation46.phpt b/ext/standard/tests/strings/sprintf_variation46.phpt
new file mode 100644
index 000000000..36aef14dd
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation46.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with integer values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with integer values ***\n";
+
+// array of integer values
+$integer_values = 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
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($integer_values as $integer_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $integer_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with integer values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(12) "-1.000000e+0"
+string(1) "e"
+string(12) "-1.000000e+0"
+string(1) "e"
+string(13) " -1.000000e+0"
+string(13) "-1.000000e+0 "
+string(13) " -1.000000e+0"
+string(13) "
+-1.000000e+0"
+string(12) "-1.000000e+0"
+string(30) " -1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "4.667000e+3"
+string(1) "e"
+string(11) "4.667000e+3"
+string(1) "e"
+string(12) " 4.667000e+3"
+string(12) "4.667000e+3 "
+string(12) " 4.667000e+3"
+string(12) "
+4.667000e+3"
+string(11) "4.667000e+3"
+string(30) " 4.667000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "4.779000e+3"
+string(1) "e"
+string(11) "4.779000e+3"
+string(1) "e"
+string(12) " 4.779000e+3"
+string(12) "4.779000e+3 "
+string(12) " 4.779000e+3"
+string(12) "
+4.779000e+3"
+string(11) "4.779000e+3"
+string(30) " 4.779000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "4.095000e+3"
+string(1) "e"
+string(11) "4.095000e+3"
+string(1) "e"
+string(12) " 4.095000e+3"
+string(12) "4.095000e+3 "
+string(12) " 4.095000e+3"
+string(12) "
+4.095000e+3"
+string(11) "4.095000e+3"
+string(30) " 4.095000e+3"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "2.500000e+2"
+string(1) "e"
+string(11) "2.500000e+2"
+string(1) "e"
+string(12) " 2.500000e+2"
+string(12) "2.500000e+2 "
+string(12) " 2.500000e+2"
+string(12) "
+2.500000e+2"
+string(11) "2.500000e+2"
+string(30) " 2.500000e+2"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "8.300000e+1"
+string(1) "e"
+string(11) "8.300000e+1"
+string(1) "e"
+string(12) " 8.300000e+1"
+string(12) "8.300000e+1 "
+string(12) " 8.300000e+1"
+string(12) "
+8.300000e+1"
+string(11) "8.300000e+1"
+string(30) " 8.300000e+1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation47.phpt b/ext/standard/tests/strings/sprintf_variation47.phpt
new file mode 100644
index 000000000..4a100ef7d
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation47.phpt
@@ -0,0 +1,343 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with float values ***\n";
+
+// array of float values
+$float_values = array(
+ -2147483649,
+ 2147483648,
+ -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,
+ -1e5,
+ -1e5,
+ +1e5,
+ 1e+5,
+ -1e-5,
+ 1E8,
+ -1E9,
+ 10.0000000000000000005,
+ 10.5e+5
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with float values ***
+
+-- Iteration 1 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(12) "3.435974e+10"
+string(1) "e"
+string(12) "3.435974e+10"
+string(1) "e"
+string(13) " 3.435974e+10"
+string(13) "3.435974e+10 "
+string(13) " 3.435974e+10"
+string(13) "
+3.435974e+10"
+string(12) "3.435974e+10"
+string(30) " 3.435974e+10"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "2.147484e+9"
+string(1) "e"
+string(11) "2.147484e+9"
+string(1) "e"
+string(12) " 2.147484e+9"
+string(12) "2.147484e+9 "
+string(12) " 2.147484e+9"
+string(12) "
+2.147484e+9"
+string(11) "2.147484e+9"
+string(30) " 2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(12) "-2.147484e+9"
+string(1) "e"
+string(12) "-2.147484e+9"
+string(1) "e"
+string(13) " -2.147484e+9"
+string(13) "-2.147484e+9 "
+string(13) " -2.147484e+9"
+string(13) "
+-2.147484e+9"
+string(12) "-2.147484e+9"
+string(30) " -2.147484e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(12) "-1.000000e-1"
+string(1) "e"
+string(12) "-1.000000e-1"
+string(1) "e"
+string(13) " -1.000000e-1"
+string(13) "-1.000000e-1 "
+string(13) " -1.000000e-1"
+string(13) "
+-1.000000e-1"
+string(12) "-1.000000e-1"
+string(30) " -1.000000e-1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(12) "-1.000000e+5"
+string(1) "e"
+string(12) "-1.000000e+5"
+string(1) "e"
+string(13) " -1.000000e+5"
+string(13) "-1.000000e+5 "
+string(13) " -1.000000e+5"
+string(13) "
+-1.000000e+5"
+string(12) "-1.000000e+5"
+string(30) " -1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(12) "-1.000000e+5"
+string(1) "e"
+string(12) "-1.000000e+5"
+string(1) "e"
+string(13) " -1.000000e+5"
+string(13) "-1.000000e+5 "
+string(13) " -1.000000e+5"
+string(13) "
+-1.000000e+5"
+string(12) "-1.000000e+5"
+string(30) " -1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "1.000000e+5"
+string(1) "e"
+string(11) "1.000000e+5"
+string(1) "e"
+string(12) " 1.000000e+5"
+string(12) "1.000000e+5 "
+string(12) " 1.000000e+5"
+string(12) "
+1.000000e+5"
+string(11) "1.000000e+5"
+string(30) " 1.000000e+5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(12) "-1.000000e-5"
+string(1) "e"
+string(12) "-1.000000e-5"
+string(1) "e"
+string(13) " -1.000000e-5"
+string(13) "-1.000000e-5 "
+string(13) " -1.000000e-5"
+string(13) "
+-1.000000e-5"
+string(12) "-1.000000e-5"
+string(30) " -1.000000e-5"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "1.000000e+8"
+string(1) "e"
+string(11) "1.000000e+8"
+string(1) "e"
+string(12) " 1.000000e+8"
+string(12) "1.000000e+8 "
+string(12) " 1.000000e+8"
+string(12) "
+1.000000e+8"
+string(11) "1.000000e+8"
+string(30) " 1.000000e+8"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(12) "-1.000000e+9"
+string(1) "e"
+string(12) "-1.000000e+9"
+string(1) "e"
+string(13) " -1.000000e+9"
+string(13) "-1.000000e+9 "
+string(13) " -1.000000e+9"
+string(13) "
+-1.000000e+9"
+string(12) "-1.000000e+9"
+string(30) " -1.000000e+9"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "1.000000e+1"
+string(1) "e"
+string(11) "1.000000e+1"
+string(1) "e"
+string(12) " 1.000000e+1"
+string(12) "1.000000e+1 "
+string(12) " 1.000000e+1"
+string(12) "
+1.000000e+1"
+string(11) "1.000000e+1"
+string(30) " 1.000000e+1"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 19 --
+string(11) "1.050000e+6"
+string(1) "e"
+string(11) "1.050000e+6"
+string(1) "e"
+string(12) " 1.050000e+6"
+string(12) "1.050000e+6 "
+string(12) " 1.050000e+6"
+string(12) "
+1.050000e+6"
+string(11) "1.050000e+6"
+string(30) " 1.050000e+6"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation48.phpt b/ext/standard/tests/strings/sprintf_variation48.phpt
new file mode 100644
index 000000000..df28784eb
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation48.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_values = array (
+ $fp,
+ $dfp
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($resource_values as $resource_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $resource_value) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) " %d.000000e+0"
+string(%d) "%d.000000e+0 "
+string(%d) " %d.000000e+0"
+string(%d) "
+%d.000000e+0"
+string(%d) "%d.000000e+0"
+string(%d) " %d.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) "%d.000000e+0"
+string(1) "e"
+string(%d) " %d.000000e+0"
+string(%d) "%d.000000e+0 "
+string(%d) " %d.000000e+0"
+string(%d) "
+%d.000000e+0"
+string(%d) "%d.000000e+0"
+string(%d) " %d.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation49.phpt b/ext/standard/tests/strings/sprintf_variation49.phpt
new file mode 100644
index 000000000..554b43ac1
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation49.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with array values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with array values ***\n";
+
+// array of array values
+$array_values = array(
+ array(),
+ array(0),
+ array(1),
+ array(100000000000),
+ array(.0000001),
+ array(10e2),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($array_values as $array_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $array_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with array values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation5.phpt b/ext/standard/tests/strings/sprintf_variation5.phpt
new file mode 100644
index 000000000..b703d749f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation5.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with resource values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with resource values ***\n";
+
+// resource type variable
+$fp = fopen (__FILE__, "r");
+$dfp = opendir ( dirname(__FILE__) );
+
+// array of resource types
+$resource_types = array (
+ $fp,
+ $dfp
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%Ld", " %d",
+ "\t%d", "\n%d", "%4d",
+ "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($resource_types as $res) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $res) );
+ }
+ $count++;
+};
+
+// closing the resources
+fclose($fp);
+fclose($dfp);
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with resource values ***
+
+-- Iteration 1 --
+string(%d) "%d"
+string(1) "d"
+string(%d) " %d"
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(%d) "%d"
+string(1) "d"
+string(%d) " %d"
+string(%d) " %d"
+string(%d) "
+%d"
+string(%d) " %d"
+string(4) "0-9]"
+string(1) "d"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation50.phpt b/ext/standard/tests/strings/sprintf_variation50.phpt
new file mode 100644
index 000000000..62bae0e22
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation50.phpt
@@ -0,0 +1,343 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with string values ***\n";
+
+// array of string values
+$string_values = array(
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null',
+ "333333333333333333333333333333"
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with string values ***
+
+-- Iteration 1 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 5 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 6 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 7 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 8 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 9 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 10 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 11 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 12 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 13 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 14 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 15 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 16 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 17 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 18 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 19 --
+string(12) "3.333333e+29"
+string(1) "e"
+string(12) "3.333333e+29"
+string(1) "e"
+string(13) " 3.333333e+29"
+string(13) "3.333333e+29 "
+string(13) " 3.333333e+29"
+string(13) "
+3.333333e+29"
+string(12) "3.333333e+29"
+string(30) " 3.333333e+29"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation51.phpt b/ext/standard/tests/strings/sprintf_variation51.phpt
new file mode 100644
index 000000000..d988aa70e
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation51.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - scientific formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : scientific formats with boolean values ***\n";
+
+// array of boolean values
+$boolean_values = array(
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// array of scientific formats
+$scientific_formats = array(
+ "%e", "%he", "%le",
+ "%Le", " %e", "%e ",
+ "\t%e", "\n%e", "%4e",
+ "%30e", "%[0-1]", "%*e"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($scientific_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : scientific formats with boolean values ***
+
+-- Iteration 1 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 2 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 3 --
+string(11) "1.000000e+0"
+string(1) "e"
+string(11) "1.000000e+0"
+string(1) "e"
+string(12) " 1.000000e+0"
+string(12) "1.000000e+0 "
+string(12) " 1.000000e+0"
+string(12) "
+1.000000e+0"
+string(11) "1.000000e+0"
+string(30) " 1.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+
+-- Iteration 4 --
+string(11) "0.000000e+0"
+string(1) "e"
+string(11) "0.000000e+0"
+string(1) "e"
+string(12) " 0.000000e+0"
+string(12) "0.000000e+0 "
+string(12) " 0.000000e+0"
+string(12) "
+0.000000e+0"
+string(11) "0.000000e+0"
+string(30) " 0.000000e+0"
+string(4) "0-1]"
+string(1) "e"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation52.phpt b/ext/standard/tests/strings/sprintf_variation52.phpt
new file mode 100644
index 000000000..9ca598527
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation52.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test sprintf() function : usage variations - typical format strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with typical format strings ***\n";
+
+// initialising required variables
+$tempnum = 12345;
+$tempstring = "abcdefghjklmnpqrstuvwxyz";
+
+echo"\n-- Testing for '%%%.2f' as the format parameter --\n";
+var_dump(sprintf("%%%.2f", 1.23456789e10));
+
+echo"\n-- Testing for '%%' as the format parameter --\n";
+var_dump(sprintf("%%", 1.23456789e10));
+
+echo"\n-- Testing for precision value more than maximum --\n";
+var_dump(sprintf("%.988f", 1.23456789e10));
+
+echo"\n-- Testing for invalid width(-15) specifier --\n";
+var_dump(sprintf("%030.-15s", $tempstring));
+
+echo"\n-- Testing for '%X' as the format parameter --\n";
+var_dump(sprintf("%X", 12));
+
+echo"\n-- Testing for multiple format parameters --\n";
+var_dump(sprintf("%d %s %d\n", $tempnum, $tempstring, $tempnum));
+
+echo"\n-- Testing for excess of mixed type arguments --\n";
+var_dump(sprintf("%s", $tempstring, $tempstring, $tempstring));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with typical format strings ***
+
+-- Testing for '%%%.2f' as the format parameter --
+string(15) "%12345678900.00"
+
+-- Testing for '%%' as the format parameter --
+string(1) "%"
+
+-- Testing for precision value more than maximum --
+string(52) "12345678900.0000000000000000000000000000000000000000"
+
+-- Testing for invalid width(-15) specifier --
+string(3) "15s"
+
+-- Testing for '%X' as the format parameter --
+string(1) "C"
+
+-- Testing for multiple format parameters --
+string(39) "12345 abcdefghjklmnpqrstuvwxyz 12345
+"
+
+-- Testing for excess of mixed type arguments --
+string(24) "abcdefghjklmnpqrstuvwxyz"
+Done
diff --git a/ext/standard/tests/strings/sprintf_variation53.phpt b/ext/standard/tests/strings/sprintf_variation53.phpt
new file mode 100644
index 000000000..427d0d936
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation53.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test sprintf() function : usage variations - with whitespaces in format strings
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d", "% d", "% d",
+ "% f", "% f", "% f",
+ "% F", "% F", "% F",
+ "% b", "% b", "% b",
+ "% c", "% c", "% c",
+ "% e", "% e", "% e",
+ "% u", "% u", "% u",
+ "% o", "% o", "% o",
+ "% x", "% x", "% x",
+ "% X", "% X", "% X",
+ "% E", "% E", "% E"
+);
+
+// initializing the args array
+
+foreach($formats as $format) {
+ var_dump( sprintf($format, 1234) );
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : with white spaces in format strings ***
+string(4) "1234"
+string(4) "1234"
+string(4) "1234"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "1234.000000"
+string(11) "10011010010"
+string(11) "10011010010"
+string(11) "10011010010"
+string(1) "Ò"
+string(1) "Ò"
+string(1) "Ò"
+string(11) "1.234000e+3"
+string(11) "1.234000e+3"
+string(11) "1.234000e+3"
+string(4) "1234"
+string(4) "1234"
+string(4) "1234"
+string(4) "2322"
+string(4) "2322"
+string(4) "2322"
+string(3) "4d2"
+string(3) "4d2"
+string(3) "4d2"
+string(3) "4D2"
+string(3) "4D2"
+string(3) "4D2"
+string(11) "1.234000E+3"
+string(11) "1.234000E+3"
+string(11) "1.234000E+3"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation6.phpt b/ext/standard/tests/strings/sprintf_variation6.phpt
new file mode 100644
index 000000000..362c90d0a
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation6.phpt
@@ -0,0 +1,278 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with arrays
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with arrays ***\n";
+
+// different arrays used to test the function
+$array_types = array (
+ array(),
+ array(0),
+ array(1),
+ array(-123),
+ array("123"),
+ array("-123"),
+ array(NULL),
+ array(null),
+ array("string"),
+ array(true),
+ array(TRUE),
+ array(false),
+ array(FALSE),
+ array(1,2,3,4),
+ array(1 => "One", "two" => 2)
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($array_types as $arr) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $arr) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with arrays ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation7.phpt b/ext/standard/tests/strings/sprintf_variation7.phpt
new file mode 100644
index 000000000..30e9aa54f
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation7.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with boolean values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with boolean values ***\n";
+
+// array of boolean type values
+$boolean_values = array (
+ true,
+ false,
+ TRUE,
+ FALSE,
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($boolean_values as $boolean_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $boolean_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with boolean values ***
+
+-- Iteration 1 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation8.phpt b/ext/standard/tests/strings/sprintf_variation8.phpt
new file mode 100644
index 000000000..9bec93883
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation8.phpt
@@ -0,0 +1,374 @@
+--TEST--
+Test sprintf() function : usage variations - int formats with string values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : integer formats with string values ***\n";
+
+// array of strings used to test the function
+$string_values = array (
+ "",
+ '',
+ "0",
+ '0',
+ "1",
+ '1',
+ "-123abc",
+ "123abc",
+ "+123abc",
+ "\x01",
+ '\x01',
+ "\01",
+ '\01',
+ 'string',
+ "string",
+ "true",
+ "FALSE",
+ 'false',
+ 'TRUE',
+ "NULL",
+ 'null'
+);
+
+// various integer formats
+$int_formats = array(
+ "%d", "%hd", "%ld",
+ "%Ld", " %d", "%d ",
+ "\t%d", "\n%d", "%4d",
+ "%30d", "%[0-9]", "%*d"
+);
+
+$count = 1;
+foreach($string_values as $string_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($int_formats as $format) {
+ var_dump( sprintf($format, $string_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : integer formats with string values ***
+
+-- Iteration 1 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 2 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 3 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 4 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 5 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 6 --
+string(1) "1"
+string(1) "d"
+string(1) "1"
+string(1) "d"
+string(2) " 1"
+string(2) "1 "
+string(2) " 1"
+string(2) "
+1"
+string(4) " 1"
+string(30) " 1"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 7 --
+string(4) "-123"
+string(1) "d"
+string(4) "-123"
+string(1) "d"
+string(5) " -123"
+string(5) "-123 "
+string(5) " -123"
+string(5) "
+-123"
+string(4) "-123"
+string(30) " -123"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 8 --
+string(3) "123"
+string(1) "d"
+string(3) "123"
+string(1) "d"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 9 --
+string(3) "123"
+string(1) "d"
+string(3) "123"
+string(1) "d"
+string(4) " 123"
+string(4) "123 "
+string(4) " 123"
+string(4) "
+123"
+string(4) " 123"
+string(30) " 123"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 10 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 11 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 12 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 13 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 14 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 15 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 16 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 17 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 18 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 19 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 20 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+
+-- Iteration 21 --
+string(1) "0"
+string(1) "d"
+string(1) "0"
+string(1) "d"
+string(2) " 0"
+string(2) "0 "
+string(2) " 0"
+string(2) "
+0"
+string(4) " 0"
+string(30) " 0"
+string(4) "0-9]"
+string(1) "d"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/sprintf_variation9.phpt b/ext/standard/tests/strings/sprintf_variation9.phpt
new file mode 100644
index 000000000..6511d1ad6
--- /dev/null
+++ b/ext/standard/tests/strings/sprintf_variation9.phpt
@@ -0,0 +1,519 @@
+--TEST--
+Test sprintf() function : usage variations - float formats with float values
+--FILE--
+<?php
+/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing sprintf() : float formats with float values ***\n";
+
+// array of float type values
+
+$float_values = 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
+);
+
+// various float formats
+$float_formats = array(
+ "%f", "%hf", "%lf",
+ "%Lf", " %f", "%f ",
+ "\t%f", "\n%f", "%4f",
+ "%30f", "%[0-9]", "%*f",
+);
+
+$count = 1;
+foreach($float_values as $float_value) {
+ echo "\n-- Iteration $count --\n";
+
+ foreach($float_formats as $format) {
+ var_dump( sprintf($format, $float_value) );
+ }
+ $count++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing sprintf() : float formats with float values ***
+
+-- Iteration 1 --
+string(18) "-2147483649.000000"
+string(1) "f"
+string(18) "-2147483649.000000"
+string(1) "f"
+string(19) " -2147483649.000000"
+string(19) "-2147483649.000000 "
+string(19) " -2147483649.000000"
+string(19) "
+-2147483649.000000"
+string(18) "-2147483649.000000"
+string(30) " -2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 2 --
+string(17) "2147483648.000000"
+string(1) "f"
+string(17) "2147483648.000000"
+string(1) "f"
+string(18) " 2147483648.000000"
+string(18) "2147483648.000000 "
+string(18) " 2147483648.000000"
+string(18) "
+2147483648.000000"
+string(17) "2147483648.000000"
+string(30) " 2147483648.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 3 --
+string(18) "-2147483649.000000"
+string(1) "f"
+string(18) "-2147483649.000000"
+string(1) "f"
+string(19) " -2147483649.000000"
+string(19) "-2147483649.000000 "
+string(19) " -2147483649.000000"
+string(19) "
+-2147483649.000000"
+string(18) "-2147483649.000000"
+string(30) " -2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 4 --
+string(18) "34359738369.000000"
+string(1) "f"
+string(18) "34359738369.000000"
+string(1) "f"
+string(19) " 34359738369.000000"
+string(19) "34359738369.000000 "
+string(19) " 34359738369.000000"
+string(19) "
+34359738369.000000"
+string(18) "34359738369.000000"
+string(30) " 34359738369.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 5 --
+string(17) "2147483649.000000"
+string(1) "f"
+string(17) "2147483649.000000"
+string(1) "f"
+string(18) " 2147483649.000000"
+string(18) "2147483649.000000 "
+string(18) " 2147483649.000000"
+string(18) "
+2147483649.000000"
+string(17) "2147483649.000000"
+string(30) " 2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 6 --
+string(18) "-2147483649.000000"
+string(1) "f"
+string(18) "-2147483649.000000"
+string(1) "f"
+string(19) " -2147483649.000000"
+string(19) "-2147483649.000000 "
+string(19) " -2147483649.000000"
+string(19) "
+-2147483649.000000"
+string(18) "-2147483649.000000"
+string(30) " -2147483649.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 7 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 8 --
+string(9) "-0.100000"
+string(1) "f"
+string(9) "-0.100000"
+string(1) "f"
+string(10) " -0.100000"
+string(10) "-0.100000 "
+string(10) " -0.100000"
+string(10) "
+-0.100000"
+string(9) "-0.100000"
+string(30) " -0.100000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 9 --
+string(9) "10.000000"
+string(1) "f"
+string(9) "10.000000"
+string(1) "f"
+string(10) " 10.000000"
+string(10) "10.000000 "
+string(10) " 10.000000"
+string(10) "
+10.000000"
+string(9) "10.000000"
+string(30) " 10.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 10 --
+string(14) "1050000.000000"
+string(1) "f"
+string(14) "1050000.000000"
+string(1) "f"
+string(15) " 1050000.000000"
+string(15) "1050000.000000 "
+string(15) " 1050000.000000"
+string(15) "
+1050000.000000"
+string(14) "1050000.000000"
+string(30) " 1050000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 11 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 12 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 13 --
+string(8) "0.000010"
+string(1) "f"
+string(8) "0.000010"
+string(1) "f"
+string(9) " 0.000010"
+string(9) "0.000010 "
+string(9) " 0.000010"
+string(9) "
+0.000010"
+string(8) "0.000010"
+string(30) " 0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 14 --
+string(9) "-0.000010"
+string(1) "f"
+string(9) "-0.000010"
+string(1) "f"
+string(10) " -0.000010"
+string(10) "-0.000010 "
+string(10) " -0.000010"
+string(10) "
+-0.000010"
+string(9) "-0.000010"
+string(30) " -0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 15 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 16 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 17 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 18 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 19 --
+string(13) "100000.000000"
+string(1) "f"
+string(13) "100000.000000"
+string(1) "f"
+string(14) " 100000.000000"
+string(14) "100000.000000 "
+string(14) " 100000.000000"
+string(14) "
+100000.000000"
+string(13) "100000.000000"
+string(30) " 100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 20 --
+string(14) "-100000.000000"
+string(1) "f"
+string(14) "-100000.000000"
+string(1) "f"
+string(15) " -100000.000000"
+string(15) "-100000.000000 "
+string(15) " -100000.000000"
+string(15) "
+-100000.000000"
+string(14) "-100000.000000"
+string(30) " -100000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 21 --
+string(8) "0.000010"
+string(1) "f"
+string(8) "0.000010"
+string(1) "f"
+string(9) " 0.000010"
+string(9) "0.000010 "
+string(9) " 0.000010"
+string(9) "
+0.000010"
+string(8) "0.000010"
+string(30) " 0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 22 --
+string(9) "-0.000010"
+string(1) "f"
+string(9) "-0.000010"
+string(1) "f"
+string(10) " -0.000010"
+string(10) "-0.000010 "
+string(10) " -0.000010"
+string(10) "
+-0.000010"
+string(9) "-0.000010"
+string(30) " -0.000010"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 23 --
+string(14) "5000000.000000"
+string(1) "f"
+string(14) "5000000.000000"
+string(1) "f"
+string(15) " 5000000.000000"
+string(15) "5000000.000000 "
+string(15) " 5000000.000000"
+string(15) "
+5000000.000000"
+string(14) "5000000.000000"
+string(30) " 5000000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 24 --
+string(15) "-5000000.000000"
+string(1) "f"
+string(15) "-5000000.000000"
+string(1) "f"
+string(16) " -5000000.000000"
+string(16) "-5000000.000000 "
+string(16) " -5000000.000000"
+string(16) "
+-5000000.000000"
+string(15) "-5000000.000000"
+string(30) " -5000000.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 25 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 26 --
+string(9) "-0.000000"
+string(1) "f"
+string(9) "-0.000000"
+string(1) "f"
+string(10) " -0.000000"
+string(10) "-0.000000 "
+string(10) " -0.000000"
+string(10) "
+-0.000000"
+string(9) "-0.000000"
+string(30) " -0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 27 --
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(51) " 5000000000000000069686058479707049565356032.000000"
+string(51) "5000000000000000069686058479707049565356032.000000 "
+string(51) " 5000000000000000069686058479707049565356032.000000"
+string(51) "
+5000000000000000069686058479707049565356032.000000"
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(50) "5000000000000000069686058479707049565356032.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 28 --
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(1) "f"
+string(52) " -5000000000000000069686058479707049565356032.000000"
+string(52) "-5000000000000000069686058479707049565356032.000000 "
+string(52) " -5000000000000000069686058479707049565356032.000000"
+string(52) "
+-5000000000000000069686058479707049565356032.000000"
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(51) "-5000000000000000069686058479707049565356032.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 29 --
+string(8) "0.000000"
+string(1) "f"
+string(8) "0.000000"
+string(1) "f"
+string(9) " 0.000000"
+string(9) "0.000000 "
+string(9) " 0.000000"
+string(9) "
+0.000000"
+string(8) "0.000000"
+string(30) " 0.000000"
+string(4) "0-9]"
+string(1) "f"
+
+-- Iteration 30 --
+string(9) "-0.000000"
+string(1) "f"
+string(9) "-0.000000"
+string(1) "f"
+string(10) " -0.000000"
+string(10) "-0.000000 "
+string(10) " -0.000000"
+string(10) "
+-0.000000"
+string(9) "-0.000000"
+string(30) " -0.000000"
+string(4) "0-9]"
+string(1) "f"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index c9f1e56d0..5509d9d9e 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
index 858575d4c..49d0ab098 100644
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ b/ext/standard/tests/strings/str_repeat.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_split_basic.phpt b/ext/standard/tests/strings/str_split_basic.phpt
new file mode 100644
index 000000000..3a38b9d54
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_basic.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test str_split() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : basic functionality ***\n";
+
+// Initialise all required variables
+$str = 'This is basic testcase';
+$split_length = 5;
+
+// Calling str_split() with all possible arguments
+echo "-- With all possible arguments --\n";
+var_dump( str_split($str,$split_length) );
+
+// Calling str_split() with default arguments
+echo "-- With split_length as default argument --\n";
+var_dump( str_split($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : basic functionality ***
+-- With all possible arguments --
+array(5) {
+ [0]=>
+ string(5) "This "
+ [1]=>
+ string(5) "is ba"
+ [2]=>
+ string(5) "sic t"
+ [3]=>
+ string(5) "estca"
+ [4]=>
+ string(2) "se"
+}
+-- With split_length as default argument --
+array(22) {
+ [0]=>
+ string(1) "T"
+ [1]=>
+ string(1) "h"
+ [2]=>
+ string(1) "i"
+ [3]=>
+ string(1) "s"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) "i"
+ [6]=>
+ string(1) "s"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(1) "b"
+ [9]=>
+ string(1) "a"
+ [10]=>
+ string(1) "s"
+ [11]=>
+ string(1) "i"
+ [12]=>
+ string(1) "c"
+ [13]=>
+ string(1) " "
+ [14]=>
+ string(1) "t"
+ [15]=>
+ string(1) "e"
+ [16]=>
+ string(1) "s"
+ [17]=>
+ string(1) "t"
+ [18]=>
+ string(1) "c"
+ [19]=>
+ string(1) "a"
+ [20]=>
+ string(1) "s"
+ [21]=>
+ string(1) "e"
+}
+Done
diff --git a/ext/standard/tests/strings/str_split_error.phpt b/ext/standard/tests/strings/str_split_error.phpt
new file mode 100644
index 000000000..c7075ec0c
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_error.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test str_split() function : error conditions
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : error conditions ***\n";
+
+// Zero arguments
+echo "-- Testing str_split() function with Zero arguments --\n";
+var_dump( str_split() );
+
+//Test str_split with one more than the expected number of arguments
+echo "-- Testing str_split() function with more than expected no. of arguments --\n";
+$str = 'This is error testcase';
+$split_length = 4;
+$extra_arg = 10;
+var_dump( str_split( $str, $split_length, $extra_arg) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : error conditions ***
+-- Testing str_split() function with Zero arguments --
+
+Warning: str_split() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+-- Testing str_split() function with more than expected no. of arguments --
+
+Warning: str_split() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation1.phpt b/ext/standard/tests/strings/str_split_variation1.phpt
new file mode 100644
index 000000000..46406f56a
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation1.phpt
@@ -0,0 +1,241 @@
+--TEST--
+Test str_split() function : usage variations - unexpected values for 'str' argument
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : unexpected values for 'str' ***\n";
+
+// Initialise function arguments
+$split_length = 3;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'str' argument
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ $fp
+);
+
+// loop through each element of $values for 'str' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( str_split($values[$count], $split_length) );
+}
+
+//closing resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing str_split() : unexpected values for 'str' ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(1) "0"
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 3 --
+array(2) {
+ [0]=>
+ string(3) "123"
+ [1]=>
+ string(2) "45"
+}
+-- Iteration 4 --
+array(2) {
+ [0]=>
+ string(3) "-23"
+ [1]=>
+ string(2) "45"
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(3) "10."
+ [1]=>
+ string(1) "5"
+}
+-- Iteration 6 --
+array(2) {
+ [0]=>
+ string(3) "-10"
+ [1]=>
+ string(2) ".5"
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ string(3) "105"
+ [1]=>
+ string(3) "000"
+ [2]=>
+ string(3) "000"
+ [3]=>
+ string(3) "000"
+}
+-- Iteration 8 --
+array(3) {
+ [0]=>
+ string(3) "1.0"
+ [1]=>
+ string(3) "6E-"
+ [2]=>
+ string(1) "9"
+}
+-- Iteration 9 --
+array(1) {
+ [0]=>
+ string(3) "0.5"
+}
+-- Iteration 10 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: str_split() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 16 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 17 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 18 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 19 --
+array(1) {
+ [0]=>
+ string(1) "1"
+}
+-- Iteration 20 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 21 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 22 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 23 --
+array(2) {
+ [0]=>
+ string(3) "obj"
+ [1]=>
+ string(3) "ect"
+}
+-- Iteration 24 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 25 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 26 --
+
+Warning: str_split() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation2.phpt b/ext/standard/tests/strings/str_split_variation2.phpt
new file mode 100644
index 000000000..376ee3b6d
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation2.phpt
@@ -0,0 +1,290 @@
+--TEST--
+Test str_split() function : usage variations - unexpected values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : unexpected values for 'split_length' ***\n";
+
+// Initialise function arguments
+$str = 'variation2:split_length';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'split_length'
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.6E10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ $fp
+);
+
+// loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "--Iteration ".($count+1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+
+//closing resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing str_split() : unexpected values for 'split_length' ***
+--Iteration 1 --
+array(3) {
+ [0]=>
+ string(10) "variation2"
+ [1]=>
+ string(10) ":split_len"
+ [2]=>
+ string(3) "gth"
+}
+--Iteration 2 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 4 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 5 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 6 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 7 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 8 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 9 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 10 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 11 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 12 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 13 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 14 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 15 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 16 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 17 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 18 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 19 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 20 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 21 --
+
+Warning: str_split() expects parameter 2 to be long, object given in %s on line %d
+NULL
+--Iteration 22 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 23 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 24 --
+
+Warning: str_split() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation2_64bit.phpt b/ext/standard/tests/strings/str_split_variation2_64bit.phpt
new file mode 100644
index 000000000..7aeaf0f25
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation2_64bit.phpt
@@ -0,0 +1,291 @@
+--TEST--
+Test str_split() function : usage variations - unexpected values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing str_split() : unexpected values for 'split_length' ***\n";
+
+// Initialise function arguments
+$str = 'variation2:split_length';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//defining class for object variable
+class MyClass
+{
+ public function __toString()
+ {
+ return "object";
+ }
+}
+
+//resource variable
+$fp = fopen(__FILE__, 'r');
+
+//different values for 'split_length'
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.6E10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new MyClass(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ //resource data
+ $fp
+);
+
+// loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "--Iteration ".($count+1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+
+//closing resource
+fclose($fp);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing str_split() : unexpected values for 'split_length' ***
+--Iteration 1 --
+array(3) {
+ [0]=>
+ string(10) "variation2"
+ [1]=>
+ string(10) ":split_len"
+ [2]=>
+ string(3) "gth"
+}
+--Iteration 2 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 3 --
+array(1) {
+ [0]=>
+ string(23) "variation2:split_length"
+}
+--Iteration 4 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 5 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 6 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 7 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 8 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 9 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 10 --
+
+Warning: str_split() expects parameter 2 to be long, array given in %s on line %d
+NULL
+--Iteration 11 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 12 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 13 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 14 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 15 --
+array(23) {
+ [0]=>
+ string(1) "v"
+ [1]=>
+ string(1) "a"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "a"
+ [5]=>
+ string(1) "t"
+ [6]=>
+ string(1) "i"
+ [7]=>
+ string(1) "o"
+ [8]=>
+ string(1) "n"
+ [9]=>
+ string(1) "2"
+ [10]=>
+ string(1) ":"
+ [11]=>
+ string(1) "s"
+ [12]=>
+ string(1) "p"
+ [13]=>
+ string(1) "l"
+ [14]=>
+ string(1) "i"
+ [15]=>
+ string(1) "t"
+ [16]=>
+ string(1) "_"
+ [17]=>
+ string(1) "l"
+ [18]=>
+ string(1) "e"
+ [19]=>
+ string(1) "n"
+ [20]=>
+ string(1) "g"
+ [21]=>
+ string(1) "t"
+ [22]=>
+ string(1) "h"
+}
+--Iteration 16 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 17 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 18 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 19 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 20 --
+
+Warning: str_split() expects parameter 2 to be long, string given in %s on line %d
+NULL
+--Iteration 21 --
+
+Warning: str_split() expects parameter 2 to be long, object given in %s on line %d
+NULL
+--Iteration 22 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 23 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+--Iteration 24 --
+
+Warning: str_split() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/str_split_variation3.phpt b/ext/standard/tests/strings/str_split_variation3.phpt
new file mode 100644
index 000000000..1e7be76c3
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_split_variation4.phpt b/ext/standard/tests/strings/str_split_variation4.phpt
new file mode 100644
index 000000000..617e932a5
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation4.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test str_split() function : usage variations - different single quoted strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different single quoted strings as 'str' argument to str_split()
+* split_length is set to 5
+*/
+
+echo "*** Testing str_split() : single quoted strings for 'str' ***\n";
+
+//Initialize variables
+$split_length = 5;
+
+// different values for 'str'
+$values = array(
+ '', //empty
+ ' ', //space
+ '1234', //with only numbers
+ 'simple string', //regular string
+ 'It\'s string with quote', //string containing single quote
+ 'string\tcontains\rwhite space\nchars',
+ 'containing @ # $ % ^ & chars',
+ 'with 1234 numbers',
+ 'with \0 and ".chr(0)."null chars', //for binary safe
+ 'with multiple space char',
+ 'Testing invalid \k and \m escape char',
+ 'to check with \\n and \\t' //ignoring \n and \t results
+);
+
+//loop through each element of $values for 'str' argument
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count+1)." --\n";
+ var_dump( str_split($values[$count], $split_length) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : single quoted strings for 'str' ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(1) " "
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(4) "1234"
+}
+-- Iteration 4 --
+array(3) {
+ [0]=>
+ string(5) "simpl"
+ [1]=>
+ string(5) "e str"
+ [2]=>
+ string(3) "ing"
+}
+-- Iteration 5 --
+array(5) {
+ [0]=>
+ string(5) "It's "
+ [1]=>
+ string(5) "strin"
+ [2]=>
+ string(5) "g wit"
+ [3]=>
+ string(5) "h quo"
+ [4]=>
+ string(2) "te"
+}
+-- Iteration 6 --
+array(8) {
+ [0]=>
+ string(5) "strin"
+ [1]=>
+ string(5) "g\tco"
+ [2]=>
+ string(5) "ntain"
+ [3]=>
+ string(5) "s\rwh"
+ [4]=>
+ string(5) "ite s"
+ [5]=>
+ string(5) "pace\"
+ [6]=>
+ string(5) "nchar"
+ [7]=>
+ string(1) "s"
+}
+-- Iteration 7 --
+array(6) {
+ [0]=>
+ string(5) "conta"
+ [1]=>
+ string(5) "ining"
+ [2]=>
+ string(5) " @ # "
+ [3]=>
+ string(5) "$ % ^"
+ [4]=>
+ string(5) " & ch"
+ [5]=>
+ string(3) "ars"
+}
+-- Iteration 8 --
+array(4) {
+ [0]=>
+ string(5) "with "
+ [1]=>
+ string(5) "1234 "
+ [2]=>
+ string(5) "numbe"
+ [3]=>
+ string(2) "rs"
+}
+-- Iteration 9 --
+array(7) {
+ [0]=>
+ string(5) "with "
+ [1]=>
+ string(5) "\0 an"
+ [2]=>
+ string(5) "d ".c"
+ [3]=>
+ string(5) "hr(0)"
+ [4]=>
+ string(5) "."nul"
+ [5]=>
+ string(5) "l cha"
+ [6]=>
+ string(2) "rs"
+}
+-- Iteration 10 --
+array(7) {
+ [0]=>
+ string(5) "with "
+ [1]=>
+ string(5) " mu"
+ [2]=>
+ string(5) "ltipl"
+ [3]=>
+ string(5) "e "
+ [4]=>
+ string(5) " spac"
+ [5]=>
+ string(5) "e cha"
+ [6]=>
+ string(1) "r"
+}
+-- Iteration 11 --
+array(8) {
+ [0]=>
+ string(5) "Testi"
+ [1]=>
+ string(5) "ng in"
+ [2]=>
+ string(5) "valid"
+ [3]=>
+ string(5) " \k a"
+ [4]=>
+ string(5) "nd \m"
+ [5]=>
+ string(5) " esca"
+ [6]=>
+ string(5) "pe ch"
+ [7]=>
+ string(2) "ar"
+}
+-- Iteration 12 --
+array(5) {
+ [0]=>
+ string(5) "to ch"
+ [1]=>
+ string(5) "eck w"
+ [2]=>
+ string(5) "ith \"
+ [3]=>
+ string(5) "n and"
+ [4]=>
+ string(3) " \t"
+}
+Done
diff --git a/ext/standard/tests/strings/str_split_variation5.phpt b/ext/standard/tests/strings/str_split_variation5.phpt
new file mode 100644
index 000000000..4e4df4f6c
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation5.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test str_split() function : usage variations - different heredoc strings as 'str' argument
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length] )
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Passing different heredoc strings as 'str' argument to the str_split()
+* with 'split_length' 10
+*/
+
+echo "*** Testing str_split() : heredoc strings as 'str' argument ***\n";
+
+// Initializing required variables
+$split_length = 10;
+
+// Null heredoc string
+$heredoc_null = <<<EOT1
+EOT1;
+
+// heredoc string with single character
+$heredoc_char = <<<EOT2
+a
+EOT2;
+
+// simple heredoc string
+$heredoc_str = <<<EOT3
+This is simple heredoc string
+EOT3;
+
+// heredoc with special characters
+$heredoc_spchar = <<<EOT4
+This checks heredoc with $, %, &, chars
+EOT4;
+
+// blank heredoc string
+$heredoc_blank = <<<EOT5
+
+EOT5;
+
+// heredoc with different white space characters
+$heredoc_escchar = <<<EOT6
+This checks\t str_split()\nEscape\rchars
+EOT6;
+
+// heredoc with multiline
+$heredoc_multiline= <<<EOT7
+This is to check str_split
+function with multiline
+heredoc
+EOT7;
+
+// heredoc with quotes and slashes
+$heredoc_quote_slash = <<<EOT8
+"To check " in heredoc"
+I'm sure it'll work also with \
+which is single slash
+EOT8;
+
+//different heredoc strings for 'str'
+$heredoc_array = array(
+ $heredoc_null,
+ $heredoc_blank,
+ $heredoc_char,
+ $heredoc_str,
+ $heredoc_multiline,
+ $heredoc_spchar,
+ $heredoc_escchar,
+ $heredoc_quote_slash
+);
+
+
+// loop through each element of the 'heredoc_array' for 'str'
+$count = 0;
+foreach($heredoc_array as $str) {
+ echo "-- Iteration ".($count+1). " --\n";
+ var_dump( str_split($str, $split_length) );
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : heredoc strings as 'str' argument ***
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+-- Iteration 4 --
+array(3) {
+ [0]=>
+ string(10) "This is si"
+ [1]=>
+ string(10) "mple hered"
+ [2]=>
+ string(9) "oc string"
+}
+-- Iteration 5 --
+array(6) {
+ [0]=>
+ string(10) "This is to"
+ [1]=>
+ string(10) " check str"
+ [2]=>
+ string(10) "_split
+fun"
+ [3]=>
+ string(10) "ction with"
+ [4]=>
+ string(10) " multiline"
+ [5]=>
+ string(8) "
+heredoc"
+}
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(10) "This check"
+ [1]=>
+ string(10) "s heredoc "
+ [2]=>
+ string(10) "with $, %,"
+ [3]=>
+ string(9) " &, chars"
+}
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ string(10) "This check"
+ [1]=>
+ string(10) "s str_spl"
+ [2]=>
+ string(10) "it()
+Escap"
+ [3]=>
+ string(7) "e chars"
+}
+-- Iteration 8 --
+array(8) {
+ [0]=>
+ string(10) ""To check "
+ [1]=>
+ string(10) "" in hered"
+ [2]=>
+ string(10) "oc"
+I'm su"
+ [3]=>
+ string(10) "re it'll w"
+ [4]=>
+ string(10) "ork also w"
+ [5]=>
+ string(10) "ith \
+whic"
+ [6]=>
+ string(10) "h is singl"
+ [7]=>
+ string(7) "e slash"
+}
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt
new file mode 100644
index 000000000..6d751bbcc
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation6.phpt
@@ -0,0 +1,166 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+//Initialise variables
+$str = 'This is a string with 123 & escape char \t';
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(42) {
+ [0]=>
+ string(1) "T"
+ [1]=>
+ string(1) "h"
+ [2]=>
+ string(1) "i"
+ [3]=>
+ string(1) "s"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) "i"
+ [6]=>
+ string(1) "s"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(1) "a"
+ [9]=>
+ string(1) " "
+ [10]=>
+ string(1) "s"
+ [11]=>
+ string(1) "t"
+ [12]=>
+ string(1) "r"
+ [13]=>
+ string(1) "i"
+ [14]=>
+ string(1) "n"
+ [15]=>
+ string(1) "g"
+ [16]=>
+ string(1) " "
+ [17]=>
+ string(1) "w"
+ [18]=>
+ string(1) "i"
+ [19]=>
+ string(1) "t"
+ [20]=>
+ string(1) "h"
+ [21]=>
+ string(1) " "
+ [22]=>
+ string(1) "1"
+ [23]=>
+ string(1) "2"
+ [24]=>
+ string(1) "3"
+ [25]=>
+ string(1) " "
+ [26]=>
+ string(1) "&"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) "e"
+ [29]=>
+ string(1) "s"
+ [30]=>
+ string(1) "c"
+ [31]=>
+ string(1) "a"
+ [32]=>
+ string(1) "p"
+ [33]=>
+ string(1) "e"
+ [34]=>
+ string(1) " "
+ [35]=>
+ string(1) "c"
+ [36]=>
+ string(1) "h"
+ [37]=>
+ string(1) "a"
+ [38]=>
+ string(1) "r"
+ [39]=>
+ string(1) " "
+ [40]=>
+ string(1) "\"
+ [41]=>
+ string(1) "t"
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "This is a string with 123 "
+ [1]=>
+ string(16) "& escape char \t"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 7 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_split_variation6_64bit.phpt b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
new file mode 100644
index 000000000..39c3a85f0
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' argument
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+//Initialise variables
+$str = 'This is a string with 123 & escape char \t';
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(42) {
+ [0]=>
+ string(1) "T"
+ [1]=>
+ string(1) "h"
+ [2]=>
+ string(1) "i"
+ [3]=>
+ string(1) "s"
+ [4]=>
+ string(1) " "
+ [5]=>
+ string(1) "i"
+ [6]=>
+ string(1) "s"
+ [7]=>
+ string(1) " "
+ [8]=>
+ string(1) "a"
+ [9]=>
+ string(1) " "
+ [10]=>
+ string(1) "s"
+ [11]=>
+ string(1) "t"
+ [12]=>
+ string(1) "r"
+ [13]=>
+ string(1) "i"
+ [14]=>
+ string(1) "n"
+ [15]=>
+ string(1) "g"
+ [16]=>
+ string(1) " "
+ [17]=>
+ string(1) "w"
+ [18]=>
+ string(1) "i"
+ [19]=>
+ string(1) "t"
+ [20]=>
+ string(1) "h"
+ [21]=>
+ string(1) " "
+ [22]=>
+ string(1) "1"
+ [23]=>
+ string(1) "2"
+ [24]=>
+ string(1) "3"
+ [25]=>
+ string(1) " "
+ [26]=>
+ string(1) "&"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) "e"
+ [29]=>
+ string(1) "s"
+ [30]=>
+ string(1) "c"
+ [31]=>
+ string(1) "a"
+ [32]=>
+ string(1) "p"
+ [33]=>
+ string(1) "e"
+ [34]=>
+ string(1) " "
+ [35]=>
+ string(1) "c"
+ [36]=>
+ string(1) "h"
+ [37]=>
+ string(1) "a"
+ [38]=>
+ string(1) "r"
+ [39]=>
+ string(1) " "
+ [40]=>
+ string(1) "\"
+ [41]=>
+ string(1) "t"
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "This is a string with 123 "
+ [1]=>
+ string(16) "& escape char \t"
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(42) "This is a string with 123 & escape char \t"
+}
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt
new file mode 100644
index 000000000..455c5b897
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation7.phpt
@@ -0,0 +1,144 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' with heredoc 'str'
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+//Initialise variables
+$str = <<<EOT
+string with 123,escape char \t.
+EOT;
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(30) {
+ [0]=>
+ string(1) "s"
+ [1]=>
+ string(1) "t"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "n"
+ [5]=>
+ string(1) "g"
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "w"
+ [8]=>
+ string(1) "i"
+ [9]=>
+ string(1) "t"
+ [10]=>
+ string(1) "h"
+ [11]=>
+ string(1) " "
+ [12]=>
+ string(1) "1"
+ [13]=>
+ string(1) "2"
+ [14]=>
+ string(1) "3"
+ [15]=>
+ string(1) ","
+ [16]=>
+ string(1) "e"
+ [17]=>
+ string(1) "s"
+ [18]=>
+ string(1) "c"
+ [19]=>
+ string(1) "a"
+ [20]=>
+ string(1) "p"
+ [21]=>
+ string(1) "e"
+ [22]=>
+ string(1) " "
+ [23]=>
+ string(1) "c"
+ [24]=>
+ string(1) "h"
+ [25]=>
+ string(1) "a"
+ [26]=>
+ string(1) "r"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) " "
+ [29]=>
+ string(1) "."
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "string with 123,escape cha"
+ [1]=>
+ string(4) "r ."
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 7 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/str_split_variation7_64bit.phpt b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
new file mode 100644
index 000000000..1f324b242
--- /dev/null
+++ b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
@@ -0,0 +1,145 @@
+--TEST--
+Test str_split() function : usage variations - different integer values for 'split_length' with heredoc 'str'
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : array str_split(string $str [, int $split_length])
+ * Description: Convert a string to an array. If split_length is
+ specified, break the string down into chunks each
+ split_length characters long.
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
+*/
+
+echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+//Initialise variables
+$str = <<<EOT
+string with 123,escape char \t.
+EOT;
+
+//different values for 'split_length'
+$values = array (
+ 0,
+ 1,
+ -123, //negative integer
+ 0234, //octal number
+ 0x1A, //hexadecimal number
+ 2147483647, //max positive integer number
+ 2147483648, //max positive integer+1
+ -2147483648, //min negative integer
+);
+
+//loop through each element of $values for 'split_length'
+for($count = 0; $count < count($values); $count++) {
+ echo "-- Iteration ".($count + 1)." --\n";
+ var_dump( str_split($str, $values[$count]) );
+}
+echo "Done"
+?>
+--EXPECTF--
+*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+-- Iteration 1 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+array(30) {
+ [0]=>
+ string(1) "s"
+ [1]=>
+ string(1) "t"
+ [2]=>
+ string(1) "r"
+ [3]=>
+ string(1) "i"
+ [4]=>
+ string(1) "n"
+ [5]=>
+ string(1) "g"
+ [6]=>
+ string(1) " "
+ [7]=>
+ string(1) "w"
+ [8]=>
+ string(1) "i"
+ [9]=>
+ string(1) "t"
+ [10]=>
+ string(1) "h"
+ [11]=>
+ string(1) " "
+ [12]=>
+ string(1) "1"
+ [13]=>
+ string(1) "2"
+ [14]=>
+ string(1) "3"
+ [15]=>
+ string(1) ","
+ [16]=>
+ string(1) "e"
+ [17]=>
+ string(1) "s"
+ [18]=>
+ string(1) "c"
+ [19]=>
+ string(1) "a"
+ [20]=>
+ string(1) "p"
+ [21]=>
+ string(1) "e"
+ [22]=>
+ string(1) " "
+ [23]=>
+ string(1) "c"
+ [24]=>
+ string(1) "h"
+ [25]=>
+ string(1) "a"
+ [26]=>
+ string(1) "r"
+ [27]=>
+ string(1) " "
+ [28]=>
+ string(1) " "
+ [29]=>
+ string(1) "."
+}
+-- Iteration 3 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 5 --
+array(2) {
+ [0]=>
+ string(26) "string with 123,escape cha"
+ [1]=>
+ string(4) "r ."
+}
+-- Iteration 6 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 7 --
+array(1) {
+ [0]=>
+ string(30) "string with 123,escape char ."
+}
+-- Iteration 8 --
+
+Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strcspn_basic.phpt b/ext/standard/tests/strings/strcspn_basic.phpt
new file mode 100644
index 000000000..232b105f8
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test strcspn() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided, it works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : basic functionality
+*/
+
+echo "*** Testing strcspn() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = "this is the test string";
+$mask = "es";
+$start = 15;
+$len = 30;
+
+// Calling strcspn() with all possible arguments
+var_dump( strcspn($str, $mask, $start, $len) );
+
+// Calling strcspn() with three arguments
+var_dump( strcspn($str, $mask, $start) );
+
+// Calling strcspn() with default arguments
+var_dump( strcspn($str, $mask) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : basic functionality ***
+int(2)
+int(2)
+int(3)
+Done
diff --git a/ext/standard/tests/strings/strcspn_error.phpt b/ext/standard/tests/strings/strcspn_error.phpt
new file mode 100644
index 000000000..03b4f2d2c
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test strcspn() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Test strcspn() : for error conditons
+*/
+
+echo "*** Testing strcspn() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing strcspn() function with Zero arguments --\n";
+var_dump( strcspn() );
+
+//Test strcspn with one more than the expected number of arguments
+echo "\n-- Testing strcspn() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$mask = 'string_val';
+$start = 2;
+$len = 20;
+
+
+$extra_arg = 10;
+var_dump( strcspn($str,$mask,$start,$len, $extra_arg) );
+
+// Testing strcspn withone less than the expected number of arguments
+echo "\n-- Testing strcspn() function with less than expected no. of arguments --\n";
+$str = 'string_val';
+var_dump( strcspn($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : error conditions ***
+
+-- Testing strcspn() function with Zero arguments --
+
+Warning: strcspn() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing strcspn() function with more than expected no. of arguments --
+
+Warning: strcspn() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+
+-- Testing strcspn() function with less than expected no. of arguments --
+
+Warning: strcspn() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation1.phpt b/ext/standard/tests/strings/strcspn_variation1.phpt
new file mode 100644
index 000000000..f80e4615e
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation1.phpt
@@ -0,0 +1,276 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values for str argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+
+/*
+* Testing strspn() : with different unexpected values for str argument
+*/
+
+echo "*** Testing strcspn() : with unexpected values for str argument ***\n";
+
+// Initialise function arguments not being substititued (if any)
+$mask = 'abons1234567890';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample,
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\n-- Iteration with str value as \"$value\" \n";
+ var_dump( strcspn($value,$mask) ); // with default args
+ var_dump( strcspn($value,$mask,$start) ); // with default len value
+ var_dump( strcspn($value,$mask,$start,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with str value as "0"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "1"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "12345"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "-2345"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "10.5"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "-10.5"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "105000000000"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as "1.06E-9"
+int(0)
+int(1)
+int(1)
+
+-- Iteration with str value as "0.5"
+int(0)
+int(1)
+int(1)
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "object"
+int(0)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "Resource id #%d"
+
+Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation10.phpt b/ext/standard/tests/strings/strcspn_variation10.phpt
new file mode 100644
index 000000000..37bb00ec1
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation10.phpt
@@ -0,0 +1,272 @@
+--TEST--
+Test strcspn() function : usage variations - with varying mask & default start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with varying mask and default start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different mask strings and default start and len arguments ***\n";
+
+// initialing required variables
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xa"
+ );
+
+
+// loop through each element of the array for mask argument
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Itearation $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strcspn($str,$mask) );
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different mask strings and default start and len arguments ***
+
+-- Itearation 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Itearation 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Itearation 3 --
+int(1)
+int(1)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+
+-- Itearation 4 --
+int(2)
+int(2)
+int(0)
+int(0)
+int(2)
+int(0)
+int(0)
+int(0)
+int(2)
+int(0)
+
+-- Itearation 5 --
+int(24)
+int(24)
+int(2)
+int(2)
+int(5)
+int(24)
+int(24)
+int(5)
+int(5)
+int(5)
+
+-- Itearation 6 --
+int(28)
+int(28)
+int(2)
+int(2)
+int(28)
+int(5)
+int(5)
+int(5)
+int(28)
+int(5)
+
+-- Itearation 7 --
+int(20)
+int(20)
+int(6)
+int(6)
+int(16)
+int(20)
+int(20)
+int(16)
+int(16)
+int(16)
+
+-- Itearation 8 --
+int(21)
+int(21)
+int(6)
+int(6)
+int(21)
+int(16)
+int(16)
+int(16)
+int(21)
+int(16)
+
+-- Itearation 9 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(12)
+int(12)
+int(12)
+int(12)
+int(12)
+int(11)
+
+-- Itearation 10 --
+int(16)
+int(16)
+int(2)
+int(2)
+int(16)
+int(5)
+int(5)
+int(5)
+int(16)
+int(5)
+
+-- Itearation 11 --
+int(0)
+int(0)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+
+-- Itearation 12 --
+int(0)
+int(0)
+int(3)
+int(3)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+int(13)
+
+-- Itearation 13 --
+int(0)
+int(0)
+int(3)
+int(3)
+int(14)
+int(6)
+int(6)
+int(6)
+int(14)
+int(6)
+
+-- Itearation 14 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+
+-- Itearation 15 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+int(11)
+
+-- Itearation 16 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(14)
+int(14)
+int(14)
+int(14)
+int(14)
+int(6)
+
+-- Itearation 17 --
+int(21)
+int(21)
+int(2)
+int(2)
+int(21)
+int(5)
+int(5)
+int(5)
+int(21)
+int(5)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation11.phpt b/ext/standard/tests/strings/strcspn_variation11.phpt
new file mode 100644
index 000000000..28f1dbe45
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation11.phpt
@@ -0,0 +1,1306 @@
+--TEST--
+Test strcspn() function : usage variations - with varying start and default len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with varying start and default len arguments
+*/
+
+echo "*** Testing strcspn() : with different start and default len values ***\n";
+
+// initialing required variables
+// initialing required variables
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xa"
+ );
+
+//defining array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for str,mask and start arguments
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strcspn($str,$mask,$start) );
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different start and default len values ***
+
+-- Iteration 1 --
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 2 --
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 3 --
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 4 --
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 5 --
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(2)
+int(1)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+
+-- Iteration 6 --
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+int(28)
+int(27)
+int(26)
+int(1)
+int(2)
+bool(false)
+int(28)
+int(5)
+int(4)
+int(3)
+int(1)
+int(0)
+bool(false)
+int(5)
+
+-- Iteration 7 --
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(20)
+int(19)
+int(18)
+int(1)
+int(2)
+bool(false)
+int(20)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+
+-- Iteration 8 --
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+
+-- Iteration 9 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(12)
+int(11)
+int(10)
+int(1)
+int(2)
+bool(false)
+int(12)
+int(11)
+int(10)
+int(9)
+int(0)
+int(1)
+bool(false)
+int(11)
+
+-- Iteration 10 --
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(16)
+int(15)
+int(14)
+int(1)
+int(2)
+bool(false)
+int(16)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+
+-- Iteration 11 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+
+-- Iteration 12 --
+int(0)
+int(5)
+int(4)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(0)
+int(5)
+int(4)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+int(13)
+int(12)
+int(11)
+int(1)
+int(2)
+bool(false)
+int(13)
+
+-- Iteration 13 --
+int(0)
+int(12)
+int(11)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(0)
+int(12)
+int(11)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(3)
+int(2)
+int(1)
+int(1)
+int(2)
+bool(false)
+int(3)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+
+-- Iteration 14 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+
+-- Iteration 15 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+int(11)
+int(10)
+int(9)
+int(1)
+int(2)
+bool(false)
+int(11)
+
+-- Iteration 16 --
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(14)
+int(13)
+int(12)
+int(1)
+int(2)
+bool(false)
+int(14)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+
+-- Iteration 17 --
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(21)
+int(20)
+int(19)
+int(1)
+int(2)
+bool(false)
+int(21)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation12.phpt b/ext/standard/tests/strings/strcspn_variation12.phpt
new file mode 100644
index 000000000..b6f8cac08
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation12.phpt
@@ -0,0 +1,2482 @@
+--TEST--
+Test strcspn() function : usage variations - with varying start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with varying start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different start and len values ***\n";
+
+// initialing required variables
+// initialing required variables
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ "1234hello45world\t123",
+ "hello\0world\012",
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ "hello".chr(0)."world",
+ "hello\0\100\xaworld",
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ "\t",
+ "t\ ",
+ "\t\i\100\xa"
+ );
+
+//defining array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648 // min negative integer
+ );
+
+//defining array of len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648 // min negative integer
+ );
+
+
+// loop through each element of the arrays for str,mask,start and len arguments
+
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strcspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different start and len values ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 4 --
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 5 --
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 6 --
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(18)
+int(19)
+int(0)
+int(0)
+int(1)
+int(2)
+int(17)
+int(18)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(18)
+int(19)
+int(0)
+int(0)
+int(1)
+int(2)
+int(17)
+int(18)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(16)
+int(16)
+int(0)
+int(0)
+int(1)
+int(2)
+int(15)
+int(15)
+int(0)
+int(0)
+int(1)
+int(2)
+int(14)
+int(14)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(16)
+int(16)
+int(0)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(18)
+int(19)
+int(0)
+int(0)
+int(1)
+int(2)
+int(17)
+int(18)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(19)
+int(20)
+int(0)
+int(0)
+int(1)
+int(2)
+int(16)
+int(16)
+int(0)
+int(0)
+int(1)
+int(2)
+int(15)
+int(15)
+int(0)
+int(0)
+int(1)
+int(2)
+int(14)
+int(14)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(16)
+int(16)
+int(0)
+
+-- Iteration 7 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(9)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(11)
+int(11)
+int(0)
+
+-- Iteration 8 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+
+-- Iteration 9 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+
+-- Iteration 10 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(9)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(9)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(2)
+int(9)
+int(10)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(9)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+
+-- Iteration 11 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(11)
+int(12)
+int(0)
+int(0)
+int(1)
+int(2)
+int(10)
+int(11)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(12)
+int(13)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation2.phpt b/ext/standard/tests/strings/strcspn_variation2.phpt
new file mode 100644
index 000000000..df79e9afd
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation2.phpt
@@ -0,0 +1,274 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values for mask argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with different unexpected values for mask argument
+*/
+
+echo "*** Testing strcspn() : with diferent unexpected values of mask argument ***\n";
+
+$str = 'string_val';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for mask
+
+foreach($values as $value) {
+ echo "\n-- Iteration with mask value as \"$value\" -- \n";
+ var_dump( strcspn($str,$value) ); // with defalut args
+ var_dump( strcspn($str,$value,$start) ); // with default len value
+ var_dump( strcspn($str,$value,$start,$len) ); // with all args
+};
+
+// close the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with diferent unexpected values of mask argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with mask value as "0" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "12345" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "-2345" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "10.5" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "-10.5" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "105000000000" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1.06E-9" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "0.5" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "1" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "object" --
+int(1)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "" --
+int(10)
+int(9)
+int(9)
+
+-- Iteration with mask value as "Resource id #%d" --
+
+Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation3.phpt b/ext/standard/tests/strings/strcspn_variation3.phpt
new file mode 100644
index 000000000..869f46537
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation3.phpt
@@ -0,0 +1,245 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values of start argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with unexpected values of start argument
+*/
+
+echo "*** Testing strcspn() : with unexpected values of start argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$len = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with start value as \"$value\" --\n";
+ var_dump( strcspn($str,$mask,$value) ); // with default len value
+ var_dump( strcspn($str,$mask,$value,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with unexpected values of start argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with start value as "10.5" --
+int(0)
+int(0)
+
+-- Iteration with start value as "-10.5" --
+int(0)
+int(0)
+
+-- Iteration with start value as "105000000000" --
+bool(false)
+bool(false)
+
+-- Iteration with start value as "1.06E-9" --
+int(0)
+int(0)
+
+-- Iteration with start value as "0.5" --
+int(0)
+int(0)
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "1" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "1" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "string" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "string" --
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "object" --
+
+Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "" --
+int(0)
+int(0)
+
+-- Iteration with start value as "Resource id #%d" --
+
+Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+
+Warning: strcspn() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation4.phpt b/ext/standard/tests/strings/strcspn_variation4.phpt
new file mode 100644
index 000000000..6ea48219c
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation4.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test strcspn() function : usage variations - unexpected values of len argument
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with unexpected values of len argument
+*/
+
+echo "*** Testing strcspn() : with unexpected values of len argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$start = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with len value as \"$value\" --\n";
+ var_dump( strcspn($str,$mask,$start,$value) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with unexpected values of len argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with len value as "10.5" --
+int(0)
+
+-- Iteration with len value as "-10.5" --
+int(0)
+
+-- Iteration with len value as "105000000000" --
+int(0)
+
+-- Iteration with len value as "1.06E-9" --
+int(0)
+
+-- Iteration with len value as "0.5" --
+int(0)
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strcspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "1" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "1" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "string" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "string" --
+
+Warning: strcspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "object" --
+
+Warning: strcspn() expects parameter 4 to be long, object given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "Resource id #%d" --
+
+Warning: strcspn() expects parameter 4 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation5.phpt b/ext/standard/tests/strings/strcspn_variation5.phpt
new file mode 100644
index 000000000..a3dfa5177
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcspn_variation6.phpt b/ext/standard/tests/strings/strcspn_variation6.phpt
new file mode 100644
index 000000000..92fa3d095
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation6.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test strcspn() function : usage variations - with heredoc strings, varying mask & default start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [,int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with heredoc string, varying mask and default start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different mask strings ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xaa"
+ );
+
+
+// loop through each element of the arrays for string and mask arguments
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strcspn($str,$mask) ); // with default start and len value
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different mask strings ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+int(2)
+int(2)
+int(0)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+int(2)
+
+-- Iteration 3 --
+int(86)
+int(86)
+int(1)
+int(1)
+int(86)
+int(4)
+int(4)
+int(5)
+int(5)
+int(1)
+
+-- Iteration 4 --
+int(24)
+int(24)
+int(2)
+int(2)
+int(5)
+int(24)
+int(24)
+int(5)
+int(5)
+int(5)
+
+-- Iteration 5 --
+int(31)
+int(31)
+int(2)
+int(2)
+int(26)
+int(31)
+int(31)
+int(26)
+int(26)
+int(26)
+
+-- Iteration 6 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(25)
+int(25)
+int(25)
+int(25)
+int(25)
+int(25)
+
+-- Iteration 7 --
+int(5)
+int(5)
+int(2)
+int(2)
+int(27)
+int(27)
+int(27)
+int(27)
+int(27)
+int(6)
+Done
diff --git a/ext/standard/tests/strings/strcspn_variation7.phpt b/ext/standard/tests/strings/strcspn_variation7.phpt
new file mode 100644
index 000000000..ae01f91be
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation7.phpt
@@ -0,0 +1,612 @@
+--TEST--
+Test strcspn() function : usage variations - with heredoc strings, varying start and default len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [,int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with heredoc string, varying start and default len arguments
+*/
+
+echo "*** Testing strcspn() : with different start values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+
+// defining array of mask strings
+
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
+ "\t\i\100\xaa"
+ );
+
+// definig array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for str, mask and start arguments
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strcspn($str,$mask,$start) ); // with default len value
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different start values ***
+
+-- Iteration 1 --
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 2 --
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+
+-- Iteration 3 --
+int(86)
+int(85)
+int(84)
+int(1)
+int(2)
+bool(false)
+int(86)
+int(86)
+int(85)
+int(84)
+int(1)
+int(2)
+bool(false)
+int(86)
+int(1)
+int(0)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(86)
+int(85)
+int(84)
+int(1)
+int(2)
+bool(false)
+int(86)
+int(4)
+int(3)
+int(2)
+int(1)
+int(2)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(1)
+int(2)
+bool(false)
+int(4)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(1)
+int(0)
+int(5)
+int(1)
+int(2)
+bool(false)
+int(1)
+
+-- Iteration 4 --
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(2)
+int(1)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(24)
+int(23)
+int(22)
+int(1)
+int(2)
+bool(false)
+int(24)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(1)
+int(2)
+bool(false)
+int(5)
+
+-- Iteration 5 --
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(31)
+int(30)
+int(29)
+int(1)
+int(2)
+bool(false)
+int(31)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+int(26)
+int(25)
+int(24)
+int(1)
+int(2)
+bool(false)
+int(26)
+
+-- Iteration 6 --
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+int(25)
+int(24)
+int(23)
+int(1)
+int(2)
+bool(false)
+int(25)
+
+-- Iteration 7 --
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(5)
+int(4)
+int(3)
+int(0)
+int(1)
+bool(false)
+int(5)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(27)
+int(26)
+int(25)
+int(1)
+int(2)
+bool(false)
+int(27)
+int(6)
+int(5)
+int(4)
+int(1)
+int(2)
+bool(false)
+int(6)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation8.phpt b/ext/standard/tests/strings/strcspn_variation8.phpt
new file mode 100644
index 000000000..6b662ecde
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation8.phpt
@@ -0,0 +1,1892 @@
+--TEST--
+Test strcspn() function : usage variations - with heredoc strings, varying start and len args
+--FILE--
+<?php
+/* Prototype : proto int strcspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters not found in mask.
+ If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strcspn() : with heredoc string, varying start and len arguments
+*/
+
+echo "*** Testing strcspn() : with different start and len values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "\n\trsti \l",
+ "\t",
+ "t\ ",
+ " \t",
+ "\t\i\100\xaa"
+ );
+
+// definig array of start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+// defining array of len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for all arguments
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strcspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strcspn() : with different start and len values ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(84)
+int(85)
+int(0)
+int(0)
+int(1)
+int(2)
+int(83)
+int(84)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(84)
+int(85)
+int(0)
+int(0)
+int(1)
+int(2)
+int(83)
+int(84)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(84)
+int(85)
+int(0)
+int(0)
+int(1)
+int(2)
+int(83)
+int(84)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(85)
+int(86)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+
+-- Iteration 4 --
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(2)
+int(21)
+int(22)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 5 --
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(29)
+int(30)
+int(0)
+int(0)
+int(1)
+int(2)
+int(28)
+int(29)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(29)
+int(30)
+int(0)
+int(0)
+int(1)
+int(2)
+int(28)
+int(29)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(24)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(29)
+int(30)
+int(0)
+int(0)
+int(1)
+int(2)
+int(28)
+int(29)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(30)
+int(31)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(24)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(24)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(26)
+int(26)
+int(0)
+
+-- Iteration 6 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(2)
+int(23)
+int(24)
+int(0)
+int(0)
+int(1)
+int(2)
+int(22)
+int(23)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+
+-- Iteration 7 --
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(25)
+int(26)
+int(0)
+int(0)
+int(1)
+int(2)
+int(24)
+int(25)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(26)
+int(27)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(1)
+int(2)
+int(5)
+int(5)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strcspn_variation9.phpt b/ext/standard/tests/strings/strcspn_variation9.phpt
new file mode 100644
index 000000000..e7650844d
--- /dev/null
+++ b/ext/standard/tests/strings/strcspn_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strip_tags_basic1.phpt b/ext/standard/tests/strings/strip_tags_basic1.phpt
new file mode 100644
index 000000000..f151b7791
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_basic1.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test strip_tags() function : basic functionality - with default arguments
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strip_tags() : basic functionality ***\n";
+
+// array of arguments
+$string_array = array (
+ "<html>hello</html>",
+ '<html>hello</html>',
+ "<?php echo hello ?>",
+ '<?php echo hello ?>',
+ "<? echo hello ?>",
+ '<? echo hello ?>',
+ "<% echo hello %>",
+ '<% echo hello %>',
+ "<script language=\"PHP\"> echo hello </script>",
+ '<script language=\"PHP\"> echo hello </script>',
+ "<html><b>hello</b><p>world</p></html>",
+ '<html><b>hello</b><p>world</p></html>',
+ "<html><!-- COMMENT --></html>",
+ '<html><!-- COMMENT --></html>'
+);
+
+
+// Calling strip_tags() with default arguments
+// loop through the $string_array to test strip_tags on various inputs
+$iteration = 1;
+foreach($string_array as $string)
+{
+ echo "-- Iteration $iteration --\n";
+ var_dump( strip_tags($string) );
+ $iteration++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : basic functionality ***
+-- Iteration 1 --
+string(5) "hello"
+-- Iteration 2 --
+string(5) "hello"
+-- Iteration 3 --
+string(0) ""
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(0) ""
+-- Iteration 6 --
+string(0) ""
+-- Iteration 7 --
+string(0) ""
+-- Iteration 8 --
+string(0) ""
+-- Iteration 9 --
+string(12) " echo hello "
+-- Iteration 10 --
+string(12) " echo hello "
+-- Iteration 11 --
+string(10) "helloworld"
+-- Iteration 12 --
+string(10) "helloworld"
+-- Iteration 13 --
+string(0) ""
+-- Iteration 14 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/strip_tags_basic2.phpt b/ext/standard/tests/strings/strip_tags_basic2.phpt
new file mode 100644
index 000000000..0ca5f6df3
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_basic2.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test strip_tags() function : basic functionality - with all arguments
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strip_tags() : basic functionality ***\n";
+
+// Calling strip_tags() with all possible arguments
+$string = "<html><p>hello</p><b>world</b><a href=\"#fragment\">Other text</a></html><?php echo hello ?>";
+
+$allowed_tags_array=array(
+ "<html>",
+ '<html>',
+ "<p>",
+ '<p>',
+ "<a>",
+ '<a>',
+ "<?php",
+ '<?php',
+ "<html><p><a><?php"
+);
+
+// loop through the $string with various $allowed_tags_array to test strip_tags
+// on various allowed tags
+$iteration = 1;
+foreach($allowed_tags_array as $tags)
+{
+ echo "-- Iteration $iteration --\n";
+ var_dump( strip_tags($string, $tags) );
+ $iteration++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : basic functionality ***
+-- Iteration 1 --
+string(33) "<html>helloworldOther text</html>"
+-- Iteration 2 --
+string(33) "<html>helloworldOther text</html>"
+-- Iteration 3 --
+string(27) "<p>hello</p>worldOther text"
+-- Iteration 4 --
+string(27) "<p>hello</p>worldOther text"
+-- Iteration 5 --
+string(44) "helloworld<a href="#fragment">Other text</a>"
+-- Iteration 6 --
+string(44) "helloworld<a href="#fragment">Other text</a>"
+-- Iteration 7 --
+string(20) "helloworldOther text"
+-- Iteration 8 --
+string(20) "helloworldOther text"
+-- Iteration 9 --
+string(64) "<html><p>hello</p>world<a href="#fragment">Other text</a></html>"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_error.phpt b/ext/standard/tests/strings/strip_tags_error.phpt
new file mode 100644
index 000000000..fcd3963fe
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test strip_tags() function : error conditions
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+
+echo "*** Testing strip_tags() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing strip_tags() function with Zero arguments --\n";
+var_dump( strip_tags() );
+
+//Test strip_tags with one more than the expected number of arguments
+echo "\n-- Testing strip_tags() function with more than expected no. of arguments --\n";
+$str = "<html>hello</html>";
+$allowable_tags = "<html>";
+$extra_arg = 10;
+var_dump( strip_tags($str, $allowable_tags, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : error conditions ***
+
+-- Testing strip_tags() function with Zero arguments --
+
+Warning: Wrong parameter count for strip_tags() in %s on line %d
+NULL
+
+-- Testing strip_tags() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for strip_tags() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation1.phpt b/ext/standard/tests/strings/strip_tags_variation1.phpt
new file mode 100644
index 000000000..b312fb24e
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation1.phpt
@@ -0,0 +1,157 @@
+--TEST--
+Test strip_tags() function : usage variations - unexpected values for 'str' argument
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving unexpected input values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+ $fp
+
+);
+
+// loop through each element of the array for allowable_tags
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(5) "-10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(1) "1"
+-- Iteration 20 --
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+-- Iteration 23 --
+string(14) "Class A object"
+-- Iteration 24 --
+string(0) ""
+-- Iteration 25 --
+string(0) ""
+-- Iteration 26 --
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation10.phpt b/ext/standard/tests/strings/strip_tags_variation10.phpt
new file mode 100644
index 000000000..a9c3f6466
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation10.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strip_tags() function : usage variations - single quoted strings
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving single quoted strings as values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+
+$single_quote_string = array (
+ '<html> \$ -> This represents the dollar sign</html><?php echo hello ?>',
+ '<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>',
+ '<a>This is a hyper text tag</a>',
+ '<? <html>hello world\\t</html>?>',
+ '<p>This is a paragraph</p>',
+ '<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>'
+);
+
+$quotes = "<html><a><p><b><?php";
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($single_quote_string as $string_value)
+{
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($string_value, $quotes) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(51) "<html> \$ -> This represents the dollar sign</html>"
+-- Iteration 2 --
+string(63) "<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>"
+-- Iteration 3 --
+string(31) "<a>This is a hyper text tag</a>"
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(26) "<p>This is a paragraph</p>"
+-- Iteration 6 --
+string(65) "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation2.phpt b/ext/standard/tests/strings/strip_tags_variation2.phpt
new file mode 100644
index 000000000..5e0df8029
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation2.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test strip_tags() function : usage variations - unexpected values for 'allowable_tags'
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving unexpected values for $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// Initialise function argument
+$string = "<html><a>hello</a></html><p>world</p><!-- COMMENT --><?php echo hello ?>";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//get a resource variable
+$fp = fopen(__FILE__, "r");
+
+//get a class
+class classA{
+ public function __toString(){
+ return "Class A Object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+ $fp
+);
+
+// loop through each element of the array for allowable_tags
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($string, $value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(10) "helloworld"
+-- Iteration 2 --
+string(10) "helloworld"
+-- Iteration 3 --
+string(10) "helloworld"
+-- Iteration 4 --
+string(10) "helloworld"
+-- Iteration 5 --
+string(10) "helloworld"
+-- Iteration 6 --
+string(10) "helloworld"
+-- Iteration 7 --
+string(10) "helloworld"
+-- Iteration 8 --
+string(10) "helloworld"
+-- Iteration 9 --
+string(10) "helloworld"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "helloworld"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "helloworld"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "helloworld"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "helloworld"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "helloworld"
+-- Iteration 15 --
+string(10) "helloworld"
+-- Iteration 16 --
+string(10) "helloworld"
+-- Iteration 17 --
+string(10) "helloworld"
+-- Iteration 18 --
+string(10) "helloworld"
+-- Iteration 19 --
+string(10) "helloworld"
+-- Iteration 20 --
+string(10) "helloworld"
+-- Iteration 21 --
+string(10) "helloworld"
+-- Iteration 22 --
+string(10) "helloworld"
+-- Iteration 23 --
+string(10) "helloworld"
+-- Iteration 24 --
+string(10) "helloworld"
+-- Iteration 25 --
+string(10) "helloworld"
+-- Iteration 26 --
+string(10) "helloworld"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation3.phpt b/ext/standard/tests/strings/strip_tags_variation3.phpt
new file mode 100644
index 000000000..1e1ed9efb
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation3.phpt
@@ -0,0 +1,167 @@
+--TEST--
+Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags'
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving unexpected values for $str and $allowable_tags arguments
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// get a resource
+$fp=fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA{
+ public function __toString(){
+ return "Class A object";
+ }
+}
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new classA(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+ $fp
+
+);
+
+// loop through each element of the array for allowable_tags
+$iterator = 1;
+foreach($values as $value) {
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($value, $value) );
+ $iterator++;
+};
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(5) "-10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(1) "1"
+-- Iteration 20 --
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+-- Iteration 23 --
+string(14) "Class A object"
+-- Iteration 24 --
+string(0) ""
+-- Iteration 25 --
+string(0) ""
+-- Iteration 26 --
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation4.phpt b/ext/standard/tests/strings/strip_tags_variation4.phpt
new file mode 100644
index 000000000..b6fd40422
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation4.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags'
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving invalid values for $str and valid values for $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// unexpected values for $string
+$strings = array (
+ "<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>",
+ '<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>',
+ "<%?php hello\t world?%>",
+ '<%?php hello\t world?%>',
+ "<<htmL>>hello<</htmL>>",
+ '<<htmL>>hello<</htmL>>',
+ "<a.>HtMl text</.a>",
+ '<a.>HtMl text</.a>',
+ "<nnn>I am not a valid html text</nnn>",
+ '<nnn>I am not a valid html text</nnn>',
+ "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>",
+ '<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>',
+);
+
+//valid html and php tags
+$quotes = "<p><a><?php<html>";
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($strings as $string_value)
+{
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($string_value, $quotes) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(32) "hello world... strip_tags_test"
+-- Iteration 2 --
+string(34) "hello \t\tworld... strip_tags_test"
+-- Iteration 3 --
+string(0) ""
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(18) "<htmL>hello</htmL>"
+-- Iteration 6 --
+string(18) "<htmL>hello</htmL>"
+-- Iteration 7 --
+string(9) "HtMl text"
+-- Iteration 8 --
+string(9) "HtMl text"
+-- Iteration 9 --
+string(26) "I am not a valid html text"
+-- Iteration 10 --
+string(26) "I am not a valid html text"
+-- Iteration 11 --
+string(62) "I am a quoted (") string with special chars like $,\!,\@,\%,\&"
+-- Iteration 12 --
+string(64) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation5.phpt b/ext/standard/tests/strings/strip_tags_variation5.phpt
new file mode 100644
index 000000000..0eaea23de
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation5.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test strip_tags() function : usage variations - heredoc strings
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+
+/*
+ * testing functionality of strip_tags() by giving heredoc strings as values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+// null here doc string
+$null_string = <<<EOT
+EOT;
+
+// heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// here doc with multiline string
+$multiline_string = <<<EOT
+<html>hello world</html>
+<p>13 &lt; 25</p>
+<?php 1111 &amp; 0000 = 0000 ?>
+<b>This is a double quoted string</b>
+EOT;
+
+// here doc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+<html>hello\r world\t
+1111\t\t != 2222\v\v</html>
+<? heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces ?>
+EOT;
+
+// here doc with numeric values
+$numeric_string = <<<EOT
+<html>11 < 12. 123 >22</html>
+<p>string</p> 1111\t <b>0000\t = 0000\n</b>
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+<html>This's a string with quotes:</html>
+"strings in double quote";
+'strings in single quote';
+<html>this\line is single quoted /with\slashes </html>
+EOT;
+
+$res_heredoc_strings = array(
+ //heredoc strings
+ $null_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// initialize the second argument
+$quotes = "<html><a><?php";
+
+// loop through $res_heredoc_strings element and check the working on strip_tags()
+$count = 1;
+for($index =0; $index < count($res_heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strip_tags($res_heredoc_strings[$index], $quotes) );
+ $count++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(67) "<html>hello world</html>
+13 &lt; 25
+
+This is a double quoted string"
+-- Iteration 4 --
+string(44) "<html>hello world
+1111 != 2222 </html>
+"
+-- Iteration 5 --
+string(56) "<html>11 < 12. 123 >22</html>
+string 1111 0000 = 0000
+"
+-- Iteration 6 --
+string(150) "<html>This's a string with quotes:</html>
+"strings in double quote";
+'strings in single quote';
+<html>this\line is single quoted /with\slashes </html>"
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strip_tags_variation6.phpt b/ext/standard/tests/strings/strip_tags_variation6.phpt
new file mode 100644
index 000000000..ff2190636
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation6.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test strip_tags() function : usage variations - binary safe checking
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing whether strip_tags() is binary safe or not
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+//various string inputs
+$strings = array (
+ "<html> I am html string </html>".chr(0)."<?php I am php string ?>",
+ "<html> I am html string\0 </html><?php I am php string ?>",
+ b"<a>I am html string</a>",
+ "<html>I am html string</html>".decbin(65)."<?php I am php string?>"
+);
+
+//loop through the strings array to check if strip_tags() is binary safe
+$iterator = 1;
+foreach($strings as $value)
+{
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($value) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(18) " I am html string "
+-- Iteration 2 --
+string(18) " I am html string "
+-- Iteration 3 --
+string(16) "I am html string"
+-- Iteration 4 --
+string(23) "I am html string1000001"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation7.phpt b/ext/standard/tests/strings/strip_tags_variation7.phpt
new file mode 100644
index 000000000..1c76940b8
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation7.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags'
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving invalid values for $str and $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+$strings = array (
+ "<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>",
+ '<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>',
+ "<%?php hello\t world?%>",
+ '<%?php hello\t world?%>',
+ "<<htmL>>hello<</htmL>>",
+ '<<htmL>>hello<</htmL>>',
+ "<a.>HtMl text</.a>",
+ '<a.>HtMl text</.a>',
+ "<nnn>I am not a valid html text</nnn>",
+ '<nnn>I am not a valid html text</nnn>',
+ "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>",
+ '<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>',
+);
+
+$quotes = "<nnn><abc><%?<<html>>";
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($strings as $string_value)
+{
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($string_value, $quotes) );
+ $iterator++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(43) "<abc>hello</abc> world... strip_tags_test"
+-- Iteration 2 --
+string(45) "<abc>hello</abc> \t\tworld... strip_tags_test"
+-- Iteration 3 --
+string(0) ""
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(18) "<htmL>hello</htmL>"
+-- Iteration 6 --
+string(18) "<htmL>hello</htmL>"
+-- Iteration 7 --
+string(9) "HtMl text"
+-- Iteration 8 --
+string(9) "HtMl text"
+-- Iteration 9 --
+string(37) "<nnn>I am not a valid html text</nnn>"
+-- Iteration 10 --
+string(37) "<nnn>I am not a valid html text</nnn>"
+-- Iteration 11 --
+string(73) "<nnn>I am a quoted (") string with special chars like $,\!,\@,\%,\&</nnn>"
+-- Iteration 12 --
+string(75) "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>"
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation8.phpt b/ext/standard/tests/strings/strip_tags_variation8.phpt
new file mode 100644
index 000000000..a8b45c1a2
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation8.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags'
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving valid value for $str and invalid values for $allowable_tags argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+$strings = "<html>hello</html> \tworld... <p>strip_tags_test\v\f</p><?php hello\t wo\rrld?>";
+
+$quotes = array (
+ "<nnn>",
+ '<nnn>',
+ "<abc>",
+ '<abc>',
+ "<%?php",
+ '<%?php',
+ "<<html>>",
+ '<<html>>'
+);
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($quotes as $string_value)
+{
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($strings, $string_value) );
+ $iterator++;
+}
+
+echo "Done";
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(33) "hello world... strip_tags_test "
+-- Iteration 2 --
+string(33) "hello world... strip_tags_test "
+-- Iteration 3 --
+string(33) "hello world... strip_tags_test "
+-- Iteration 4 --
+string(33) "hello world... strip_tags_test "
+-- Iteration 5 --
+string(33) "hello world... strip_tags_test "
+-- Iteration 6 --
+string(33) "hello world... strip_tags_test "
+-- Iteration 7 --
+string(46) "<html>hello</html> world... strip_tags_test "
+-- Iteration 8 --
+string(46) "<html>hello</html> world... strip_tags_test "
+Done
diff --git a/ext/standard/tests/strings/strip_tags_variation9.phpt b/ext/standard/tests/strings/strip_tags_variation9.phpt
new file mode 100644
index 000000000..2665773a5
--- /dev/null
+++ b/ext/standard/tests/strings/strip_tags_variation9.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test strip_tags() function : usage variations - double quoted strings
+--INI--
+set short_open_tag = on
+--FILE--
+<?php
+/* Prototype : string strip_tags(string $str [, string $allowable_tags])
+ * Description: Strips HTML and PHP tags from a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing functionality of strip_tags() by giving double quoted strings as values for $str argument
+*/
+
+echo "*** Testing strip_tags() : usage variations ***\n";
+
+$double_quote_string = array (
+ "<html> \$ -> This represents the dollar sign</html><?php echo hello ?>",
+ "<html>\t\r\v The quick brown fo\fx jumped over the lazy dog</p>",
+ "<a>This is a hyper text tag</a>",
+ "<? <html>hello world\\t</html>?>",
+ "<p>This is a paragraph</p>",
+ "<b>This is \ta text in bold letters\r\s\malong with slashes\n</b>"
+);
+
+$quotes = "<html><a><p><b><?php";
+
+//loop through the various elements of strings array to test strip_tags() functionality
+$iterator = 1;
+foreach($double_quote_string as $string_value)
+{
+ echo "-- Iteration $iterator --\n";
+ var_dump( strip_tags($string_value, $quotes) );
+ $iterator++;
+}
+
+echo "Done";
+--EXPECTF--
+*** Testing strip_tags() : usage variations ***
+-- Iteration 1 --
+string(50) "<html> $ -> This represents the dollar sign</html>"
+-- Iteration 2 --
+string(59) "<html> The quick brown fo x jumped over the lazy dog</p>"
+-- Iteration 3 --
+string(31) "<a>This is a hyper text tag</a>"
+-- Iteration 4 --
+string(0) ""
+-- Iteration 5 --
+string(26) "<p>This is a paragraph</p>"
+-- Iteration 6 --
+string(62) "<b>This is a text in bold letters \s\malong with slashes
+</b>"
+Done
diff --git a/ext/standard/tests/strings/stripos_basic1.phpt b/ext/standard/tests/strings/stripos_basic1.phpt
new file mode 100644
index 000000000..cffbdba1b
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_basic1.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test stripos() function : basic functionality - with default arguments
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripos() function: basic functionality ***\n";
+$heredoc_str = <<<Identifier
+Hello, World
+Identifier;
+
+echo "-- With default arguments --\n";
+//regular string for haystack & needle
+var_dump( stripos("Hello, World", "Hello") );
+var_dump( stripos('Hello, World', "hello") );
+var_dump( stripos("Hello, World", 'World') );
+var_dump( stripos('Hello, World', 'WORLD') );
+
+//single char for needle
+var_dump( stripos("Hello, World", "o") );
+var_dump( stripos("Hello, World", ",") );
+
+//heredoc string for haystack & needle
+var_dump( stripos($heredoc_str, "Hello, World") );
+var_dump( stripos($heredoc_str, 'Hello') );
+var_dump( stripos($heredoc_str, $heredoc_str) );
+
+//non-existing needle in haystack
+var_dump( stripos("Hello, World", "ooo") );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: basic functionality ***
+-- With default arguments --
+int(0)
+int(0)
+int(7)
+int(7)
+int(4)
+int(5)
+int(0)
+int(0)
+int(0)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_basic2.phpt b/ext/standard/tests/strings/stripos_basic2.phpt
new file mode 100644
index 000000000..3022bae16
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_basic2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test stripos() function : basic functionality - with all arguments
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripos() function: basic functionality ***\n";
+$heredoc_str = <<<Identifier
+Hello, World
+Identifier;
+
+echo "-- With all arguments --\n";
+//regular string for haystack & needle, with various offsets
+var_dump( stripos("Hello, World", "Hello", 0) );
+var_dump( stripos("Hello, World", 'Hello', 1) );
+var_dump( stripos('Hello, World', 'WORLD', 1) );
+var_dump( stripos('Hello, World', "WoRld", 5) );
+
+//heredoc string for haystack & needle, with various offsets
+var_dump( stripos($heredoc_str, "Hello, World", 0) );
+var_dump( stripos($heredoc_str, 'Hello', 0) );
+var_dump( stripos($heredoc_str, 'Hello', 1) );
+var_dump( stripos($heredoc_str, $heredoc_str, 0) );
+var_dump( stripos($heredoc_str, $heredoc_str, 1) );
+
+//various offsets
+var_dump( stripos("Hello, World", "o", 3) );
+var_dump( stripos("Hello, World", "O", 5) );
+var_dump( stripos("Hello, World", "o", 6) );
+var_dump( stripos("Hello, World", "o", 10) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: basic functionality ***
+-- With all arguments --
+int(0)
+bool(false)
+int(7)
+int(7)
+int(0)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(4)
+int(8)
+int(8)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt
new file mode 100644
index 000000000..ef6ad9e6e
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test stripos() function : error conditions
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing stripos() function: error conditions ***\n";
+echo "\n-- With Zero arguments --";
+var_dump( stripos() );
+
+echo "\n-- With less than expected number of arguments --";
+var_dump( stripos("String") );
+
+echo "\n-- With more than expected number of arguments --";
+var_dump( stripos("string", "String", 1, 'extra_arg') );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: error conditions ***
+
+-- With Zero arguments --
+Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- With less than expected number of arguments --
+Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+-- With more than expected number of arguments --
+Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt
new file mode 100644
index 000000000..f3e743cc0
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation1.phpt
@@ -0,0 +1,226 @@
+--TEST--
+Test stripos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing double quoted strings for 'haystack' & 'needle' arguments */
+
+echo "*** Testing stripos() function: with double quoted strings ***\n";
+$haystack = "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 ";
+$needle = array(
+ //regular strings
+ "l",
+ "L",
+ "HELLO",
+ "hEllo",
+
+ //escape characters
+ "\t",
+ "\T", //invalid input
+ " ",
+ "\n",
+ "\N", //invalid input
+ "
+", //new line
+
+ //nulls
+ "\0",
+ NULL,
+ null,
+
+ //boolean false
+ FALSE,
+ false,
+
+ //empty string
+ "",
+
+ //special chars
+ " ",
+ "$",
+ " $",
+ "&",
+ "!#",
+ "%\o",
+ "\o,",
+ "()",
+ "*+",
+ "+",
+ "-",
+ ".",
+ ".;",
+ ":;",
+ ";",
+ "<=>",
+ ">",
+ "=>",
+ "?",
+ "@",
+ "@hEllo",
+
+ "12345", //decimal numeric string
+ "\x23", //hexadecimal numeric string
+ "#", //respective ASCII char of \x23
+ "\101", //octal numeric string
+ "A", //respective ASCII char of \101
+ "456HEE", //numerics + chars
+ $haystack //haystack as needle
+);
+
+/* loop through to get the position of the needle in haystack string */
+$count = 1;
+for($index=0; $index<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( stripos($haystack, $needle[$index]) );
+ var_dump( stripos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with double quoted strings ***
+-- Iteration 1 --
+int(2)
+int(2)
+-- Iteration 2 --
+int(2)
+int(2)
+-- Iteration 3 --
+int(0)
+int(34)
+-- Iteration 4 --
+int(0)
+int(34)
+-- Iteration 5 --
+int(6)
+int(6)
+-- Iteration 6 --
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+int(7)
+int(7)
+-- Iteration 9 --
+bool(false)
+bool(false)
+-- Iteration 10 --
+int(7)
+int(9)
+-- Iteration 11 --
+int(8)
+bool(false)
+-- Iteration 12 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+-- Iteration 14 --
+int(8)
+bool(false)
+-- Iteration 15 --
+int(8)
+bool(false)
+-- Iteration 16 --
+bool(false)
+bool(false)
+-- Iteration 17 --
+int(10)
+int(47)
+-- Iteration 18 --
+int(12)
+bool(false)
+-- Iteration 19 --
+int(11)
+bool(false)
+-- Iteration 20 --
+int(13)
+bool(false)
+-- Iteration 21 --
+int(14)
+bool(false)
+-- Iteration 22 --
+int(16)
+bool(false)
+-- Iteration 23 --
+int(17)
+bool(false)
+-- Iteration 24 --
+int(20)
+bool(false)
+-- Iteration 25 --
+int(22)
+bool(false)
+-- Iteration 26 --
+int(23)
+bool(false)
+-- Iteration 27 --
+int(24)
+bool(false)
+-- Iteration 28 --
+int(25)
+bool(false)
+-- Iteration 29 --
+bool(false)
+bool(false)
+-- Iteration 30 --
+int(27)
+bool(false)
+-- Iteration 31 --
+int(28)
+bool(false)
+-- Iteration 32 --
+int(29)
+bool(false)
+-- Iteration 33 --
+int(31)
+bool(false)
+-- Iteration 34 --
+int(30)
+bool(false)
+-- Iteration 35 --
+int(32)
+bool(false)
+-- Iteration 36 --
+int(33)
+bool(false)
+-- Iteration 37 --
+int(33)
+bool(false)
+-- Iteration 38 --
+int(39)
+int(39)
+-- Iteration 39 --
+int(15)
+int(48)
+-- Iteration 40 --
+int(15)
+int(48)
+-- Iteration 41 --
+int(51)
+int(51)
+-- Iteration 42 --
+int(51)
+int(51)
+-- Iteration 43 --
+bool(false)
+bool(false)
+-- Iteration 44 --
+int(0)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt
new file mode 100644
index 000000000..efdbb5238
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation10.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test stripos() function : usage variations - unexpected inputs for 'needle' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'needle' and
+ * an expected type of input for 'haystack' argument
+*/
+
+echo "*** Testing stripos() function with unexpected values for needle ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
+
+// array with different values
+$needles = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through each element of the 'needle' array to check the working of stripos()
+$counter = 1;
+for($index = 0; $index < count($needles); $index ++) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( stripos($haystack, $needles[$index]) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function with unexpected values for needle ***
+
+-- 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: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+bool(false)
+
+-- Iteration 18 --
+bool(false)
+
+-- Iteration 19 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+bool(false)
+
+-- Iteration 21 --
+bool(false)
+
+-- Iteration 22 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+-- Iteration 26 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt
new file mode 100644
index 000000000..473676126
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation11.phpt
@@ -0,0 +1,215 @@
+--TEST--
+Test stripos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'haystack' and 'needle' arguments */
+
+echo "*** Testing stripos() function with unexpected values for haystack and needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of stripos()
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $haystack = $values[$index];
+ var_dump( stripos($values[$index], $values[$index]) );
+ var_dump( stripos($values[$index], $values[$index], 1) );
+ $counter ++;
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function with unexpected values for haystack and needle ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+bool(false)
+bool(false)
+-- Iteration 10 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+bool(false)
+bool(false)
+-- Iteration 16 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 17 --
+bool(false)
+bool(false)
+-- Iteration 18 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+-- Iteration 20 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 21 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 22 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 23 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 25 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 26 --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation12.phpt b/ext/standard/tests/strings/stripos_variation12.phpt
new file mode 100644
index 000000000..bd0d8aeb8
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation12.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test stripos() function : usage variations - null terminated strings for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with null terminated strings for 'haystack' argument
+ * in order to check the binary safe
+*/
+
+echo "*** Test stripos() function: binary safe ***\n";
+$haystacks = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello World",
+ "Hello World".chr(0),
+ chr(0).chr(0).chr(0),
+ "Hello\0world",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($haystacks); $index++ ) {
+ var_dump( stripos($haystacks[$index], "\0") );
+ var_dump( stripos($haystacks[$index], "\0", $index) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Test stripos() function: binary safe ***
+int(5)
+int(5)
+int(0)
+bool(false)
+int(11)
+int(11)
+int(0)
+bool(false)
+int(5)
+int(5)
+int(0)
+bool(false)
+int(5)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation13.phpt b/ext/standard/tests/strings/stripos_variation13.phpt
new file mode 100644
index 000000000..3c4508f08
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation13.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test stripos() function : usage variations - null terminated strings for 'needle' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with null terminated strings for 'needle' argument
+ * in order to check binary safe
+*/
+
+echo "*** Test stripos() function: binary safe ***\n";
+$haystack = "\0Hello\0World\0";
+
+$needles = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello World",
+ "Hello World".chr(0),
+ chr(0).chr(0).chr(0),
+ "Hello\0world",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($needles); $index++ ) {
+ var_dump( stripos($haystack, $needles[$index]) );
+ var_dump( stripos($haystack, $needles[$index], $index) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Test stripos() function: binary safe ***
+int(1)
+int(1)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(1)
+bool(false)
+int(0)
+bool(false)
+int(1)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation14.phpt b/ext/standard/tests/strings/stripos_variation14.phpt
new file mode 100644
index 000000000..023585dbb
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation14.phpt
@@ -0,0 +1,155 @@
+--TEST--
+Test stripos() function : usage variations - unexpected inputs for 'offset' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'offset' argument */
+
+echo "*** Testing stripos() function with unexpected values for offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//definition of input args
+$haystack = "hello world";
+$needle = "world";
+
+// array with different values
+$offsets = array (
+
+ // float values
+ 1.5,
+ -1.5,
+ 1.5e10,
+ 1.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ //resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of stripos()
+$counter = 1;
+for($index = 0; $index < count($offsets); $index ++) {
+ echo "-- Iteration $counter --\n";
+ var_dump( stripos($haystack, $needle, $offsets[$index]) );
+ $counter ++;
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function with unexpected values for offset ***
+-- Iteration 1 --
+int(6)
+-- Iteration 2 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 3 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 4 --
+int(6)
+-- Iteration 5 --
+int(6)
+-- Iteration 6 --
+
+Warning: stripos() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: stripos() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: stripos() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 9 --
+
+Warning: stripos() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 10 --
+
+Warning: stripos() expects parameter 3 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+int(6)
+-- Iteration 12 --
+int(6)
+-- Iteration 13 --
+int(6)
+-- Iteration 14 --
+int(6)
+-- Iteration 15 --
+
+Warning: stripos() expects parameter 3 to be long, object given in %s on line %d
+NULL
+-- Iteration 16 --
+
+Warning: stripos() expects parameter 3 to be long, string given in %s on line %d
+NULL
+-- Iteration 17 --
+
+Warning: stripos() expects parameter 3 to be long, string given in %s on line %d
+NULL
+-- Iteration 18 --
+int(6)
+-- Iteration 19 --
+int(6)
+-- Iteration 20 --
+
+Warning: stripos() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+int(6)
+-- Iteration 22 --
+int(6)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation15.phpt b/ext/standard/tests/strings/stripos_variation15.phpt
new file mode 100644
index 000000000..2304c1d35
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation15.phpt
@@ -0,0 +1,171 @@
+--TEST--
+Test stripos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */
+
+echo "*** Testing stripos() function with unexpected values for haystack, needle & offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ //resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of stripos()
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ var_dump( stripos($values[$index], $values[$index], $values[$index]) );
+ $counter ++;
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function with unexpected values for haystack, needle & offset ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+
+Warning: stripos() expects parameter 3 to be long, object given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: stripos() expects parameter 3 to be long, string given in %s on line %d
+NULL
+-- Iteration 21 --
+
+Warning: stripos() expects parameter 3 to be long, string given in %s on line %d
+NULL
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+
+Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt
new file mode 100644
index 000000000..e4d8a153e
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation2.phpt
@@ -0,0 +1,234 @@
+--TEST--
+Test stripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing single quoted strings to 'haystack' & 'needle' arguments */
+
+echo "*** Testing stripos() function: with single quoted strings ***\n";
+$haystack = 'Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 ';
+$needle = array(
+ //regular strings
+ 'l',
+ 'L',
+ 'HELLO',
+ 'hEllo',
+
+ //escape characters
+ '\t',
+ '\T',
+ ' ',
+ '\n',
+ '\N',
+ '
+', //new line
+
+ //nulls
+ '\0',
+ NULL,
+ null,
+
+ //boolean false
+ FALSE,
+ false,
+
+ //empty string
+ '',
+
+ //special chars
+ ' ',
+ '$',
+ ' $',
+ '&',
+ '!#',
+ '%\o',
+ '\o,',
+ '()',
+ '*+',
+ '+',
+ '-',
+ '.',
+ '.;',
+ '.;',
+ ':;',
+ ';',
+ '<=>',
+ '>',
+ '=>',
+ '?',
+ '@',
+ '@hEllo',
+
+ '12345', //decimal numeric string
+ '\x23', //hexadecimal numeric string
+ '#', //hexadecimal numeric string
+ '\101', //octal numeric string
+ 'A',
+ '456HEE', //numerics + chars
+ 42, //needle as int(ASCII value of '*')
+ $haystack //haystack as needle
+);
+
+/* loop through to get the position of the needle in haystack string */
+$count = 1;
+for($index=0; $index<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( stripos($haystack, $needle[$index]) );
+ var_dump( stripos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with single quoted strings ***
+-- Iteration 1 --
+int(2)
+int(2)
+-- Iteration 2 --
+int(2)
+int(2)
+-- Iteration 3 --
+int(0)
+int(38)
+-- Iteration 4 --
+int(0)
+int(38)
+-- Iteration 5 --
+int(6)
+int(6)
+-- Iteration 6 --
+int(6)
+int(6)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+int(8)
+int(8)
+-- Iteration 9 --
+int(8)
+int(8)
+-- Iteration 10 --
+bool(false)
+bool(false)
+-- Iteration 11 --
+int(10)
+int(10)
+-- Iteration 12 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+
+Warning: stripos(): needle is not a string or an integer in %s on line %d
+bool(false)
+-- Iteration 14 --
+bool(false)
+bool(false)
+-- Iteration 15 --
+bool(false)
+bool(false)
+-- Iteration 16 --
+bool(false)
+bool(false)
+-- Iteration 17 --
+int(14)
+int(51)
+-- Iteration 18 --
+int(16)
+bool(false)
+-- Iteration 19 --
+int(15)
+bool(false)
+-- Iteration 20 --
+int(17)
+bool(false)
+-- Iteration 21 --
+int(18)
+bool(false)
+-- Iteration 22 --
+int(20)
+bool(false)
+-- Iteration 23 --
+int(21)
+bool(false)
+-- Iteration 24 --
+int(24)
+int(24)
+-- Iteration 25 --
+int(26)
+int(26)
+-- Iteration 26 --
+int(27)
+int(27)
+-- Iteration 27 --
+int(28)
+int(28)
+-- Iteration 28 --
+int(29)
+int(29)
+-- Iteration 29 --
+bool(false)
+bool(false)
+-- Iteration 30 --
+bool(false)
+bool(false)
+-- Iteration 31 --
+int(31)
+int(31)
+-- Iteration 32 --
+int(32)
+int(32)
+-- Iteration 33 --
+int(33)
+int(33)
+-- Iteration 34 --
+int(35)
+int(35)
+-- Iteration 35 --
+int(34)
+int(34)
+-- Iteration 36 --
+int(36)
+int(36)
+-- Iteration 37 --
+int(37)
+int(37)
+-- Iteration 38 --
+int(37)
+int(37)
+-- Iteration 39 --
+int(43)
+int(43)
+-- Iteration 40 --
+int(52)
+int(52)
+-- Iteration 41 --
+int(19)
+bool(false)
+-- Iteration 42 --
+int(58)
+int(58)
+-- Iteration 43 --
+bool(false)
+bool(false)
+-- Iteration 44 --
+bool(false)
+bool(false)
+-- Iteration 45 --
+int(26)
+bool(false)
+-- Iteration 46 --
+int(0)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation3.phpt b/ext/standard/tests/strings/stripos_variation3.phpt
new file mode 100644
index 000000000..40cdea48f
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation3.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test stripos() function : usage variations - multi line heredoc string for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing multi-line heredoc string for haystack and
+ * with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing multi lines --\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+var_dump( stripos($multi_line_str, "ing", 0) );
+var_dump( stripos($multi_line_str, "ing", 15) );
+var_dump( stripos($multi_line_str, "ing", 22) );
+var_dump( stripos($multi_line_str, "") );
+var_dump( stripos($multi_line_str, " ") );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with heredoc strings ***
+-- With heredoc string containing multi lines --
+int(14)
+int(23)
+int(23)
+bool(false)
+int(7)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation4.phpt b/ext/standard/tests/strings/stripos_variation4.phpt
new file mode 100644
index 000000000..8249ef0f6
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation4.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test stripos() function : usage variations - heredoc string containing special chars for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing heredoc string containing special chars for haystack
+ * and with various needles & offets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing special chars --\n";
+$special_chars_str = <<<EOD
+Ex'ple of h'doc st'g, contains
+$#%^*&*_("_")!#@@!$#$^^&$*(special)
+chars.
+EOD;
+var_dump( stripos($special_chars_str, "Ex'ple", 0) );
+var_dump( stripos($special_chars_str, "!@@!", 23) );
+var_dump( stripos($special_chars_str, '_') );
+var_dump( stripos($special_chars_str, '("_")') );
+var_dump( stripos($special_chars_str, "$*") );
+var_dump( stripos($special_chars_str, "$*", 10) );
+var_dump( stripos($special_chars_str, "(special)") );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with heredoc strings ***
+-- With heredoc string containing special chars --
+int(0)
+bool(false)
+int(38)
+int(39)
+int(55)
+int(55)
+int(57)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation5.phpt b/ext/standard/tests/strings/stripos_variation5.phpt
new file mode 100644
index 000000000..900fe04bb
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test stripos() function : usage variations - heredoc string containing escape chars for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing heredoc string containing escape chars for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing escape characters --\n";
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\tWorld
+EOD;
+var_dump( stripos($control_char_str, "\n") );
+var_dump( stripos($control_char_str, "\t") );
+var_dump( stripos($control_char_str, "\n", 12) );
+var_dump( stripos($control_char_str, "\t", 15) );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with heredoc strings ***
+-- With heredoc string containing escape characters --
+int(12)
+int(19)
+int(12)
+int(19)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation6.phpt b/ext/standard/tests/strings/stripos_variation6.phpt
new file mode 100644
index 000000000..c69ee174d
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation6.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test stripos() function : usage variations - heredoc string containing quotes for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing heredoc string containing quotes for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing quote & slash chars --\n";
+$quote_char_str = <<<EOD
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOD;
+var_dump( stripos($quote_char_str, "line") );
+var_dump( stripos($quote_char_str, 'things') );
+var_dump( stripos($quote_char_str, 'things', 0) );
+var_dump( stripos($quote_char_str, "things", 20) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with heredoc strings ***
+-- With heredoc string containing quote & slash chars --
+int(88)
+int(34)
+int(34)
+int(34)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt
new file mode 100644
index 000000000..29a0a2046
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation7.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test stripos() function : usage variations - empty heredoc string for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function by passing empty heredoc string for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: with heredoc strings ***\n";
+echo "-- With empty heredoc string --\n";
+$empty_string = <<<EOD
+EOD;
+var_dump( stripos($empty_string, "") );
+var_dump( stripos($empty_string, "", 1) );
+var_dump( stripos($empty_string, FALSE) );
+var_dump( stripos($empty_string, NULL) );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: with heredoc strings ***
+-- With empty heredoc string --
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation8.phpt b/ext/standard/tests/strings/stripos_variation8.phpt
new file mode 100644
index 000000000..cbf96bf12
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation8.phpt
@@ -0,0 +1,216 @@
+--TEST--
+Test stripos() function : usage variations - repetitive chars for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with strings containing repetitive chars for haystak
+ * and with various needles & offsets
+*/
+
+echo "*** Testing stripos() function: strings repetitive chars ***\n";
+$haystack = "aBAbaBAbaBabAbAbaBa";
+$needles = array(
+ "aba",
+ "aBA",
+ "ABA",
+ "Aba",
+ "BAb",
+ "bab",
+ "bAb",
+ "BAB"
+);
+
+/* loop through to consider various offsets in getting the position of the needle in haystack string */
+$count = 1;
+for($index = 0; $index < count($needles); $index++) {
+ echo "\n-- Iteration $count --\n";
+ for($offset = 0; $offset <= strlen($haystack); $offset++ ) {
+ var_dump( stripos($haystack, $needles[$index], $offset) );
+ }
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function: strings repetitive chars ***
+
+-- Iteration 1 --
+int(0)
+int(2)
+int(2)
+int(4)
+int(4)
+int(6)
+int(6)
+int(8)
+int(8)
+int(10)
+int(10)
+int(12)
+int(12)
+int(14)
+int(14)
+int(16)
+int(16)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 2 --
+int(0)
+int(2)
+int(2)
+int(4)
+int(4)
+int(6)
+int(6)
+int(8)
+int(8)
+int(10)
+int(10)
+int(12)
+int(12)
+int(14)
+int(14)
+int(16)
+int(16)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 3 --
+int(0)
+int(2)
+int(2)
+int(4)
+int(4)
+int(6)
+int(6)
+int(8)
+int(8)
+int(10)
+int(10)
+int(12)
+int(12)
+int(14)
+int(14)
+int(16)
+int(16)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 4 --
+int(0)
+int(2)
+int(2)
+int(4)
+int(4)
+int(6)
+int(6)
+int(8)
+int(8)
+int(10)
+int(10)
+int(12)
+int(12)
+int(14)
+int(14)
+int(16)
+int(16)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 5 --
+int(1)
+int(1)
+int(3)
+int(3)
+int(5)
+int(5)
+int(7)
+int(7)
+int(9)
+int(9)
+int(11)
+int(11)
+int(13)
+int(13)
+int(15)
+int(15)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 6 --
+int(1)
+int(1)
+int(3)
+int(3)
+int(5)
+int(5)
+int(7)
+int(7)
+int(9)
+int(9)
+int(11)
+int(11)
+int(13)
+int(13)
+int(15)
+int(15)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 7 --
+int(1)
+int(1)
+int(3)
+int(3)
+int(5)
+int(5)
+int(7)
+int(7)
+int(9)
+int(9)
+int(11)
+int(11)
+int(13)
+int(13)
+int(15)
+int(15)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+-- Iteration 8 --
+int(1)
+int(1)
+int(3)
+int(3)
+int(5)
+int(5)
+int(7)
+int(7)
+int(9)
+int(9)
+int(11)
+int(11)
+int(13)
+int(13)
+int(15)
+int(15)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation9.phpt b/ext/standard/tests/strings/stripos_variation9.phpt
new file mode 100644
index 000000000..1401dcfae
--- /dev/null
+++ b/ext/standard/tests/strings/stripos_variation9.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test stripos() function : usage variations - unexpected inputs for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of first occurrence of a case-insensitive string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test stripos() function with unexpected inputs for haystack argument */
+
+echo "*** Testing stripos() function with unexpected values for haystack ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$haystacks = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
+
+// loop through each element of the array and check the working of stripos()
+$counter = 1;
+for($index = 0; $index < count($haystacks); $index ++) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( stripos($haystacks[$index], $needle) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing stripos() function with unexpected values for haystack ***
+
+-- 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: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 11 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 12 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 13 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration 14 --
+
+Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- 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 --
+
+Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/stripslashes_basic.phpt b/ext/standard/tests/strings/stripslashes_basic.phpt
new file mode 100644
index 000000000..548aee537
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_basic.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stripslashes_error.phpt b/ext/standard/tests/strings/stripslashes_error.phpt
new file mode 100644
index 000000000..cef09fc2d
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test stripslashes() function : error conditions
+--FILE--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing stripslashes() for error conditions
+*/
+
+echo "*** Testing stripslashes() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing stripslashes() function with Zero arguments --\n";
+var_dump( stripslashes() );
+
+// More than expected number of arguments
+echo "\n-- Testing stripslashes() function with more than expected no. of arguments --\n";
+$str = '\"hello\"\"world\"';
+$extra_arg = 10;
+
+var_dump( stripslashes($str, $extra_arg) );
+var_dump( $str );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing stripslashes() : error conditions ***
+
+-- Testing stripslashes() function with Zero arguments --
+
+Warning: Wrong parameter count for stripslashes() in %s on line %d
+NULL
+
+-- Testing stripslashes() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for stripslashes() in %s on line %d
+NULL
+string(18) "\"hello\"\"world\""
+Done
diff --git a/ext/standard/tests/strings/stripslashes_variation1.phpt b/ext/standard/tests/strings/stripslashes_variation1.phpt
new file mode 100644
index 000000000..4d58fd7a0
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_variation1.phpt
@@ -0,0 +1,170 @@
+--TEST--
+Test stripslashes() function : usage variations - non-string type argument
+--FILE--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripslashes() with non-string type argument such as int, float, etc
+*/
+
+echo "*** Testing stripslashes() : with non-string type argument ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj\'ct";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty string
+ "",
+ '',
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // NULL values
+ NULL,
+ null
+);
+
+
+// loop through each element of the array and check the working of stripslashes()
+// when $str arugment is supplied with different values
+echo "\n--- Testing stripslashes() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( stripslashes($str) );
+
+ $counter ++;
+}
+
+// closing the file
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing stripslashes() : with non-string type argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing stripslashes() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(5) "-10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+-- Iteration 20 --
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+-- Iteration 23 --
+string(6) "obj'ct"
+-- Iteration 24 --
+string(%d) "Resource id #%d"
+-- Iteration 25 --
+string(0) ""
+-- Iteration 26 --
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/stripslashes_variation2.phpt b/ext/standard/tests/strings/stripslashes_variation2.phpt
new file mode 100644
index 000000000..d813d0b33
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_variation2.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stripslashes_variation3.phpt b/ext/standard/tests/strings/stripslashes_variation3.phpt
new file mode 100644
index 000000000..2ccf97ffd
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_variation3.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test stripslashes() function : usage variations - strings with newline and tab characters
+--FILE--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripslashes() with strings containing newline and tab characters.
+*/
+
+echo "*** Testing stripslashes() : with strings containing newline and tab characters ***\n";
+
+// initialising heredoc strings
+$heredoc_string_with_newline = <<<EOT
+This is line 1 \nof 'heredoc' string
+This is line 2 \nof "heredoc" string
+EOT;
+
+$heredoc_string_with_tab = <<<EOT
+This is line 1 \tof 'heredoc' string
+This is line 2 \tof "heredoc" string
+EOT;
+// initialising the string array
+
+$str_array = array(
+ // string with newline character
+ "\n",
+ "\\n",
+ "Hello \nworld",
+ "Hello \\nworld",
+ '\n',
+ '\\n',
+ 'Hello \nworld',
+ 'Hello \\nworld',
+ $heredoc_string_with_newline,
+
+ // string with tab character
+ "\t",
+ "\\t",
+ "Hello \tworld",
+ "Hello \\tworld",
+ '\t',
+ '\\t',
+ 'Hello \tworld',
+ 'Hello \\tworld',
+ $heredoc_string_with_tab
+ );
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $str ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( stripslashes($str) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing stripslashes() : with strings containing newline and tab characters ***
+
+-- Iteration 1 --
+string(1) "
+"
+
+-- Iteration 2 --
+string(1) "n"
+
+-- Iteration 3 --
+string(12) "Hello
+world"
+
+-- Iteration 4 --
+string(12) "Hello nworld"
+
+-- Iteration 5 --
+string(1) "n"
+
+-- Iteration 6 --
+string(1) "n"
+
+-- Iteration 7 --
+string(12) "Hello nworld"
+
+-- Iteration 8 --
+string(12) "Hello nworld"
+
+-- Iteration 9 --
+string(71) "This is line 1
+of 'heredoc' string
+This is line 2
+of "heredoc" string"
+
+-- Iteration 10 --
+string(1) " "
+
+-- Iteration 11 --
+string(1) "t"
+
+-- Iteration 12 --
+string(12) "Hello world"
+
+-- Iteration 13 --
+string(12) "Hello tworld"
+
+-- Iteration 14 --
+string(1) "t"
+
+-- Iteration 15 --
+string(1) "t"
+
+-- Iteration 16 --
+string(12) "Hello tworld"
+
+-- Iteration 17 --
+string(12) "Hello tworld"
+
+-- Iteration 18 --
+string(71) "This is line 1 of 'heredoc' string
+This is line 2 of "heredoc" string"
+Done
diff --git a/ext/standard/tests/strings/stripslashes_variation4.phpt b/ext/standard/tests/strings/stripslashes_variation4.phpt
new file mode 100644
index 000000000..eccca6a64
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_variation4.phpt
@@ -0,0 +1,133 @@
+--TEST--
+Test stripslashes() function : usage variations - double dimensional arrays
+--FILE--
+<?php
+/* Prototype : string stripslashes ( string $str )
+ * Description: Returns an un-quoted string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test stripslashes() with double dimensional arrays
+*/
+
+echo "*** Testing stripslashes() : with double dimensional arrays ***\n";
+
+// initialising the string array
+
+$str_array = array(
+ array("", array()),
+ array("", array("")),
+ array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar")),
+ array("f\\'oo", "b\\'ar", array("")),
+ array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar", array(""))),
+ array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar", array("fo\\'o", "b\\'ar")))
+ );
+function stripslashes_deep($value) {
+ $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
+ return $value;
+}
+
+$count = 1;
+// looping to test for all strings in $str_array
+foreach( $str_array as $arr ) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( stripslashes_deep($arr) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing stripslashes() : with double dimensional arrays ***
+
+-- Iteration 1 --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ array(0) {
+ }
+}
+
+-- Iteration 2 --
+array(2) {
+ [0]=>
+ string(0) ""
+ [1]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+}
+
+-- Iteration 3 --
+array(3) {
+ [0]=>
+ string(4) "f'oo"
+ [1]=>
+ string(4) "b'ar"
+ [2]=>
+ array(2) {
+ [0]=>
+ string(4) "fo'o"
+ [1]=>
+ string(4) "b'ar"
+ }
+}
+
+-- Iteration 4 --
+array(3) {
+ [0]=>
+ string(4) "f'oo"
+ [1]=>
+ string(4) "b'ar"
+ [2]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+}
+
+-- Iteration 5 --
+array(3) {
+ [0]=>
+ string(4) "f'oo"
+ [1]=>
+ string(4) "b'ar"
+ [2]=>
+ array(3) {
+ [0]=>
+ string(4) "fo'o"
+ [1]=>
+ string(4) "b'ar"
+ [2]=>
+ array(1) {
+ [0]=>
+ string(0) ""
+ }
+ }
+}
+
+-- Iteration 6 --
+array(3) {
+ [0]=>
+ string(4) "f'oo"
+ [1]=>
+ string(4) "b'ar"
+ [2]=>
+ array(3) {
+ [0]=>
+ string(4) "fo'o"
+ [1]=>
+ string(4) "b'ar"
+ [2]=>
+ array(2) {
+ [0]=>
+ string(4) "fo'o"
+ [1]=>
+ string(4) "b'ar"
+ }
+ }
+}
+Done
diff --git a/ext/standard/tests/strings/stripslashes_variation5.phpt b/ext/standard/tests/strings/stripslashes_variation5.phpt
new file mode 100644
index 000000000..0507e0496
--- /dev/null
+++ b/ext/standard/tests/strings/stripslashes_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt
index 5c617a20d..51c4dae97 100644
--- a/ext/standard/tests/strings/stristr.phpt
+++ b/ext/standard/tests/strings/stristr.phpt
@@ -24,7 +24,7 @@ NULL
Notice: Array to string conversion in %s on line %d
-Warning: stristr(): Empty delimiter. in %s on line %d
+Warning: stristr(): Empty delimiter in %s on line %d
bool(false)
bool(false)
diff --git a/ext/standard/tests/strings/strncasecmp_basic.phpt b/ext/standard/tests/strings/strncasecmp_basic.phpt
new file mode 100644
index 000000000..34a1b08dc
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test strncasecmp() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+echo "*** Testing strncasecmp() function: basic functionality ***\n";
+
+echo "-- Testing strncasecmp() with single quoted string --\n";
+var_dump( strncasecmp('Hello', 'Hello', 5) ); //expected: int(0)
+var_dump( strncasecmp('Hello', 'Hi', 5) ); //expected: value < 0
+var_dump( strncasecmp('Hi', 'Hello', 5) ); //expected: value > 0
+
+echo "-- Testing strncasecmp() with double quoted string --\n";
+var_dump( strncasecmp("Hello", "Hello", 5) ); //expected: int(0)
+var_dump( strncasecmp("Hello", "Hi", 5) ); //expected: value < 0
+var_dump( strncasecmp("Hi", "Hello", 5) ); //expected: value > 0
+
+echo "-- Testing strncasecmp() with here-doc string --\n";
+$str = <<<HEREDOC
+Hello
+HEREDOC;
+var_dump( strncasecmp($str, "Hello", 5) ); //expected: int(0)
+var_dump( strncasecmp($str, "Hi", 5) ); //expected: value < 0
+var_dump( strncasecmp("Hi", $str, 5) ); //expected: value > 0
+
+echo "*** Done ***";
+?>
+--EXPECTREGEX--
+\*\*\* Testing strncasecmp\(\) function: basic functionality \*\*\*
+-- Testing strncasecmp\(\) with single quoted string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Testing strncasecmp\(\) with double quoted string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Testing strncasecmp\(\) with here-doc string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt
new file mode 100644
index 000000000..7282ea954
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_error.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strncasecmp() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+echo "*** Testing strncasecmp() function: error conditions ***\n";
+$str1 = 'string_val';
+$str2 = 'string_val';
+$len = 10;
+$extra_arg = 10;
+
+echo "\n-- Testing strncasecmp() function with Zero arguments --";
+var_dump( strncasecmp() );
+
+echo "\n-- Testing strncasecmp() function with less than expected number of arguments --";
+var_dump( strncasecmp($str1) );
+var_dump( strncasecmp($str1, $str2) );
+
+echo "\n-- Testing strncasecmp() function with more than expected number of arguments --";
+var_dump( strncasecmp($str1, $str2, $len, $extra_arg) );
+
+echo "\n-- Testing strncasecmp() function with invalid argument --";
+$len = -10;
+var_dump( strncasecmp($str1, $str2, $len) );
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing strncasecmp() function: error conditions ***
+
+-- Testing strncasecmp() function with Zero arguments --
+Warning: Wrong parameter count for strncasecmp() in %s on line %d
+NULL
+
+-- Testing strncasecmp() function with less than expected number of arguments --
+Warning: Wrong parameter count for strncasecmp() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for strncasecmp() in %s on line %d
+NULL
+
+-- Testing strncasecmp() function with more than expected number of arguments --
+Warning: Wrong parameter count for strncasecmp() in %s on line %d
+NULL
+
+-- Testing strncasecmp() function with invalid argument --
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation1.phpt b/ext/standard/tests/strings/strncasecmp_variation1.phpt
new file mode 100644
index 000000000..bcc6ad3d0
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation1.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test strncasecmp() function: usage variations - case-sensitivity
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
+
+echo "*** Test strncasecmp() function: with alphabets ***\n";
+echo "-- Passing upper-case letters for 'str1' --\n";
+for($ASCII = 65; $ASCII <= 90; $ASCII++) {
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase letter with corresponding uppercase letter; exp: int(0)
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing uppercase letter with corresponding lowercase letter; exp: int(0)
+}
+
+echo "\n-- Passing lower-case letters for 'str1' --\n";
+for($ASCII = 97; $ASCII <= 122; $ASCII++) {
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase letter with corresponding lowercase letter; exp: int(0)
+ var_dump( strncasecmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing lowercase letter with corresponding uppercase letter; exp: int(0)
+}
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncasecmp() function: with alphabets ***
+-- Passing upper-case letters for 'str1' --
+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(0)
+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(0)
+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(0)
+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(0)
+
+-- Passing lower-case letters for 'str1' --
+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(0)
+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(0)
+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(0)
+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(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation10.phpt b/ext/standard/tests/strings/strncasecmp_variation10.phpt
new file mode 100644
index 000000000..e06b2b26b
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation10.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test strncasecmp() function : usage variations - unexpected values for 'str1'
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected inputs for 'str1' */
+
+echo "*** Testing strncasecmp() function: with unexpected values for 'str1' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ /* boolean values */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* nulls */
+ NULL,
+ null,
+
+ /* empty string */
+ "",
+ '',
+
+ /* undefined variable */
+ @$undefined_var,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* resource */
+ $file_handle,
+
+ /* object */
+ new sample()
+);
+
+/* loop through each element of the array and check the working of strncasecmp() */
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str1 = $values[$index];
+ $len = strlen($values[$index]) + 1;
+ var_dump( strncasecmp($str1, "string", $len) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing strncasecmp() function: with unexpected values for 'str1' ***
+-- Iteration 1 --
+int(-%d)
+-- Iteration 2 --
+int(-%d)
+-- Iteration 3 --
+int(-%d)
+-- Iteration 4 --
+int(-%d)
+-- Iteration 5 --
+int(-%d)
+-- Iteration 6 --
+int(-%d)
+-- Iteration 7 --
+int(-%d)
+-- Iteration 8 --
+int(-%d)
+-- Iteration 9 --
+int(-%d)
+-- Iteration 10 --
+int(-%d)
+-- Iteration 11 --
+int(-%d)
+-- Iteration 12 --
+int(-%d)
+-- Iteration 13 --
+int(-%d)
+-- Iteration 14 --
+int(-%d)
+-- Iteration 15 --
+
+Notice: Array to string conversion in %s on line 88
+
+Notice: Array to string conversion in %s on line 89
+int(-%d)
+-- Iteration 16 --
+
+Notice: Array to string conversion in %s on line 88
+
+Notice: Array to string conversion in %s on line 89
+int(-%d)
+-- Iteration 17 --
+
+Notice: Array to string conversion in %s on line 88
+
+Notice: Array to string conversion in %s on line 89
+int(-%d)
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line 88
+
+Notice: Array to string conversion in %s on line 89
+int(-%d)
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line 88
+
+Notice: Array to string conversion in %s on line 89
+int(-%d)
+-- Iteration 20 --
+int(-%d)
+-- Iteration 21 --
+int(-%d)
+-- Iteration 22 --
+int(-%d)
+-- Iteration 23 --
+int(-%d)
+-- Iteration 24 --
+int(-%d)
+-- Iteration 25 --
+int(-%d)
+-- Iteration 26 --
+int(-%d)
+-- Iteration 27 --
+int(-%d)
+-- Iteration 28 --
+int(-%d)
+-- Iteration 29 --
+int(-%d)
+-- Iteration 30 --
+int(-%d)
+-- Iteration 31 --
+int(-%d)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation11.phpt b/ext/standard/tests/strings/strncasecmp_variation11.phpt
new file mode 100644
index 000000000..f756c6c00
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation11.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test strncasecmp() function : usage variations - unexpected values for 'str2'
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected inputs for 'str2' */
+
+echo "*** Testing strncasecmp() function: with unexpected values for 'str2' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ /* boolean values */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* nulls */
+ NULL,
+ null,
+
+ /* empty string */
+ "",
+ '',
+
+ /* undefined variable */
+ @$undefined_var,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* resource */
+ $file_handle,
+
+ /* object */
+ new sample()
+);
+
+/* loop through each element of the array and check the working of strncasecmp() */
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str1 = $values[$index];
+ $str2 = $values[$index];
+ $len = strlen($values[$index]) + 1;
+ var_dump( strncasecmp("string", $str2, $len) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing strncasecmp() function: with unexpected values for 'str2' ***
+-- Iteration 1 --
+int(%d)
+-- Iteration 2 --
+int(%d)
+-- Iteration 3 --
+int(%d)
+-- Iteration 4 --
+int(%d)
+-- Iteration 5 --
+int(%d)
+-- Iteration 6 --
+int(%d)
+-- Iteration 7 --
+int(%d)
+-- Iteration 8 --
+int(%d)
+-- Iteration 9 --
+int(%d)
+-- Iteration 10 --
+int(%d)
+-- Iteration 11 --
+int(%d)
+-- Iteration 12 --
+int(%d)
+-- Iteration 13 --
+int(%d)
+-- Iteration 14 --
+int(%d)
+-- Iteration 15 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(%d)
+-- Iteration 16 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(%d)
+-- Iteration 17 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(%d)
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(%d)
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(%d)
+-- Iteration 20 --
+int(%d)
+-- Iteration 21 --
+int(%d)
+-- Iteration 22 --
+int(%d)
+-- Iteration 23 --
+int(%d)
+-- Iteration 24 --
+int(%d)
+-- Iteration 25 --
+int(%d)
+-- Iteration 26 --
+int(%d)
+-- Iteration 27 --
+int(%d)
+-- Iteration 28 --
+int(%d)
+-- Iteration 29 --
+int(%d)
+-- Iteration 30 --
+int(%d)
+-- Iteration 31 --
+int(%d)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation2.phpt b/ext/standard/tests/strings/strncasecmp_variation2.phpt
new file mode 100644
index 000000000..a6f8c1ebb
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation2.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test strncasecmp() function: usage variations - double quoted strings
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with various double quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncasecmp() function: with double quoted strings ***\n";
+$strings = array(
+ "Hello, World",
+ "hello, world",
+ "HELLO, WORLD",
+ "Hello, World\n",
+ "Hello".chr(0)."World"
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--EXPECTREGEX--
+\*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\*
+-- Iteration 1 --
+int\(0\)
+int\(0\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Iteration 2 --
+int\(0\)
+int\(0\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Iteration 3 --
+int\(0\)
+int\(0\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Iteration 4 --
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+-- Iteration 5 --
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncasecmp_variation3.phpt b/ext/standard/tests/strings/strncasecmp_variation3.phpt
new file mode 100644
index 000000000..8409260b2
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation3.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test strncasecmp() function: usage variations - various lengths
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() with various lengths */
+
+echo "*** Test strncasecmp() function: with different lengths ***\n";
+/* definitions of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, world\n";
+
+/* loop through to compare the strings, for various length values */
+for($len = strlen($str1); $len >= 0; $len--) {
+ var_dump( strncasecmp($str1, $str2, $len) );
+}
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncasecmp() function: with different lengths ***
+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(0)
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation4.phpt b/ext/standard/tests/strings/strncasecmp_variation4.phpt
new file mode 100644
index 000000000..3f73aa351
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation4.phpt
@@ -0,0 +1,195 @@
+--TEST--
+Test strncasecmp() function : usage variations - unexpected values for 'str1' & 'str2'
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected inputs for 'str1' and 'str2' */
+
+echo "*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ /* boolean values */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* nulls */
+ NULL,
+ null,
+
+ /* empty string */
+ "",
+ '',
+
+ /* undefined variable */
+ @$undefined_var,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* resource */
+ $file_handle,
+
+ /* object */
+ new sample()
+);
+
+/* loop through each element of the array and check the working of strncasecmp() */
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str1 = $values[$index];
+ $str2 = $values[$index];
+ $len = strlen($values[$index]) + 1;
+ var_dump( strncasecmp($str1, $str2, $len) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(0)
+-- Iteration 3 --
+int(0)
+-- Iteration 4 --
+int(0)
+-- Iteration 5 --
+int(0)
+-- Iteration 6 --
+int(0)
+-- Iteration 7 --
+int(0)
+-- Iteration 8 --
+int(0)
+-- Iteration 9 --
+int(0)
+-- Iteration 10 --
+int(0)
+-- Iteration 11 --
+int(0)
+-- Iteration 12 --
+int(0)
+-- Iteration 13 --
+int(0)
+-- Iteration 14 --
+int(0)
+-- Iteration 15 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 16 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 17 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 20 --
+int(0)
+-- Iteration 21 --
+int(0)
+-- Iteration 22 --
+int(0)
+-- Iteration 23 --
+int(0)
+-- Iteration 24 --
+int(0)
+-- Iteration 25 --
+int(0)
+-- Iteration 26 --
+int(0)
+-- Iteration 27 --
+int(0)
+-- Iteration 28 --
+int(0)
+-- Iteration 29 --
+int(0)
+-- Iteration 30 --
+int(0)
+-- Iteration 31 --
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation5.phpt b/ext/standard/tests/strings/strncasecmp_variation5.phpt
new file mode 100644
index 000000000..4a9fa89a7
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation5.phpt
@@ -0,0 +1,147 @@
+--TEST--
+Test strncasecmp() function : usage variations - unexpected values for 'len'
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with the unexpected values, and giving the same strings for 'str1' and 'str2' */
+
+echo "*** Test strncasecmp() function: unexpected values for 'len' ***\n";
+
+/* definition of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, World\n";
+
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$lengths = array (
+
+ /* float values */
+ 10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+
+ /* octal values */
+ 012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ /* boolean values */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* nulls */
+ NULL,
+ null,
+
+ /* empty string */
+ "",
+ '',
+
+ /* undefined variable */
+ @$undefined_var,
+
+ /* unset variable */
+ @$unset_var,
+
+ /* resource */
+ $file_handle,
+
+ /* object */
+ new sample()
+);
+
+/* loop through each element of the array and check the working of strncasecmp() */
+$counter = 1;
+for($index = 0; $index < count($lengths); $index ++) {
+ $len = $lengths[$index];
+ echo "-- Iteration $counter --\n";
+ var_dump( strncasecmp($str1, $str2, $len) );
+ $counter ++;
+}
+fclose($file_handle);
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncasecmp() function: unexpected values for 'len' ***
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(0)
+-- Iteration 3 --
+int(0)
+-- Iteration 4 --
+int(0)
+-- Iteration 5 --
+int(0)
+-- Iteration 6 --
+int(0)
+-- Iteration 7 --
+int(0)
+-- Iteration 8 --
+int(0)
+-- Iteration 9 --
+int(0)
+-- Iteration 10 --
+int(0)
+-- Iteration 11 --
+int(0)
+-- Iteration 12 --
+int(0)
+-- Iteration 13 --
+int(0)
+-- Iteration 14 --
+int(0)
+-- Iteration 15 --
+int(0)
+-- Iteration 16 --
+int(0)
+-- Iteration 17 --
+int(0)
+-- Iteration 18 --
+int(0)
+-- Iteration 19 --
+int(0)
+-- Iteration 20 --
+int(0)
+-- Iteration 21 --
+int(0)
+-- Iteration 22 --
+int(0)
+-- Iteration 23 --
+int(0)
+-- Iteration 24 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation6.phpt b/ext/standard/tests/strings/strncasecmp_variation6.phpt
new file mode 100644
index 000000000..765032b77
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation6.phpt
@@ -0,0 +1,810 @@
+--TEST--
+Test strncasecmp() function : usage variations - binary safe - all ASCII chars
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with binary values passed to 'str1' & 'str2' */
+
+echo "*** Test strncasecmp() function: with binary inputs ***\n";
+
+/* A binary function should work with all 256 characters that a character(8-bit) can take */
+echo "\n-- Checking with all 256 characters given, in binary format --\n";
+/* loop through to get all 256 character's equivelent binary value, and check working of strncasecmp() */
+$count = 1;
+for($ASCII = 0; $ASCII <= 255; $ASCII++) {
+ $str1 = decbin($ASCII); //ASCII value in binary form
+ $str2 = decbin( ord( chr($ASCII) ) ); //Getting equivelent ASCII value for the character in binary form
+ echo "-- Iteration $count --\n";
+ var_dump( strncasecmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0)
+ var_dump( strncasecmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0)
+ $count++;
+}
+
+echo "\n-- Checking with out of character's range, given in binary format --\n";
+$str1 = decbin(256);
+$str2 = decbin( ord( chr(256) ));
+var_dump( strncasecmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1)
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncasecmp() function: with binary inputs ***
+
+-- Checking with all 256 characters given, in binary format --
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(0)
+int(0)
+-- Iteration 3 --
+int(0)
+int(0)
+-- Iteration 4 --
+int(0)
+int(0)
+-- Iteration 5 --
+int(0)
+int(0)
+-- Iteration 6 --
+int(0)
+int(0)
+-- Iteration 7 --
+int(0)
+int(0)
+-- Iteration 8 --
+int(0)
+int(0)
+-- Iteration 9 --
+int(0)
+int(0)
+-- Iteration 10 --
+int(0)
+int(0)
+-- Iteration 11 --
+int(0)
+int(0)
+-- Iteration 12 --
+int(0)
+int(0)
+-- Iteration 13 --
+int(0)
+int(0)
+-- Iteration 14 --
+int(0)
+int(0)
+-- Iteration 15 --
+int(0)
+int(0)
+-- Iteration 16 --
+int(0)
+int(0)
+-- Iteration 17 --
+int(0)
+int(0)
+-- Iteration 18 --
+int(0)
+int(0)
+-- Iteration 19 --
+int(0)
+int(0)
+-- Iteration 20 --
+int(0)
+int(0)
+-- Iteration 21 --
+int(0)
+int(0)
+-- Iteration 22 --
+int(0)
+int(0)
+-- Iteration 23 --
+int(0)
+int(0)
+-- Iteration 24 --
+int(0)
+int(0)
+-- Iteration 25 --
+int(0)
+int(0)
+-- Iteration 26 --
+int(0)
+int(0)
+-- Iteration 27 --
+int(0)
+int(0)
+-- Iteration 28 --
+int(0)
+int(0)
+-- Iteration 29 --
+int(0)
+int(0)
+-- Iteration 30 --
+int(0)
+int(0)
+-- Iteration 31 --
+int(0)
+int(0)
+-- Iteration 32 --
+int(0)
+int(0)
+-- Iteration 33 --
+int(0)
+int(0)
+-- Iteration 34 --
+int(0)
+int(0)
+-- Iteration 35 --
+int(0)
+int(0)
+-- Iteration 36 --
+int(0)
+int(0)
+-- Iteration 37 --
+int(0)
+int(0)
+-- Iteration 38 --
+int(0)
+int(0)
+-- Iteration 39 --
+int(0)
+int(0)
+-- Iteration 40 --
+int(0)
+int(0)
+-- Iteration 41 --
+int(0)
+int(0)
+-- Iteration 42 --
+int(0)
+int(0)
+-- Iteration 43 --
+int(0)
+int(0)
+-- Iteration 44 --
+int(0)
+int(0)
+-- Iteration 45 --
+int(0)
+int(0)
+-- Iteration 46 --
+int(0)
+int(0)
+-- Iteration 47 --
+int(0)
+int(0)
+-- Iteration 48 --
+int(0)
+int(0)
+-- Iteration 49 --
+int(0)
+int(0)
+-- Iteration 50 --
+int(0)
+int(0)
+-- Iteration 51 --
+int(0)
+int(0)
+-- Iteration 52 --
+int(0)
+int(0)
+-- Iteration 53 --
+int(0)
+int(0)
+-- Iteration 54 --
+int(0)
+int(0)
+-- Iteration 55 --
+int(0)
+int(0)
+-- Iteration 56 --
+int(0)
+int(0)
+-- Iteration 57 --
+int(0)
+int(0)
+-- Iteration 58 --
+int(0)
+int(0)
+-- Iteration 59 --
+int(0)
+int(0)
+-- Iteration 60 --
+int(0)
+int(0)
+-- Iteration 61 --
+int(0)
+int(0)
+-- Iteration 62 --
+int(0)
+int(0)
+-- Iteration 63 --
+int(0)
+int(0)
+-- Iteration 64 --
+int(0)
+int(0)
+-- Iteration 65 --
+int(0)
+int(0)
+-- Iteration 66 --
+int(0)
+int(0)
+-- Iteration 67 --
+int(0)
+int(0)
+-- Iteration 68 --
+int(0)
+int(0)
+-- Iteration 69 --
+int(0)
+int(0)
+-- Iteration 70 --
+int(0)
+int(0)
+-- Iteration 71 --
+int(0)
+int(0)
+-- Iteration 72 --
+int(0)
+int(0)
+-- Iteration 73 --
+int(0)
+int(0)
+-- Iteration 74 --
+int(0)
+int(0)
+-- Iteration 75 --
+int(0)
+int(0)
+-- Iteration 76 --
+int(0)
+int(0)
+-- Iteration 77 --
+int(0)
+int(0)
+-- Iteration 78 --
+int(0)
+int(0)
+-- Iteration 79 --
+int(0)
+int(0)
+-- Iteration 80 --
+int(0)
+int(0)
+-- Iteration 81 --
+int(0)
+int(0)
+-- Iteration 82 --
+int(0)
+int(0)
+-- Iteration 83 --
+int(0)
+int(0)
+-- Iteration 84 --
+int(0)
+int(0)
+-- Iteration 85 --
+int(0)
+int(0)
+-- Iteration 86 --
+int(0)
+int(0)
+-- Iteration 87 --
+int(0)
+int(0)
+-- Iteration 88 --
+int(0)
+int(0)
+-- Iteration 89 --
+int(0)
+int(0)
+-- Iteration 90 --
+int(0)
+int(0)
+-- Iteration 91 --
+int(0)
+int(0)
+-- Iteration 92 --
+int(0)
+int(0)
+-- Iteration 93 --
+int(0)
+int(0)
+-- Iteration 94 --
+int(0)
+int(0)
+-- Iteration 95 --
+int(0)
+int(0)
+-- Iteration 96 --
+int(0)
+int(0)
+-- Iteration 97 --
+int(0)
+int(0)
+-- Iteration 98 --
+int(0)
+int(0)
+-- Iteration 99 --
+int(0)
+int(0)
+-- Iteration 100 --
+int(0)
+int(0)
+-- Iteration 101 --
+int(0)
+int(0)
+-- Iteration 102 --
+int(0)
+int(0)
+-- Iteration 103 --
+int(0)
+int(0)
+-- Iteration 104 --
+int(0)
+int(0)
+-- Iteration 105 --
+int(0)
+int(0)
+-- Iteration 106 --
+int(0)
+int(0)
+-- Iteration 107 --
+int(0)
+int(0)
+-- Iteration 108 --
+int(0)
+int(0)
+-- Iteration 109 --
+int(0)
+int(0)
+-- Iteration 110 --
+int(0)
+int(0)
+-- Iteration 111 --
+int(0)
+int(0)
+-- Iteration 112 --
+int(0)
+int(0)
+-- Iteration 113 --
+int(0)
+int(0)
+-- Iteration 114 --
+int(0)
+int(0)
+-- Iteration 115 --
+int(0)
+int(0)
+-- Iteration 116 --
+int(0)
+int(0)
+-- Iteration 117 --
+int(0)
+int(0)
+-- Iteration 118 --
+int(0)
+int(0)
+-- Iteration 119 --
+int(0)
+int(0)
+-- Iteration 120 --
+int(0)
+int(0)
+-- Iteration 121 --
+int(0)
+int(0)
+-- Iteration 122 --
+int(0)
+int(0)
+-- Iteration 123 --
+int(0)
+int(0)
+-- Iteration 124 --
+int(0)
+int(0)
+-- Iteration 125 --
+int(0)
+int(0)
+-- Iteration 126 --
+int(0)
+int(0)
+-- Iteration 127 --
+int(0)
+int(0)
+-- Iteration 128 --
+int(0)
+int(0)
+-- Iteration 129 --
+int(0)
+int(0)
+-- Iteration 130 --
+int(0)
+int(0)
+-- Iteration 131 --
+int(0)
+int(0)
+-- Iteration 132 --
+int(0)
+int(0)
+-- Iteration 133 --
+int(0)
+int(0)
+-- Iteration 134 --
+int(0)
+int(0)
+-- Iteration 135 --
+int(0)
+int(0)
+-- Iteration 136 --
+int(0)
+int(0)
+-- Iteration 137 --
+int(0)
+int(0)
+-- Iteration 138 --
+int(0)
+int(0)
+-- Iteration 139 --
+int(0)
+int(0)
+-- Iteration 140 --
+int(0)
+int(0)
+-- Iteration 141 --
+int(0)
+int(0)
+-- Iteration 142 --
+int(0)
+int(0)
+-- Iteration 143 --
+int(0)
+int(0)
+-- Iteration 144 --
+int(0)
+int(0)
+-- Iteration 145 --
+int(0)
+int(0)
+-- Iteration 146 --
+int(0)
+int(0)
+-- Iteration 147 --
+int(0)
+int(0)
+-- Iteration 148 --
+int(0)
+int(0)
+-- Iteration 149 --
+int(0)
+int(0)
+-- Iteration 150 --
+int(0)
+int(0)
+-- Iteration 151 --
+int(0)
+int(0)
+-- Iteration 152 --
+int(0)
+int(0)
+-- Iteration 153 --
+int(0)
+int(0)
+-- Iteration 154 --
+int(0)
+int(0)
+-- Iteration 155 --
+int(0)
+int(0)
+-- Iteration 156 --
+int(0)
+int(0)
+-- Iteration 157 --
+int(0)
+int(0)
+-- Iteration 158 --
+int(0)
+int(0)
+-- Iteration 159 --
+int(0)
+int(0)
+-- Iteration 160 --
+int(0)
+int(0)
+-- Iteration 161 --
+int(0)
+int(0)
+-- Iteration 162 --
+int(0)
+int(0)
+-- Iteration 163 --
+int(0)
+int(0)
+-- Iteration 164 --
+int(0)
+int(0)
+-- Iteration 165 --
+int(0)
+int(0)
+-- Iteration 166 --
+int(0)
+int(0)
+-- Iteration 167 --
+int(0)
+int(0)
+-- Iteration 168 --
+int(0)
+int(0)
+-- Iteration 169 --
+int(0)
+int(0)
+-- Iteration 170 --
+int(0)
+int(0)
+-- Iteration 171 --
+int(0)
+int(0)
+-- Iteration 172 --
+int(0)
+int(0)
+-- Iteration 173 --
+int(0)
+int(0)
+-- Iteration 174 --
+int(0)
+int(0)
+-- Iteration 175 --
+int(0)
+int(0)
+-- Iteration 176 --
+int(0)
+int(0)
+-- Iteration 177 --
+int(0)
+int(0)
+-- Iteration 178 --
+int(0)
+int(0)
+-- Iteration 179 --
+int(0)
+int(0)
+-- Iteration 180 --
+int(0)
+int(0)
+-- Iteration 181 --
+int(0)
+int(0)
+-- Iteration 182 --
+int(0)
+int(0)
+-- Iteration 183 --
+int(0)
+int(0)
+-- Iteration 184 --
+int(0)
+int(0)
+-- Iteration 185 --
+int(0)
+int(0)
+-- Iteration 186 --
+int(0)
+int(0)
+-- Iteration 187 --
+int(0)
+int(0)
+-- Iteration 188 --
+int(0)
+int(0)
+-- Iteration 189 --
+int(0)
+int(0)
+-- Iteration 190 --
+int(0)
+int(0)
+-- Iteration 191 --
+int(0)
+int(0)
+-- Iteration 192 --
+int(0)
+int(0)
+-- Iteration 193 --
+int(0)
+int(0)
+-- Iteration 194 --
+int(0)
+int(0)
+-- Iteration 195 --
+int(0)
+int(0)
+-- Iteration 196 --
+int(0)
+int(0)
+-- Iteration 197 --
+int(0)
+int(0)
+-- Iteration 198 --
+int(0)
+int(0)
+-- Iteration 199 --
+int(0)
+int(0)
+-- Iteration 200 --
+int(0)
+int(0)
+-- Iteration 201 --
+int(0)
+int(0)
+-- Iteration 202 --
+int(0)
+int(0)
+-- Iteration 203 --
+int(0)
+int(0)
+-- Iteration 204 --
+int(0)
+int(0)
+-- Iteration 205 --
+int(0)
+int(0)
+-- Iteration 206 --
+int(0)
+int(0)
+-- Iteration 207 --
+int(0)
+int(0)
+-- Iteration 208 --
+int(0)
+int(0)
+-- Iteration 209 --
+int(0)
+int(0)
+-- Iteration 210 --
+int(0)
+int(0)
+-- Iteration 211 --
+int(0)
+int(0)
+-- Iteration 212 --
+int(0)
+int(0)
+-- Iteration 213 --
+int(0)
+int(0)
+-- Iteration 214 --
+int(0)
+int(0)
+-- Iteration 215 --
+int(0)
+int(0)
+-- Iteration 216 --
+int(0)
+int(0)
+-- Iteration 217 --
+int(0)
+int(0)
+-- Iteration 218 --
+int(0)
+int(0)
+-- Iteration 219 --
+int(0)
+int(0)
+-- Iteration 220 --
+int(0)
+int(0)
+-- Iteration 221 --
+int(0)
+int(0)
+-- Iteration 222 --
+int(0)
+int(0)
+-- Iteration 223 --
+int(0)
+int(0)
+-- Iteration 224 --
+int(0)
+int(0)
+-- Iteration 225 --
+int(0)
+int(0)
+-- Iteration 226 --
+int(0)
+int(0)
+-- Iteration 227 --
+int(0)
+int(0)
+-- Iteration 228 --
+int(0)
+int(0)
+-- Iteration 229 --
+int(0)
+int(0)
+-- Iteration 230 --
+int(0)
+int(0)
+-- Iteration 231 --
+int(0)
+int(0)
+-- Iteration 232 --
+int(0)
+int(0)
+-- Iteration 233 --
+int(0)
+int(0)
+-- Iteration 234 --
+int(0)
+int(0)
+-- Iteration 235 --
+int(0)
+int(0)
+-- Iteration 236 --
+int(0)
+int(0)
+-- Iteration 237 --
+int(0)
+int(0)
+-- Iteration 238 --
+int(0)
+int(0)
+-- Iteration 239 --
+int(0)
+int(0)
+-- Iteration 240 --
+int(0)
+int(0)
+-- Iteration 241 --
+int(0)
+int(0)
+-- Iteration 242 --
+int(0)
+int(0)
+-- Iteration 243 --
+int(0)
+int(0)
+-- Iteration 244 --
+int(0)
+int(0)
+-- Iteration 245 --
+int(0)
+int(0)
+-- Iteration 246 --
+int(0)
+int(0)
+-- Iteration 247 --
+int(0)
+int(0)
+-- Iteration 248 --
+int(0)
+int(0)
+-- Iteration 249 --
+int(0)
+int(0)
+-- Iteration 250 --
+int(0)
+int(0)
+-- Iteration 251 --
+int(0)
+int(0)
+-- Iteration 252 --
+int(0)
+int(0)
+-- Iteration 253 --
+int(0)
+int(0)
+-- Iteration 254 --
+int(0)
+int(0)
+-- Iteration 255 --
+int(0)
+int(0)
+-- Iteration 256 --
+int(0)
+int(0)
+
+-- Checking with out of character's range, given in binary format --
+int(1)
+
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation7.phpt b/ext/standard/tests/strings/strncasecmp_variation7.phpt
new file mode 100644
index 000000000..e22fad765
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation7.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test strncasecmp() function : usage variations - binary safe
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with null terminated strings and binary values passed to 'str1' & 'str2' */
+
+echo "*** Test strncasecmp() function: with null terminated strings and binary inputs ***\n";
+
+/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
+$str1 = "Hello\0world";
+$str2 = "Hello\0";
+$str3 = "Hello,".chr(0)."world";
+var_dump( strncasecmp($str1, $str2, 12) );
+var_dump( strncasecmp($str3, "Hello,world", 12) );
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncasecmp() function: with null terminated strings and binary inputs ***
+int(5)
+int(-119)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncasecmp_variation8.phpt b/ext/standard/tests/strings/strncasecmp_variation8.phpt
new file mode 100644
index 000000000..6011a7b0f
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation8.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strncasecmp() function: usage variations - single quoted strings
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with various single quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncasecmp() function: with single quoted strings ***\n";
+$strings = array(
+ 'Hello, World',
+ 'hello, world',
+ 'HELLO, WORLD',
+ 'Hello, World\n'
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncasecmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--EXPECTREGEX--
+\*\*\* Test strncasecmp\(\) function: with single quoted strings \*\*\*
+-- Iteration 1 --
+int\(0\)
+int\(0\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+-- Iteration 2 --
+int\(0\)
+int\(0\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+-- Iteration 3 --
+int\(0\)
+int\(0\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+-- Iteration 4 --
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(0\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncasecmp_variation9.phpt b/ext/standard/tests/strings/strncasecmp_variation9.phpt
new file mode 100644
index 000000000..0d713032e
--- /dev/null
+++ b/ext/standard/tests/strings/strncasecmp_variation9.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test strncasecmp() function: usage variations - heredoc strings
+--FILE--
+<?php
+/* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-insensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncasecmp() function with here-doc strings for 'str1', 'str2' */
+
+echo "*** Test strncasecmp() function: with here-doc strings ***\n";
+
+/* multi line heredoc string */
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+/* identifier name contains underscore */
+$identifier_str1 = <<<identifier_str1
+Example of heredoc
+string, whose identifier
+having underscore("_")
+& numeric value.
+identifier_str1;
+
+/* identifier name starts with underscore */
+$identifier_str2 = <<<_identifier_str2
+Hello, World
+hello, world
+_identifier_str2;
+
+/* string containing control character */
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\0World
+EOD;
+
+/* heredoc string with quote chars & slash */
+$quote_char_string = <<<EOD
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOD;
+
+/* heredoc string with blank line */
+$blank_line = <<<EOD
+
+EOD;
+
+/* empty heredoc string */
+$empty_string = <<<EOD
+EOD;
+
+$strings = array(
+ $multi_line_str,
+ $identifier_str1,
+ $identifier_str2,
+ $control_char_str,
+ $quote_char_string,
+ $blank_line,
+ $empty_string
+);
+/* loop through to compare the strings */
+$index2 = count($strings);
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ $index2--;
+ var_dump( strncasecmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
+ var_dump( strncasecmp( $strings[$index1], $strings[$index2], strlen($strings[$index1]) ) );
+}
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncasecmp() function: with here-doc strings ***
+int(0)
+int(63)
+int(0)
+int(84)
+int(0)
+int(-1)
+int(0)
+int(0)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncmp_basic.phpt b/ext/standard/tests/strings/strncmp_basic.phpt
new file mode 100644
index 000000000..317039859
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test strncmp() function : basic functionality
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+echo "*** Testing strncmp() function: basic functionality ***\n";
+
+echo "-- Testing strncmp() with single quoted string --\n";
+var_dump( strncmp('Hello', 'Hello', 5) ); //expected: int(0)
+var_dump( strncmp('Hello', 'Hi', 5) ); //expected: value < 0
+var_dump( strncmp('Hi', 'Hello', 5) ); //expected: value > 0
+
+echo "-- Testing strncmp() with double quoted string --\n";
+var_dump( strncmp("Hello", "Hello", 5) ); //expected: int(0)
+var_dump( strncmp("Hello", "Hi", 5) ); //expected: value < 0
+var_dump( strncmp("Hi", "Hello", 5) ); //expected: value > 0
+
+echo "-- Testing strncmp() with here-doc string --\n";
+$str = <<<HEREDOC
+Hello
+HEREDOC;
+var_dump( strncmp($str, "Hello", 5) ); //expected: int(0)
+var_dump( strncmp($str, "Hi", 5) ); //expected: value < 0
+var_dump( strncmp("Hi", $str, 5) ); //expected: value > 0
+
+echo "*** Done ***";
+?>
+--EXPECTREGEX--
+\*\*\* Testing strncmp\(\) function: basic functionality \*\*\*
+-- Testing strncmp\(\) with single quoted string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Testing strncmp\(\) with double quoted string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Testing strncmp\(\) with here-doc string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt
new file mode 100644
index 000000000..317a90406
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test strncmp() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with more/less number of args and invalid args */
+
+echo "*** Testing strncmp() function: error conditions ***\n";
+$str1 = 'string_val';
+$str2 = 'string_val';
+$len = 10;
+$extra_arg = 10;
+
+var_dump( strncmp() ); //Zero argument
+var_dump( strncmp($str1) ); //One argument, less than expected no. of args
+var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args
+var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args
+
+/* Invalid argument for $len */
+$len = -10;
+var_dump( strncmp($str1, $str2, $len) );
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing strncmp() function: error conditions ***
+
+Warning: Wrong parameter count for strncmp() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for strncmp() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for strncmp() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for strncmp() in %s on line %d
+NULL
+
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncmp_variation1.phpt b/ext/standard/tests/strings/strncmp_variation1.phpt
new file mode 100644
index 000000000..2fc3c3d4c
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation1.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test strncmp() function: usage variations - case-sensitivity
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with upper-case and lower-case alphabets as inputs for 'str1' and 'str2' */
+
+echo "*** Test strncmp() function: with alphabets ***\n";
+echo "-- Passing upper-case letters for 'str1' --\n";
+for($ASCII = 65; $ASCII <= 90; $ASCII++) {
+ var_dump( strncmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase letters with uppercase letters; exp: int(0)
+ var_dump( strncmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing uppercase letters with lowercase letters; exp: value < 0
+}
+
+echo "\n-- Passing lower-case letters for 'str1' --\n";
+for($ASCII = 97; $ASCII <= 122; $ASCII++) {
+ var_dump( strncmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase letters with lowercase letters; exp: int(0)
+ var_dump( strncmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing lowercase letters with uppercase letters; exp: value > 0
+}
+echo "*** Done ***";
+?>
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with alphabets \*\*\*
+-- Passing upper-case letters for 'str1' --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+
+-- Passing lower-case letters for 'str1' --
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncmp_variation2.phpt b/ext/standard/tests/strings/strncmp_variation2.phpt
new file mode 100644
index 000000000..3c7452241
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation2.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test strncmp() function: usage variations - double quoted strings
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with double quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncmp() function: with double quoted strings ***\n";
+$strings = array(
+ "Hello, World",
+ "hello, world",
+ "HELLO, WORLD",
+ "Hello, World\n",
+ "Hello".chr(0)."World"
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with double quoted strings \*\*\*
+-- Iteration 1 --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Iteration 2 --
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Iteration 3 --
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+-- Iteration 4 --
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+-- Iteration 5 --
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncmp_variation3.phpt b/ext/standard/tests/strings/strncmp_variation3.phpt
new file mode 100644
index 000000000..6a703c705
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation3.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test strncmp() function: usage variations - different lengths
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() with various lengths */
+
+echo "*** Test strncmp() function: with different lengths ***\n";
+/* definitions of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, world\n";
+
+/* loop through to compare the strings, for various length values */
+for($len = strlen($str1); $len >= 0; $len--) {
+ var_dump( strncmp($str1, $str2, $len) );
+}
+echo "*** Done ***\n";
+?>
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with different lengths \*\*\*
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncmp_variation4.phpt b/ext/standard/tests/strings/strncmp_variation4.phpt
new file mode 100644
index 000000000..2af95e9b4
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation4.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test strncmp() function : usage variations - different inputs(all types)
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with the input strings are of all types */
+
+echo "*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' ***\n";
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$values = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ /* float values */
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+ -0x12,
+
+ /* octal values */
+ 012,
+ -012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ /* boolean values */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* nulls */
+ NULL,
+ null,
+
+ /* empty string */
+ "",
+ '',
+
+ /* undefined variable */
+ $undefined_var,
+
+ /* unset variable */
+ $unset_var,
+
+ /* resource */
+ $file_handle,
+
+ /* object */
+ new sample()
+);
+
+/* loop through each element of the array and check the working of strncmp() */
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str1 = $values[$index];
+ $str2 = $values[$index];
+ $len = strlen($values[$index]) + 1;
+ var_dump( strncmp($str1, $str2, $len) );
+ $counter ++;
+}
+fclose($file_handle);
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(0)
+-- Iteration 3 --
+int(0)
+-- Iteration 4 --
+int(0)
+-- Iteration 5 --
+int(0)
+-- Iteration 6 --
+int(0)
+-- Iteration 7 --
+int(0)
+-- Iteration 8 --
+int(0)
+-- Iteration 9 --
+int(0)
+-- Iteration 10 --
+int(0)
+-- Iteration 11 --
+int(0)
+-- Iteration 12 --
+int(0)
+-- Iteration 13 --
+int(0)
+-- Iteration 14 --
+int(0)
+-- Iteration 15 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 16 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 17 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+-- Iteration 20 --
+int(0)
+-- Iteration 21 --
+int(0)
+-- Iteration 22 --
+int(0)
+-- Iteration 23 --
+int(0)
+-- Iteration 24 --
+int(0)
+-- Iteration 25 --
+int(0)
+-- Iteration 26 --
+int(0)
+-- Iteration 27 --
+int(0)
+-- Iteration 28 --
+int(0)
+-- Iteration 29 --
+int(0)
+-- Iteration 30 --
+int(0)
+-- Iteration 31 --
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncmp_variation5.phpt b/ext/standard/tests/strings/strncmp_variation5.phpt
new file mode 100644
index 000000000..cdb3afca1
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation5.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test strncmp() function : usage variations - different lengths(all types)
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with the length as all types, and giving the same strings for 'str1' and 'str2' */
+
+echo "*** Test strncmp() function: by supplying all types for 'len' ***\n";
+
+/* definition of required variables */
+$str1 = "Hello, World\n";
+$str2 = "Hello, World\n";
+
+/* get an unset variable */
+$unset_var = 'string_val';
+unset($unset_var);
+
+/* get resource handle */
+$file_handle = fopen(__FILE__, "r");
+
+/* declaring a class */
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+
+/* array with different values */
+$lengths = array (
+ /* integer values */
+ 0,
+ 1,
+ 12345,
+
+ /* float values */
+ 10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ /* hexadecimal values */
+ 0x12,
+
+ /* octal values */
+ 012,
+ 01.2,
+
+ /* array values */
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ /* boolean values */
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ /* nulls */
+ NULL,
+ null,
+
+ /* empty string */
+ "",
+ '',
+
+ /* undefined variable */
+ $undefined_var,
+
+ /* unset variable */
+ $unset_var,
+
+ /* resource */
+ $file_handle,
+
+ /* object */
+ new sample()
+);
+
+/* loop through each element of the array and check the working of strncmp() */
+$counter = 1;
+for($index = 0; $index < count($lengths); $index ++) {
+ $len = $lengths[$index];
+ echo "-- Iteration $counter --\n";
+ var_dump( strncmp($str1, $str2, $len) );
+ $counter ++;
+}
+fclose($file_handle);
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncmp() function: by supplying all types for 'len' ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+-- Iteration 1 --
+int(0)
+-- Iteration 2 --
+int(0)
+-- Iteration 3 --
+int(0)
+-- Iteration 4 --
+int(0)
+-- Iteration 5 --
+int(0)
+-- Iteration 6 --
+int(0)
+-- Iteration 7 --
+int(0)
+-- Iteration 8 --
+int(0)
+-- Iteration 9 --
+int(0)
+-- Iteration 10 --
+int(0)
+-- Iteration 11 --
+int(0)
+-- Iteration 12 --
+int(0)
+-- Iteration 13 --
+int(0)
+-- Iteration 14 --
+int(0)
+-- Iteration 15 --
+int(0)
+-- Iteration 16 --
+int(0)
+-- Iteration 17 --
+int(0)
+-- Iteration 18 --
+int(0)
+-- Iteration 19 --
+int(0)
+-- Iteration 20 --
+int(0)
+-- Iteration 21 --
+int(0)
+-- Iteration 22 --
+int(0)
+-- Iteration 23 --
+int(0)
+-- Iteration 24 --
+int(0)
+-- Iteration 25 --
+int(0)
+-- Iteration 26 --
+int(0)
+-- Iteration 27 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncmp_variation6.phpt b/ext/standard/tests/strings/strncmp_variation6.phpt
new file mode 100644
index 000000000..7a79d29a5
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation6.phpt
@@ -0,0 +1,811 @@
+--TEST--
+Test strncmp() function : usage variations - binary safe(binary values)
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */
+
+echo "*** Test strncmp() function: with binary inputs ***\n";
+
+echo "\n-- Checking with all 256 characters given, in binary format --\n";
+/* A binary function should work with all 256 characters that a character(8-bit) can take */
+/* loop through to get all 256 character's equivelent binary value, and check working of strncmp() */
+$count = 1;
+for($ASCII = 0; $ASCII <= 255; $ASCII++) {
+ $str1 = decbin($ASCII); //ASCII value in binary form
+ $str2 = decbin( ord( chr($ASCII) ) ); //Getting equivelent ASCII value for the character in binary form
+ echo "-- Iteration $count --\n";
+ var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(0)
+ var_dump( strncmp($str1, $str2, 4) ); //comparing only 4-bits; expected: int(0)
+ $count++;
+}
+
+echo "\n-- Checking with out of character's range, given in binary format --\n";
+/* Checking with the out of range ASCII value(given in binary format) */
+$str1 = decbin(256);
+$str2 = decbin( ord( chr(256) ));
+var_dump( strncmp($str1, $str2, 8) ); //comparing all the 8-bits; expected: int(1)
+
+echo "\n*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncmp() function: with binary inputs ***
+
+-- Checking with all 256 characters given, in binary format --
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(0)
+int(0)
+-- Iteration 3 --
+int(0)
+int(0)
+-- Iteration 4 --
+int(0)
+int(0)
+-- Iteration 5 --
+int(0)
+int(0)
+-- Iteration 6 --
+int(0)
+int(0)
+-- Iteration 7 --
+int(0)
+int(0)
+-- Iteration 8 --
+int(0)
+int(0)
+-- Iteration 9 --
+int(0)
+int(0)
+-- Iteration 10 --
+int(0)
+int(0)
+-- Iteration 11 --
+int(0)
+int(0)
+-- Iteration 12 --
+int(0)
+int(0)
+-- Iteration 13 --
+int(0)
+int(0)
+-- Iteration 14 --
+int(0)
+int(0)
+-- Iteration 15 --
+int(0)
+int(0)
+-- Iteration 16 --
+int(0)
+int(0)
+-- Iteration 17 --
+int(0)
+int(0)
+-- Iteration 18 --
+int(0)
+int(0)
+-- Iteration 19 --
+int(0)
+int(0)
+-- Iteration 20 --
+int(0)
+int(0)
+-- Iteration 21 --
+int(0)
+int(0)
+-- Iteration 22 --
+int(0)
+int(0)
+-- Iteration 23 --
+int(0)
+int(0)
+-- Iteration 24 --
+int(0)
+int(0)
+-- Iteration 25 --
+int(0)
+int(0)
+-- Iteration 26 --
+int(0)
+int(0)
+-- Iteration 27 --
+int(0)
+int(0)
+-- Iteration 28 --
+int(0)
+int(0)
+-- Iteration 29 --
+int(0)
+int(0)
+-- Iteration 30 --
+int(0)
+int(0)
+-- Iteration 31 --
+int(0)
+int(0)
+-- Iteration 32 --
+int(0)
+int(0)
+-- Iteration 33 --
+int(0)
+int(0)
+-- Iteration 34 --
+int(0)
+int(0)
+-- Iteration 35 --
+int(0)
+int(0)
+-- Iteration 36 --
+int(0)
+int(0)
+-- Iteration 37 --
+int(0)
+int(0)
+-- Iteration 38 --
+int(0)
+int(0)
+-- Iteration 39 --
+int(0)
+int(0)
+-- Iteration 40 --
+int(0)
+int(0)
+-- Iteration 41 --
+int(0)
+int(0)
+-- Iteration 42 --
+int(0)
+int(0)
+-- Iteration 43 --
+int(0)
+int(0)
+-- Iteration 44 --
+int(0)
+int(0)
+-- Iteration 45 --
+int(0)
+int(0)
+-- Iteration 46 --
+int(0)
+int(0)
+-- Iteration 47 --
+int(0)
+int(0)
+-- Iteration 48 --
+int(0)
+int(0)
+-- Iteration 49 --
+int(0)
+int(0)
+-- Iteration 50 --
+int(0)
+int(0)
+-- Iteration 51 --
+int(0)
+int(0)
+-- Iteration 52 --
+int(0)
+int(0)
+-- Iteration 53 --
+int(0)
+int(0)
+-- Iteration 54 --
+int(0)
+int(0)
+-- Iteration 55 --
+int(0)
+int(0)
+-- Iteration 56 --
+int(0)
+int(0)
+-- Iteration 57 --
+int(0)
+int(0)
+-- Iteration 58 --
+int(0)
+int(0)
+-- Iteration 59 --
+int(0)
+int(0)
+-- Iteration 60 --
+int(0)
+int(0)
+-- Iteration 61 --
+int(0)
+int(0)
+-- Iteration 62 --
+int(0)
+int(0)
+-- Iteration 63 --
+int(0)
+int(0)
+-- Iteration 64 --
+int(0)
+int(0)
+-- Iteration 65 --
+int(0)
+int(0)
+-- Iteration 66 --
+int(0)
+int(0)
+-- Iteration 67 --
+int(0)
+int(0)
+-- Iteration 68 --
+int(0)
+int(0)
+-- Iteration 69 --
+int(0)
+int(0)
+-- Iteration 70 --
+int(0)
+int(0)
+-- Iteration 71 --
+int(0)
+int(0)
+-- Iteration 72 --
+int(0)
+int(0)
+-- Iteration 73 --
+int(0)
+int(0)
+-- Iteration 74 --
+int(0)
+int(0)
+-- Iteration 75 --
+int(0)
+int(0)
+-- Iteration 76 --
+int(0)
+int(0)
+-- Iteration 77 --
+int(0)
+int(0)
+-- Iteration 78 --
+int(0)
+int(0)
+-- Iteration 79 --
+int(0)
+int(0)
+-- Iteration 80 --
+int(0)
+int(0)
+-- Iteration 81 --
+int(0)
+int(0)
+-- Iteration 82 --
+int(0)
+int(0)
+-- Iteration 83 --
+int(0)
+int(0)
+-- Iteration 84 --
+int(0)
+int(0)
+-- Iteration 85 --
+int(0)
+int(0)
+-- Iteration 86 --
+int(0)
+int(0)
+-- Iteration 87 --
+int(0)
+int(0)
+-- Iteration 88 --
+int(0)
+int(0)
+-- Iteration 89 --
+int(0)
+int(0)
+-- Iteration 90 --
+int(0)
+int(0)
+-- Iteration 91 --
+int(0)
+int(0)
+-- Iteration 92 --
+int(0)
+int(0)
+-- Iteration 93 --
+int(0)
+int(0)
+-- Iteration 94 --
+int(0)
+int(0)
+-- Iteration 95 --
+int(0)
+int(0)
+-- Iteration 96 --
+int(0)
+int(0)
+-- Iteration 97 --
+int(0)
+int(0)
+-- Iteration 98 --
+int(0)
+int(0)
+-- Iteration 99 --
+int(0)
+int(0)
+-- Iteration 100 --
+int(0)
+int(0)
+-- Iteration 101 --
+int(0)
+int(0)
+-- Iteration 102 --
+int(0)
+int(0)
+-- Iteration 103 --
+int(0)
+int(0)
+-- Iteration 104 --
+int(0)
+int(0)
+-- Iteration 105 --
+int(0)
+int(0)
+-- Iteration 106 --
+int(0)
+int(0)
+-- Iteration 107 --
+int(0)
+int(0)
+-- Iteration 108 --
+int(0)
+int(0)
+-- Iteration 109 --
+int(0)
+int(0)
+-- Iteration 110 --
+int(0)
+int(0)
+-- Iteration 111 --
+int(0)
+int(0)
+-- Iteration 112 --
+int(0)
+int(0)
+-- Iteration 113 --
+int(0)
+int(0)
+-- Iteration 114 --
+int(0)
+int(0)
+-- Iteration 115 --
+int(0)
+int(0)
+-- Iteration 116 --
+int(0)
+int(0)
+-- Iteration 117 --
+int(0)
+int(0)
+-- Iteration 118 --
+int(0)
+int(0)
+-- Iteration 119 --
+int(0)
+int(0)
+-- Iteration 120 --
+int(0)
+int(0)
+-- Iteration 121 --
+int(0)
+int(0)
+-- Iteration 122 --
+int(0)
+int(0)
+-- Iteration 123 --
+int(0)
+int(0)
+-- Iteration 124 --
+int(0)
+int(0)
+-- Iteration 125 --
+int(0)
+int(0)
+-- Iteration 126 --
+int(0)
+int(0)
+-- Iteration 127 --
+int(0)
+int(0)
+-- Iteration 128 --
+int(0)
+int(0)
+-- Iteration 129 --
+int(0)
+int(0)
+-- Iteration 130 --
+int(0)
+int(0)
+-- Iteration 131 --
+int(0)
+int(0)
+-- Iteration 132 --
+int(0)
+int(0)
+-- Iteration 133 --
+int(0)
+int(0)
+-- Iteration 134 --
+int(0)
+int(0)
+-- Iteration 135 --
+int(0)
+int(0)
+-- Iteration 136 --
+int(0)
+int(0)
+-- Iteration 137 --
+int(0)
+int(0)
+-- Iteration 138 --
+int(0)
+int(0)
+-- Iteration 139 --
+int(0)
+int(0)
+-- Iteration 140 --
+int(0)
+int(0)
+-- Iteration 141 --
+int(0)
+int(0)
+-- Iteration 142 --
+int(0)
+int(0)
+-- Iteration 143 --
+int(0)
+int(0)
+-- Iteration 144 --
+int(0)
+int(0)
+-- Iteration 145 --
+int(0)
+int(0)
+-- Iteration 146 --
+int(0)
+int(0)
+-- Iteration 147 --
+int(0)
+int(0)
+-- Iteration 148 --
+int(0)
+int(0)
+-- Iteration 149 --
+int(0)
+int(0)
+-- Iteration 150 --
+int(0)
+int(0)
+-- Iteration 151 --
+int(0)
+int(0)
+-- Iteration 152 --
+int(0)
+int(0)
+-- Iteration 153 --
+int(0)
+int(0)
+-- Iteration 154 --
+int(0)
+int(0)
+-- Iteration 155 --
+int(0)
+int(0)
+-- Iteration 156 --
+int(0)
+int(0)
+-- Iteration 157 --
+int(0)
+int(0)
+-- Iteration 158 --
+int(0)
+int(0)
+-- Iteration 159 --
+int(0)
+int(0)
+-- Iteration 160 --
+int(0)
+int(0)
+-- Iteration 161 --
+int(0)
+int(0)
+-- Iteration 162 --
+int(0)
+int(0)
+-- Iteration 163 --
+int(0)
+int(0)
+-- Iteration 164 --
+int(0)
+int(0)
+-- Iteration 165 --
+int(0)
+int(0)
+-- Iteration 166 --
+int(0)
+int(0)
+-- Iteration 167 --
+int(0)
+int(0)
+-- Iteration 168 --
+int(0)
+int(0)
+-- Iteration 169 --
+int(0)
+int(0)
+-- Iteration 170 --
+int(0)
+int(0)
+-- Iteration 171 --
+int(0)
+int(0)
+-- Iteration 172 --
+int(0)
+int(0)
+-- Iteration 173 --
+int(0)
+int(0)
+-- Iteration 174 --
+int(0)
+int(0)
+-- Iteration 175 --
+int(0)
+int(0)
+-- Iteration 176 --
+int(0)
+int(0)
+-- Iteration 177 --
+int(0)
+int(0)
+-- Iteration 178 --
+int(0)
+int(0)
+-- Iteration 179 --
+int(0)
+int(0)
+-- Iteration 180 --
+int(0)
+int(0)
+-- Iteration 181 --
+int(0)
+int(0)
+-- Iteration 182 --
+int(0)
+int(0)
+-- Iteration 183 --
+int(0)
+int(0)
+-- Iteration 184 --
+int(0)
+int(0)
+-- Iteration 185 --
+int(0)
+int(0)
+-- Iteration 186 --
+int(0)
+int(0)
+-- Iteration 187 --
+int(0)
+int(0)
+-- Iteration 188 --
+int(0)
+int(0)
+-- Iteration 189 --
+int(0)
+int(0)
+-- Iteration 190 --
+int(0)
+int(0)
+-- Iteration 191 --
+int(0)
+int(0)
+-- Iteration 192 --
+int(0)
+int(0)
+-- Iteration 193 --
+int(0)
+int(0)
+-- Iteration 194 --
+int(0)
+int(0)
+-- Iteration 195 --
+int(0)
+int(0)
+-- Iteration 196 --
+int(0)
+int(0)
+-- Iteration 197 --
+int(0)
+int(0)
+-- Iteration 198 --
+int(0)
+int(0)
+-- Iteration 199 --
+int(0)
+int(0)
+-- Iteration 200 --
+int(0)
+int(0)
+-- Iteration 201 --
+int(0)
+int(0)
+-- Iteration 202 --
+int(0)
+int(0)
+-- Iteration 203 --
+int(0)
+int(0)
+-- Iteration 204 --
+int(0)
+int(0)
+-- Iteration 205 --
+int(0)
+int(0)
+-- Iteration 206 --
+int(0)
+int(0)
+-- Iteration 207 --
+int(0)
+int(0)
+-- Iteration 208 --
+int(0)
+int(0)
+-- Iteration 209 --
+int(0)
+int(0)
+-- Iteration 210 --
+int(0)
+int(0)
+-- Iteration 211 --
+int(0)
+int(0)
+-- Iteration 212 --
+int(0)
+int(0)
+-- Iteration 213 --
+int(0)
+int(0)
+-- Iteration 214 --
+int(0)
+int(0)
+-- Iteration 215 --
+int(0)
+int(0)
+-- Iteration 216 --
+int(0)
+int(0)
+-- Iteration 217 --
+int(0)
+int(0)
+-- Iteration 218 --
+int(0)
+int(0)
+-- Iteration 219 --
+int(0)
+int(0)
+-- Iteration 220 --
+int(0)
+int(0)
+-- Iteration 221 --
+int(0)
+int(0)
+-- Iteration 222 --
+int(0)
+int(0)
+-- Iteration 223 --
+int(0)
+int(0)
+-- Iteration 224 --
+int(0)
+int(0)
+-- Iteration 225 --
+int(0)
+int(0)
+-- Iteration 226 --
+int(0)
+int(0)
+-- Iteration 227 --
+int(0)
+int(0)
+-- Iteration 228 --
+int(0)
+int(0)
+-- Iteration 229 --
+int(0)
+int(0)
+-- Iteration 230 --
+int(0)
+int(0)
+-- Iteration 231 --
+int(0)
+int(0)
+-- Iteration 232 --
+int(0)
+int(0)
+-- Iteration 233 --
+int(0)
+int(0)
+-- Iteration 234 --
+int(0)
+int(0)
+-- Iteration 235 --
+int(0)
+int(0)
+-- Iteration 236 --
+int(0)
+int(0)
+-- Iteration 237 --
+int(0)
+int(0)
+-- Iteration 238 --
+int(0)
+int(0)
+-- Iteration 239 --
+int(0)
+int(0)
+-- Iteration 240 --
+int(0)
+int(0)
+-- Iteration 241 --
+int(0)
+int(0)
+-- Iteration 242 --
+int(0)
+int(0)
+-- Iteration 243 --
+int(0)
+int(0)
+-- Iteration 244 --
+int(0)
+int(0)
+-- Iteration 245 --
+int(0)
+int(0)
+-- Iteration 246 --
+int(0)
+int(0)
+-- Iteration 247 --
+int(0)
+int(0)
+-- Iteration 248 --
+int(0)
+int(0)
+-- Iteration 249 --
+int(0)
+int(0)
+-- Iteration 250 --
+int(0)
+int(0)
+-- Iteration 251 --
+int(0)
+int(0)
+-- Iteration 252 --
+int(0)
+int(0)
+-- Iteration 253 --
+int(0)
+int(0)
+-- Iteration 254 --
+int(0)
+int(0)
+-- Iteration 255 --
+int(0)
+int(0)
+-- Iteration 256 --
+int(0)
+int(0)
+
+-- Checking with out of character's range, given in binary format --
+int(1)
+
+*** Done ***
diff --git a/ext/standard/tests/strings/strncmp_variation7.phpt b/ext/standard/tests/strings/strncmp_variation7.phpt
new file mode 100644
index 000000000..35d11d981
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation7.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test strncmp() function : usage variations - binary safe(null terminated strings)
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */
+
+echo "*** Test strncmp() function: Checking with the null terminated strings ***\n";
+
+/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
+$str1 = "Hello\0world";
+$str2 = "Hello\0";
+var_dump( strncmp($str1, $str2, 12) ); //expected: int(5);
+
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncmp() function: Checking with the null terminated strings ***
+int(5)
+*** Done ***
diff --git a/ext/standard/tests/strings/strncmp_variation8.phpt b/ext/standard/tests/strings/strncmp_variation8.phpt
new file mode 100644
index 000000000..bc000d171
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation8.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test strncmp() function: usage variations - single quoted strings
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with single quoted strings for 'str1', 'str2' */
+
+echo "*** Test strncmp() function: with single quoted strings ***\n";
+$strings = array(
+ 'Hello, World',
+ 'hello, world',
+ 'HELLO, WORLD',
+ 'Hello, World\n'
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ echo "-- Iteration $count --\n";
+ for($index2 = 0; $index2 < count($strings); $index2++) {
+ var_dump( strncmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
+ }
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with single quoted strings \*\*\*
+-- Iteration 1 --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+-- Iteration 2 --
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Iteration 3 --
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+-- Iteration 4 --
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(0\)
+\*\*\* Done \*\*\*
diff --git a/ext/standard/tests/strings/strncmp_variation9.phpt b/ext/standard/tests/strings/strncmp_variation9.phpt
new file mode 100644
index 000000000..282f24184
--- /dev/null
+++ b/ext/standard/tests/strings/strncmp_variation9.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test strncmp() function: usage variations - different inputs(heredoc strings)
+--FILE--
+<?php
+/* Prototype : int strncmp ( string $str1, string $str2, int $len );
+ * Description: Binary safe case-sensitive string comparison of the first n characters
+ * Source code: Zend/zend_builtin_functions.c
+*/
+
+/* Test strncmp() function with different strings for 'str1', 'str2' and considering case sensitive */
+
+echo "*** Test strncmp() function: with different input strings ***\n";
+
+/* heredoc string */
+$str1 = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+/* identifier name contains underscore */
+$str2 = <<<identifier_str2
+Example of heredoc
+string, whose identifier
+having underscore("_")
+& numeric value.
+identifier_str2;
+
+/* identifier name starts with underscore */
+$str3 = <<<_identifier_str3
+Hello, World
+hello, world
+_identifier_str3;
+
+/* string containing control characters */
+$str4 = <<<identifier_str4
+Hello, World\n
+Hello\0World
+identifier_str4;
+
+$strings = array(
+ $str1,
+ $str2,
+ $str3,
+ $str4
+);
+/* loop through to compare each string with the other string */
+$count = 1;
+for($index1 = 0; $index1 < count($strings); $index1++) {
+ var_dump( strncmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
+ $count ++;
+}
+echo "*** Done ***\n";
+?>
+--EXPECTF--
+*** Test strncmp() function: with different input strings ***
+int(0)
+int(0)
+int(0)
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index 83dd20a59..e64468135 100644
--- a/ext/standard/tests/strings/strpos.phpt
+++ b/ext/standard/tests/strings/strpos.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_basic.phpt b/ext/standard/tests/strings/strrchr_basic.phpt
new file mode 100644
index 000000000..f39683483
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_basic.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test strrchr() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrchr() function: basic functionality ***\n";
+var_dump( strrchr("Hello, World", "H") ); //needle as single char
+var_dump( strrchr("Hello, World", "Hello") ); //needle as a first word of haystack
+var_dump( strrchr('Hello, World', 'H') );
+var_dump( strrchr('Hello, World', 'Hello') );
+
+//considering case
+var_dump( strrchr("Hello, World", "h") );
+var_dump( strrchr("Hello, World", "hello") );
+
+//needle as second word of haystack
+var_dump( strrchr("Hello, World", "World") );
+var_dump( strrchr('Hello, World', 'World') );
+
+//needle as special char
+var_dump( strrchr("Hello, World", ",") );
+var_dump( strrchr('Hello, World', ',') );
+
+var_dump( strrchr("Hello, World", "Hello, World") ); //needle as haystack
+
+//needle string containing one existing and one non-existing char
+var_dump( strrchr("Hello, World", "Hi") );
+
+//multiple existance of needle in haystack
+var_dump( strrchr("Hello, World", "o") );
+var_dump( strrchr("Hello, World", "ooo") );
+
+var_dump( strrchr("Hello, World", "Zzzz") ); //non-existant needle in haystack
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: basic functionality ***
+string(12) "Hello, World"
+string(12) "Hello, World"
+string(12) "Hello, World"
+string(12) "Hello, World"
+bool(false)
+bool(false)
+string(5) "World"
+string(5) "World"
+string(7) ", World"
+string(7) ", World"
+string(12) "Hello, World"
+string(12) "Hello, World"
+string(4) "orld"
+string(4) "orld"
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_error.phpt b/ext/standard/tests/strings/strrchr_error.phpt
new file mode 100644
index 000000000..8c2881aa5
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test strrchr() function : error conditions
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrchr() function: error conditions ***\n";
+$haystack = "Hello";
+$needle = "Hello";
+$extra_arg = "Hello";
+
+echo "\n-- Testing strrchr() function with Zero arguments --";
+var_dump( strrchr() );
+
+echo "\n-- Testing strrchr() function with less than expected no. of arguments --";
+var_dump( strrchr($haystack) );
+
+echo "\n-- Testing strrchr() function with more than expected no. of arguments --";
+var_dump( strrchr($haystack, $needle, $extra_arg) );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: error conditions ***
+
+-- Testing strrchr() function with Zero arguments --
+Warning: Wrong parameter count for strrchr() in %s on line %d
+NULL
+
+-- Testing strrchr() function with less than expected no. of arguments --
+Warning: Wrong parameter count for strrchr() in %s on line %d
+NULL
+
+-- Testing strrchr() function with more than expected no. of arguments --
+Warning: Wrong parameter count for strrchr() in %s on line %d
+NULL
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt
new file mode 100644
index 000000000..91290ecf9
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt
new file mode 100644
index 000000000..5de3b22ff
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation10.phpt
@@ -0,0 +1,188 @@
+--TEST--
+Test strrchr() function : usage variations - unexpected inputs for needle
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function: with unexpected inputs for needle
+ * and expected type for haystack
+*/
+
+echo "*** Testing strrchr() function with unexpected inputs for needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+$haystacks = array (
+ //integer numeric strings
+ "0",
+ "1",
+ "2",
+ "-2",
+
+ //float numeric strings
+ "10.5",
+ "-10.5",
+ "10.5e10",
+ "10.6E-10",
+ ".5",
+
+ //regular strings
+ "array",
+ "a",
+ "r",
+ "y",
+ "ay",
+ "true",
+ "false",
+ "TRUE",
+ "FALSE",
+ "NULL",
+ "null",
+ "object",
+
+ //empty string
+ "",
+ '',
+
+ //resource variable in string form
+ "\$file_handle",
+
+ //undefined variable in string form
+ @"$undefined_var",
+ @"$unset_var"
+);
+
+// array with different values
+$needles = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through each element of the array and check the working of strrchr()
+$count = 1;
+for($index = 0; $index < count($haystacks); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrchr($haystacks[$index], $needles[$index]) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function with unexpected inputs for needle ***
+-- 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 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt
new file mode 100644
index 000000000..d04710d7d
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation11.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test strrchr() function : usage variations - unexpected inputs for haystack and needle
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function with unexpected inputs for haystack and needle */
+
+echo "*** Testing strrchr() function: with unexpected inputs for haystack and needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of strrchr()
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $haystack = $values[$index];
+
+ var_dump( strrchr($values[$index], $values[$index]) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with unexpected inputs for haystack and needle ***
+-- 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 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+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)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt
new file mode 100644
index 000000000..c31e0c86c
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation12.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt
new file mode 100644
index 000000000..0b15ceeeb
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation2.phpt
@@ -0,0 +1,220 @@
+--TEST--
+Test strrchr() function : usage variations - single quoted strings
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing various single quoted strings to 'haystack' & 'needle' */
+
+echo "*** Testing strrchr() function: with various single quoted strings ***";
+$haystack = 'Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 ';
+$needle = array(
+ //regular strings
+ 'l',
+ 'L',
+ 'HELLO',
+ 'hEllo',
+
+ //escape characters
+ '\t',
+ '\T',
+ ' ',
+ '\n',
+ '\N',
+ '
+', //new line
+
+ //nulls
+ '\0',
+ NULL,
+ null,
+
+ //boolean false
+ FALSE,
+ false,
+
+ //empty string
+ '',
+
+ //special chars
+ ' ',
+ '$',
+ ' $',
+ '&',
+ '!#',
+ '%\o',
+ '\o,',
+ '()',
+ '*+',
+ '+',
+ '-',
+ '.',
+ '.;',
+ ':;',
+ ';',
+ '<=>',
+ '>',
+ '=>',
+ '?',
+ '@',
+ '@hEllo',
+
+ '12345', //decimal numeric string
+ '\x23', //hexadecimal numeric string
+ '#', //hexadecimal numeric string
+ '\101', //octal numeric string
+ 'A',
+ '456HEE', //numerics + chars
+ 42, //needle as int(ASCII value of '*')
+ $haystack //haystack as needle
+);
+
+/* loop through to get the position of the needle in haystack string */
+$count = 1;
+for($index=0; $index<count($needle); $index++) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( strrchr($haystack, $needle[$index]) );
+ $count ++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with various single quoted strings ***
+-- Iteration 1 --
+string(22) "lo123456he \x234 \101 "
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 4 --
+string(14) "he \x234 \101 "
+
+-- Iteration 5 --
+string(5) "\101 "
+
+-- Iteration 6 --
+string(5) "\101 "
+
+-- Iteration 7 --
+string(1) " "
+
+-- Iteration 8 --
+string(5) "\101 "
+
+-- Iteration 9 --
+string(5) "\101 "
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+string(5) "\101 "
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+string(1) " "
+
+-- Iteration 18 --
+string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 19 --
+string(1) " "
+
+-- Iteration 20 --
+string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 21 --
+string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 22 --
+string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 23 --
+string(5) "\101 "
+
+-- Iteration 24 --
+string(39) "()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 25 --
+string(37) "*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 26 --
+string(36) "+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 27 --
+string(35) "-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 28 --
+string(34) "./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 29 --
+string(34) "./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 30 --
+string(32) ":;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 31 --
+string(31) ";<=>?@hello123456he \x234 \101 "
+
+-- Iteration 32 --
+string(30) "<=>?@hello123456he \x234 \101 "
+
+-- Iteration 33 --
+string(28) ">?@hello123456he \x234 \101 "
+
+-- Iteration 34 --
+string(29) "=>?@hello123456he \x234 \101 "
+
+-- Iteration 35 --
+string(27) "?@hello123456he \x234 \101 "
+
+-- Iteration 36 --
+string(26) "@hello123456he \x234 \101 "
+
+-- Iteration 37 --
+string(26) "@hello123456he \x234 \101 "
+
+-- Iteration 38 --
+string(2) "1 "
+
+-- Iteration 39 --
+string(5) "\101 "
+
+-- Iteration 40 --
+string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 41 --
+string(5) "\101 "
+
+-- Iteration 42 --
+bool(false)
+
+-- Iteration 43 --
+string(7) "4 \101 "
+
+-- Iteration 44 --
+string(37) "*+-./:;<=>?@hello123456he \x234 \101 "
+
+-- Iteration 45 --
+string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation3.phpt b/ext/standard/tests/strings/strrchr_variation3.phpt
new file mode 100644
index 000000000..1d0aa3009
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation3.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test strrchr() function : usage variations - multi line heredoc string for 'haystack'
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing multi-line heredoc string for haystack and
+ * with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+
+$needles = array(
+ "ing",
+ "",
+ " ",
+ $multi_line_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($multi_line_str, $needle) );
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with heredoc strings ***
+string(19) "ing heredoc syntax."
+bool(false)
+string(8) " syntax."
+string(63) "Example of string
+spanning multiple lines
+using heredoc syntax."
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation4.phpt b/ext/standard/tests/strings/strrchr_variation4.phpt
new file mode 100644
index 000000000..8b2c10bf2
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation4.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test strrchr() function : usage variations - heredoc string containing special chars for 'haystack'
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing special chars for haystack
+ * and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$special_chars_str = <<<EOD
+Example of heredoc string contains
+$#%^*&*_("_")!#@@!$#$^^&*(special)
+chars.
+EOD;
+
+$heredoc_needle = <<<EOD
+^^&*(
+EOD;
+
+$needles = array(
+ "!@@!",
+ '_',
+ '("_")',
+ "$*",
+ "(special)",
+ $heredoc_needle, //needle as heredoc string
+ $special_chars_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($special_chars_str, $needle) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with heredoc strings ***
+string(24) "!$#$^^&*(special)
+chars."
+string(31) "_")!#@@!$#$^^&*(special)
+chars."
+string(16) "(special)
+chars."
+string(21) "$^^&*(special)
+chars."
+string(16) "(special)
+chars."
+string(19) "^&*(special)
+chars."
+string(76) "Example of heredoc string contains
+$#%^*&*_("_")!#@@!$#$^^&*(special)
+chars."
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation5.phpt b/ext/standard/tests/strings/strrchr_variation5.phpt
new file mode 100644
index 000000000..88a4a84b0
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation5.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strrchr() function : usage variations - heredoc string containing escape sequences for 'haystack'
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing
+ * escape sequences for haystack and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$escape_char_str = <<<EOD
+\tes\t st\r\rch\r using
+\escape \\seque\nce
+EOD;
+
+$needles = array(
+ "\t",
+ '\n',
+ "\r",
+ "\\",
+ $escape_char_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($escape_char_str, $needle) );
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with heredoc strings ***
+string(33) " st ch using
+\escape \seque
+ce"
+string(9) "\seque
+ce"
+string(25) " using
+\escape \seque
+ce"
+string(9) "\seque
+ce"
+string(33) " st ch using
+\escape \seque
+ce"
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation6.phpt b/ext/standard/tests/strings/strrchr_variation6.phpt
new file mode 100644
index 000000000..ba0ffadbd
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation6.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test strrchr() function : usage variations - heredoc string containing quote chars for 'haystack'
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing quote chars for haystack
+ * and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$quote_char_str = <<<EOD
+"things" "in" "double" "quote"
+'things' 'in' 'single' 'quote'
+EOD;
+
+$needles = array(
+ "things",
+ "\"things\"",
+ "\'things\'",
+ "in",
+ "quote",
+ $quote_char_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($quote_char_str, $needle) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with heredoc strings ***
+string(3) "te'"
+string(32) ""
+'things' 'in' 'single' 'quote'"
+bool(false)
+string(14) "ingle' 'quote'"
+string(6) "quote'"
+string(32) ""
+'things' 'in' 'single' 'quote'"
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation7.phpt b/ext/standard/tests/strings/strrchr_variation7.phpt
new file mode 100644
index 000000000..ed5acdc04
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation7.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test strrchr() function : usage variations - heredoc string containing blank line for 'haystack'
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing heredoc string containing
+ * blank-line for haystack and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$blank_line = <<<EOD
+
+EOD;
+
+$needles = array(
+ "\n",
+ '\n',
+ "\r",
+ "\r\n",
+ "\t",
+ "",
+ $blank_line //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($blank_line, $needle) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with heredoc strings ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt
new file mode 100644
index 000000000..3e298a0b3
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation8.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test strrchr() function : usage variations - empty heredoc string for 'haystack'
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function by passing empty heredoc string for haystack
+ * and with various needles
+*/
+
+echo "*** Testing strrchr() function: with heredoc strings ***\n";
+$empty_str = <<<EOD
+EOD;
+
+$needles = array(
+ "",
+ '',
+ FALSE,
+ NULL,
+ "\0",
+ $empty_str //needle as haystack
+);
+
+//loop through to test strrchr() with each needle
+foreach($needles as $needle) {
+ var_dump( strrchr($empty_str, $needle) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with heredoc strings ***
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation9.phpt b/ext/standard/tests/strings/strrchr_variation9.phpt
new file mode 100644
index 000000000..cd4c5b2c3
--- /dev/null
+++ b/ext/standard/tests/strings/strrchr_variation9.phpt
@@ -0,0 +1,196 @@
+--TEST--
+Test strrchr() function : usage variations - unexpected inputs for haystack
+--FILE--
+<?php
+/* Prototype : string strrchr(string $haystack, string $needle);
+ * Description: Finds the last occurrence of a character in a string.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrchr() function with unexpected inputs for haystack
+ * and expected type for 'needle'
+*/
+
+echo "*** Testing strrchr() function: with unexpected inputs for haystack ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$haystacks = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+$needles = array (
+ //integer numeric strings
+ "0",
+ "1",
+ "2",
+ "-2",
+
+ //float numeric strings
+ "10.5",
+ "-10.5",
+ "10.5e10",
+ "10.6E-10",
+ ".5",
+
+ //regular strings
+ "array",
+ "a",
+ "r",
+ "y",
+ "ay",
+ "true",
+ "false",
+ "TRUE",
+ "FALSE",
+ "NULL",
+ "null",
+ "object",
+
+ //empty string
+ "",
+ '',
+
+ //resource variable in string form
+ "\$file_handle",
+
+ //undefined variable in string form
+ @"$undefined_var",
+ @"$unset_var"
+);
+
+// loop through each element of the array and check the working of strrchr()
+$count = 1;
+for($index = 0; $index < count($haystacks); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrchr($haystacks[$index], $needles[$index]) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrchr() function: with unexpected inputs for haystack ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(4) "2345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(5) "-10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+-- Iteration 9 --
+string(2) ".5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(2) "ay"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(2) "ay"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(3) "ray"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "y"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(2) "ay"
+-- 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 --
+string(6) "object"
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrev_basic.phpt b/ext/standard/tests/strings/strrev_basic.phpt
new file mode 100644
index 000000000..2cde4cdf8
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test strrev() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string strrev(string $str);
+ * Description: Reverse a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrev() : basic functionality ***\n";
+$heredoc = <<<EOD
+Hello, world
+EOD;
+
+//regular string
+var_dump( strrev("Hello, World") );
+var_dump( strrev('Hello, World') );
+
+//single character
+var_dump( strrev("H") );
+var_dump( strrev('H') );
+
+//string containing simalr chars
+var_dump( strrev("HHHHHH") );
+var_dump( strrev("HhhhhH") );
+
+//string containing escape char
+var_dump( strrev("Hello, World\n") );
+var_dump( strrev('Hello, World\n') );
+
+//heredoc string
+var_dump( strrev($heredoc) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrev() : basic functionality ***
+string(12) "dlroW ,olleH"
+string(12) "dlroW ,olleH"
+string(1) "H"
+string(1) "H"
+string(6) "HHHHHH"
+string(6) "HhhhhH"
+string(13) "
+dlroW ,olleH"
+string(14) "n\dlroW ,olleH"
+string(12) "dlrow ,olleH"
+*** Done ***
diff --git a/ext/standard/tests/strings/strrev_error.phpt b/ext/standard/tests/strings/strrev_error.phpt
new file mode 100644
index 000000000..e1fd9f824
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test strrev() function : error conditions
+--FILE--
+<?php
+/* Prototype : string strrev(string $str);
+ * Description: Reverse a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrev() : error conditions ***\n";
+echo "-- Testing strrev() function with Zero arguments --";
+var_dump( strrev() );
+
+echo "\n-- Testing strrev() function with more than expected no. of arguments --";
+var_dump( strrev("string", 'extra_arg') );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrev() : error conditions ***
+-- Testing strrev() function with Zero arguments --
+Warning: Wrong parameter count for strrev() in %s on line %d
+NULL
+
+-- Testing strrev() function with more than expected no. of arguments --
+Warning: Wrong parameter count for strrev() in %s on line %d
+NULL
+*** Done ***
diff --git a/ext/standard/tests/strings/strrev_variation1.phpt b/ext/standard/tests/strings/strrev_variation1.phpt
new file mode 100644
index 000000000..c0f894618
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrev_variation2.phpt b/ext/standard/tests/strings/strrev_variation2.phpt
new file mode 100644
index 000000000..41e54d53c
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation2.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrev_variation3.phpt b/ext/standard/tests/strings/strrev_variation3.phpt
new file mode 100644
index 000000000..8ab3e25b6
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrev_variation4.phpt b/ext/standard/tests/strings/strrev_variation4.phpt
new file mode 100644
index 000000000..bf4a7fad9
--- /dev/null
+++ b/ext/standard/tests/strings/strrev_variation4.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test strrev() function : usage variations - unexpected inputs
+--FILE--
+<?php
+/* Prototype : string strrev(string $str);
+ * Description: Reverse a string
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strrev() function with unexpected inputs for 'str' */
+
+echo "*** Testing strrev() : unexpected inputs for 'str' ***\n";
+//class declaration
+class sample {
+ public function __toString(){
+ return "object";
+ }
+}
+
+//get the resource
+$resource = fopen(__FILE__, "r");
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // resource
+ $resource,
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var
+);
+
+// loop through each element of the array for str
+
+$count = 1;
+foreach($values as $value) {
+ echo "\n-- Iterator $count --\n";
+ var_dump( strrev($value) );
+ $count++;
+};
+
+fclose($resource); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrev() : unexpected inputs for 'str' ***
+
+-- Iterator 1 --
+string(1) "0"
+
+-- Iterator 2 --
+string(1) "1"
+
+-- Iterator 3 --
+string(5) "54321"
+
+-- Iterator 4 --
+string(5) "5432-"
+
+-- Iterator 5 --
+string(4) "5.01"
+
+-- Iterator 6 --
+string(5) "5.01-"
+
+-- Iterator 7 --
+string(12) "000000000501"
+
+-- Iterator 8 --
+string(7) "9-E60.1"
+
+-- Iterator 9 --
+string(3) "5.0"
+
+-- Iterator 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "yarrA"
+
+-- Iterator 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "yarrA"
+
+-- Iterator 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "yarrA"
+
+-- Iterator 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "yarrA"
+
+-- Iterator 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "yarrA"
+
+-- Iterator 15 --
+string(0) ""
+
+-- Iterator 16 --
+string(0) ""
+
+-- Iterator 17 --
+string(1) "1"
+
+-- Iterator 18 --
+string(0) ""
+
+-- Iterator 19 --
+string(1) "1"
+
+-- Iterator 20 --
+string(0) ""
+
+-- Iterator 21 --
+string(0) ""
+
+-- Iterator 22 --
+string(0) ""
+
+-- Iterator 23 --
+string(6) "tcejbo"
+
+-- Iterator 24 --
+string(%d) "%d# di ecruoseR"
+
+-- Iterator 25 --
+string(0) ""
+
+-- Iterator 26 --
+string(0) ""
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_basic1.phpt b/ext/standard/tests/strings/strrpos_basic1.phpt
new file mode 100644
index 000000000..26497fb3f
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_basic1.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test strrpos() function : basic functionality - with default arguments
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrpos() function: basic functionality ***\n";
+$heredoc_str = <<<EOD
+Hello, World
+EOD;
+
+echo "-- With default arguments --\n";
+//regular string for haystack & needle
+var_dump( strrpos("Hello, World", "Hello") );
+var_dump( strrpos('Hello, World', "hello") );
+var_dump( strrpos("Hello, World", 'World') );
+var_dump( strrpos('Hello, World', 'WORLD') );
+
+//single char for needle
+var_dump( strrpos("Hello, World", "o") );
+var_dump( strrpos("Hello, World", ",") );
+
+//heredoc string for haystack & needle
+var_dump( strrpos($heredoc_str, "Hello, World") );
+var_dump( strrpos($heredoc_str, 'Hello') );
+var_dump( strrpos($heredoc_str, $heredoc_str) );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: basic functionality ***
+-- With default arguments --
+int(0)
+bool(false)
+int(7)
+bool(false)
+int(8)
+int(5)
+int(0)
+int(0)
+int(0)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_basic2.phpt b/ext/standard/tests/strings/strrpos_basic2.phpt
new file mode 100644
index 000000000..a65bbf3fd
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_basic2.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test strrpos() function : basic functionality - with all arguments
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrpos() function: basic functionality ***\n";
+$heredoc_str = <<<EOD
+Hello, World
+EOD;
+
+echo "-- With all arguments --\n";
+//regular string for haystack & needle, with various offsets
+var_dump( strrpos("Hello, World", "Hello", 0) );
+var_dump( strrpos("Hello, World", 'Hello', 1) );
+var_dump( strrpos('Hello, World', 'World', 1) );
+var_dump( strrpos('Hello, World', "World", 5) );
+
+//heredoc string for haystack & needle, with various offsets
+var_dump( strrpos($heredoc_str, "Hello, World", 0) );
+var_dump( strrpos($heredoc_str, 'Hello', 0) );
+var_dump( strrpos($heredoc_str, 'Hello', 1) );
+var_dump( strrpos($heredoc_str, $heredoc_str, 0) );
+var_dump( strrpos($heredoc_str, $heredoc_str, 1) );
+
+//various offsets
+var_dump( strrpos("Hello, World", "o", 3) );
+var_dump( strrpos("Hello, World", "o", 6) );
+var_dump( strrpos("Hello, World", "o", 10) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: basic functionality ***
+-- With all arguments --
+int(0)
+bool(false)
+int(7)
+int(7)
+int(0)
+int(0)
+bool(false)
+int(0)
+bool(false)
+int(8)
+int(8)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_error.phpt b/ext/standard/tests/strings/strrpos_error.phpt
new file mode 100644
index 000000000..3900ceaa5
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_error.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test strrpos() function : error conditions
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strrpos() function: error conditions ***";
+echo "\n-- With Zero arguments --";
+var_dump( strrpos() );
+
+echo "\n-- With less than expected number of arguments --";
+var_dump( strrpos("String") );
+
+echo "\n-- With more than expected number of arguments --";
+var_dump( strrpos("string", "String", 1, 'extra_arg') );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: error conditions ***
+-- With Zero arguments --
+Warning: strrpos() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+-- With less than expected number of arguments --
+Warning: strrpos() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+-- With more than expected number of arguments --
+Warning: strrpos() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt
new file mode 100644
index 000000000..a7ef3e9b0
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation1.phpt
@@ -0,0 +1,182 @@
+--TEST--
+Test strrpos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing double quoted strings for 'haystack' & 'needle' arguments */
+
+echo "*** Testing strrpos() function: with double quoted strings ***\n";
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
+$needle = array(
+ //regular strings
+ "l",
+ "L",
+ "HELLO",
+ "hEllo",
+
+ //escape characters
+ "\t",
+ "\T", //invalid input
+ " ",
+ "\n",
+ "\N", //invalid input
+ "
+", //new line
+
+ //nulls
+ "\0",
+ NULL,
+ null,
+
+ //boolean false
+ FALSE,
+ false,
+
+ //empty string
+ "",
+
+ //special chars
+ " ",
+ "$",
+ " $",
+ "&",
+ "!#",
+ "()",
+ "<=>",
+ ">",
+ "=>",
+ "?",
+ "@",
+ "@hEllo",
+
+ "12345", //decimal numeric string
+ "\x23", //hexadecimal numeric string
+ "#", //respective ASCII char of \x23
+ "\101", //octal numeric string
+ "A", //respective ASCII char of \101
+ "456HEE", //numerics + chars
+ $haystack //haystack as needle
+);
+
+/* loop through to get the position of the needle in haystack string */
+$count = 1;
+for($index=0; $index<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrpos($haystack, $needle[$index]) );
+ var_dump( strrpos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with double quoted strings ***
+-- Iteration 1 --
+int(28)
+int(28)
+-- Iteration 2 --
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+-- Iteration 5 --
+int(6)
+int(6)
+-- Iteration 6 --
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+int(9)
+int(9)
+-- Iteration 9 --
+bool(false)
+bool(false)
+-- Iteration 10 --
+int(9)
+int(9)
+-- Iteration 11 --
+int(8)
+bool(false)
+-- Iteration 12 --
+int(8)
+bool(false)
+-- Iteration 13 --
+int(8)
+bool(false)
+-- Iteration 14 --
+int(8)
+bool(false)
+-- Iteration 15 --
+int(8)
+bool(false)
+-- Iteration 16 --
+bool(false)
+bool(false)
+-- Iteration 17 --
+int(43)
+int(43)
+-- Iteration 18 --
+int(12)
+bool(false)
+-- Iteration 19 --
+int(11)
+bool(false)
+-- Iteration 20 --
+int(13)
+bool(false)
+-- Iteration 21 --
+int(14)
+bool(false)
+-- Iteration 22 --
+int(17)
+bool(false)
+-- Iteration 23 --
+int(20)
+bool(false)
+-- Iteration 24 --
+int(22)
+bool(false)
+-- Iteration 25 --
+int(21)
+bool(false)
+-- Iteration 26 --
+int(23)
+bool(false)
+-- Iteration 27 --
+int(24)
+bool(false)
+-- Iteration 28 --
+bool(false)
+bool(false)
+-- Iteration 29 --
+int(30)
+int(30)
+-- Iteration 30 --
+int(39)
+int(39)
+-- Iteration 31 --
+int(39)
+int(39)
+-- Iteration 32 --
+int(42)
+int(42)
+-- Iteration 33 --
+int(42)
+int(42)
+-- Iteration 34 --
+bool(false)
+bool(false)
+-- Iteration 35 --
+int(0)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt
new file mode 100644
index 000000000..abdc5e2f4
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation10.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test strrpos() function : usage variations - unexpected inputs for 'needle' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'needle' and
+ * an expected type of input for 'haystack' argument
+*/
+
+echo "*** Testing strrpos() function with unexpected values for needle ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
+
+// array with different values
+$needles = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through each element of the 'needle' array to check the working of strrpos()
+$counter = 1;
+for($index = 0; $index < count($needles); $index ++) {
+ echo "-- Iteration $counter --\n";
+ var_dump( strrpos($haystack, $needles[$index]) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function with unexpected values for needle ***
+-- 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 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+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)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt
new file mode 100644
index 000000000..5b5e7e3e3
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation11.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test strrpos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'haystack' and 'needle' arguments */
+
+echo "*** Testing strrpos() function with unexpected values for haystack and needle ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of strrpos()
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $haystack = $values[$index];
+ var_dump( strrpos($values[$index], $values[$index]) );
+ var_dump( strrpos($values[$index], $values[$index], 1) );
+ $counter ++;
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function with unexpected values for haystack and needle ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+-- Iteration 5 --
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+bool(false)
+bool(false)
+-- Iteration 10 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 15 --
+bool(false)
+bool(false)
+-- Iteration 16 --
+bool(false)
+bool(false)
+-- Iteration 17 --
+bool(false)
+bool(false)
+-- Iteration 18 --
+bool(false)
+bool(false)
+-- Iteration 19 --
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+bool(false)
+
+Notice: Object of class sample could not be converted to int in %s on line %d
+bool(false)
+-- Iteration 20 --
+bool(false)
+bool(false)
+-- Iteration 21 --
+bool(false)
+bool(false)
+-- Iteration 22 --
+bool(false)
+bool(false)
+-- Iteration 23 --
+bool(false)
+bool(false)
+-- Iteration 24 --
+
+Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+
+Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+-- Iteration 25 --
+bool(false)
+bool(false)
+-- Iteration 26 --
+bool(false)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation12.phpt b/ext/standard/tests/strings/strrpos_variation12.phpt
new file mode 100644
index 000000000..87ac3b2f8
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation12.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test strrpos() function : usage variations - checking binary safe with 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with null terminated strings for 'haystack' argument
+ * in order to check the binary safe
+*/
+
+echo "*** Test strrpos() function: binary safe ***\n";
+$haystacks = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello World",
+ "Hello World".chr(0),
+ chr(0).chr(0).chr(0),
+ "Hello\0world",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($haystacks); $index++ ) {
+ var_dump( strrpos($haystacks[$index], "\0") );
+ var_dump( strrpos($haystacks[$index], "\0", $index) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Test strrpos() function: binary safe ***
+int(5)
+int(5)
+int(0)
+bool(false)
+int(11)
+int(11)
+int(2)
+bool(false)
+int(5)
+int(5)
+int(0)
+bool(false)
+int(5)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation13.phpt b/ext/standard/tests/strings/strrpos_variation13.phpt
new file mode 100644
index 000000000..f85c3c454
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation13.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test strrpos() function : usage variations - checking bianry safe with 'needle' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with null terminated strings for 'needle' argument
+ * in order to check binary safe
+*/
+
+echo "*** Test strrpos() function: binary safe ***\n";
+$haystack = "\0Hello\0World\0";
+
+$needles = array(
+ "Hello".chr(0)."World",
+ chr(0)."Hello\0",
+ chr(0),
+ "Hello\0world",
+ "\0Hello\0world\0",
+ "\0Hello",
+ "Hello\0"
+);
+
+for($index = 0; $index < count($needles); $index++ ) {
+ var_dump( strrpos($haystack, $needles[$index]) );
+ var_dump( strrpos($haystack, $needles[$index], $index) );
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Test strrpos() function: binary safe ***
+int(1)
+int(1)
+int(0)
+bool(false)
+int(12)
+int(12)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+bool(false)
+int(1)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt
new file mode 100644
index 000000000..617685325
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation14.phpt
@@ -0,0 +1,153 @@
+--TEST--
+Test strrpos() function : usage variations - unexpected inputs for 'offset' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'offset' argument */
+
+echo "*** Testing strrpos() function: with unexpected values for offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+//definition of input args
+$haystack = "hello world";
+$needle = "world";
+
+// array with different values
+$offsets = array (
+
+ // float values
+ 1.5,
+ -1.5,
+ 1.5e10,
+ 1.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ //resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of strrpos()
+$counter = 1;
+for($index = 0; $index < count($offsets); $index ++) {
+ echo "-- Iteration $counter --\n";
+ var_dump( strrpos($haystack, $needle, $offsets[$index]) );
+ $counter ++;
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with unexpected values for offset ***
+-- Iteration 1 --
+int(6)
+-- Iteration 2 --
+int(6)
+-- Iteration 3 --
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+-- Iteration 4 --
+int(6)
+-- Iteration 5 --
+int(6)
+-- Iteration 6 --
+
+Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 8 --
+
+Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 9 --
+
+Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 10 --
+
+Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+int(6)
+-- Iteration 12 --
+int(6)
+-- Iteration 13 --
+int(6)
+-- Iteration 14 --
+int(6)
+-- Iteration 15 --
+
+Warning: strrpos() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+-- Iteration 16 --
+
+Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+-- Iteration 17 --
+
+Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+-- Iteration 18 --
+int(6)
+-- Iteration 19 --
+int(6)
+-- Iteration 20 --
+
+Warning: strrpos() expects parameter 3 to be long, resource given in %s on line %d
+bool(false)
+-- Iteration 21 --
+int(6)
+-- Iteration 22 --
+int(6)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt
new file mode 100644
index 000000000..23c7aef14
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation15.phpt
@@ -0,0 +1,171 @@
+--TEST--
+Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */
+
+echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ //resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop through each element of the array and check the working of strrpos()
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ var_dump( strrpos($values[$index], $values[$index], $values[$index]) );
+ $counter ++;
+}
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***
+-- Iteration 1 --
+bool(false)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+-- Iteration 4 --
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+-- Iteration 5 --
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+-- Iteration 6 --
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+-- Iteration 7 --
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+-- Iteration 8 --
+bool(false)
+-- Iteration 9 --
+bool(false)
+-- Iteration 10 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 11 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 12 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 14 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+-- Iteration 15 --
+bool(false)
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+
+Warning: strrpos() expects parameter 3 to be long, object given in %s on line %d
+bool(false)
+-- Iteration 20 --
+
+Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d
+bool(false)
+-- Iteration 22 --
+bool(false)
+-- Iteration 23 --
+bool(false)
+-- Iteration 24 --
+
+Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+-- Iteration 25 --
+bool(false)
+-- Iteration 26 --
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt
new file mode 100644
index 000000000..53645866b
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation2.phpt
@@ -0,0 +1,186 @@
+--TEST--
+Test strrpos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing single quoted strings to 'haystack' & 'needle' arguments */
+
+echo "*** Testing strrpos() function: with single quoted strings ***\n";
+$haystack = 'Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ';
+$needle = array(
+ //regular strings
+ 'l',
+ 'L',
+ 'HELLO',
+ 'hEllo',
+
+ //escape characters
+ '\t',
+ '\T',
+ ' ',
+ '\n',
+ '\N',
+ '
+', //new line
+
+ //nulls
+ '\0',
+ NULL,
+ null,
+
+ //boolean false
+ FALSE,
+ false,
+
+ //empty string
+ '',
+
+ //special chars
+ ' ',
+ '$',
+ ' $',
+ '&',
+ '!#',
+ '()',
+ '<=>',
+ '>',
+ '=>',
+ '?',
+ '@',
+ '@hEllo',
+
+ '12345', //decimal numeric string
+ '\x23', //hexadecimal numeric string
+ '#', //hexadecimal numeric string
+ '\101', //octal numeric string
+ 'A',
+ '456HEE', //numerics + chars
+ 42, //needle as int(ASCII value of '*')
+ $haystack //haystack as needle
+);
+
+/* loop through to get the position of the needle in haystack string */
+$count = 1;
+for($index=0; $index<count($needle); $index++) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrpos($haystack, $needle[$index]) );
+ var_dump( strrpos($haystack, $needle[$index], $index) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with single quoted strings ***
+-- Iteration 1 --
+int(32)
+int(32)
+-- Iteration 2 --
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(false)
+bool(false)
+-- Iteration 5 --
+int(6)
+int(6)
+-- Iteration 6 --
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+-- Iteration 8 --
+int(12)
+int(12)
+-- Iteration 9 --
+bool(false)
+bool(false)
+-- Iteration 10 --
+bool(false)
+bool(false)
+-- Iteration 11 --
+int(10)
+int(10)
+-- Iteration 12 --
+bool(false)
+bool(false)
+-- Iteration 13 --
+bool(false)
+bool(false)
+-- Iteration 14 --
+bool(false)
+bool(false)
+-- Iteration 15 --
+bool(false)
+bool(false)
+-- Iteration 16 --
+bool(false)
+bool(false)
+-- Iteration 17 --
+int(53)
+int(53)
+-- Iteration 18 --
+int(16)
+bool(false)
+-- Iteration 19 --
+int(15)
+bool(false)
+-- Iteration 20 --
+int(17)
+bool(false)
+-- Iteration 21 --
+int(18)
+bool(false)
+-- Iteration 22 --
+int(21)
+int(21)
+-- Iteration 23 --
+int(24)
+int(24)
+-- Iteration 24 --
+int(26)
+int(26)
+-- Iteration 25 --
+int(25)
+int(25)
+-- Iteration 26 --
+int(27)
+int(27)
+-- Iteration 27 --
+int(28)
+int(28)
+-- Iteration 28 --
+bool(false)
+bool(false)
+-- Iteration 29 --
+int(34)
+int(34)
+-- Iteration 30 --
+int(43)
+int(43)
+-- Iteration 31 --
+int(19)
+bool(false)
+-- Iteration 32 --
+int(49)
+int(49)
+-- Iteration 33 --
+bool(false)
+bool(false)
+-- Iteration 34 --
+bool(false)
+bool(false)
+-- Iteration 35 --
+int(23)
+bool(false)
+-- Iteration 36 --
+int(0)
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation3.phpt b/ext/standard/tests/strings/strrpos_variation3.phpt
new file mode 100644
index 000000000..a0a0d270e
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation3.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test strrpos() function : usage variations - multi line heredoc string for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing multi-line heredoc string for haystack and
+ * with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing multi lines --\n";
+$multi_line_str = <<<EOD
+Example of string
+spanning multiple lines
+using heredoc syntax.
+EOD;
+var_dump( strrpos($multi_line_str, "ing", 0) );
+var_dump( strrpos($multi_line_str, "ing", 15) );
+var_dump( strrpos($multi_line_str, "ing", 22) );
+var_dump( strrpos($multi_line_str, "") );
+var_dump( strrpos($multi_line_str, " ") );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with heredoc strings ***
+-- With heredoc string containing multi lines --
+int(44)
+int(44)
+int(44)
+bool(false)
+int(55)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strrpos_variation4.phpt b/ext/standard/tests/strings/strrpos_variation4.phpt
new file mode 100644
index 000000000..1ccf52985
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation4.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test strrpos() function : usage variations - heredoc string containing special chars for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing heredoc string containing special chars for haystack
+ * and with various needles & offets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing special chars --\n";
+$special_chars_str = <<<EOD
+Ex'ple of h'doc st'g, contains
+$#%^*&*_("_")!#@@!$#$^^&$*(special)
+chars.
+EOD;
+var_dump( strrpos($special_chars_str, "Ex'ple", 0) );
+var_dump( strrpos($special_chars_str, "!@@!", 23) );
+var_dump( strrpos($special_chars_str, '_') );
+var_dump( strrpos($special_chars_str, '("_")') );
+var_dump( strrpos($special_chars_str, "$*") );
+var_dump( strrpos($special_chars_str, "$*", 10) );
+var_dump( strrpos($special_chars_str, "(special)") );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with heredoc strings ***
+-- With heredoc string containing special chars --
+int(0)
+bool(false)
+int(41)
+int(39)
+int(55)
+int(55)
+int(57)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strrpos_variation5.phpt b/ext/standard/tests/strings/strrpos_variation5.phpt
new file mode 100644
index 000000000..f9537da0e
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation5.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test strrpos() function : usage variations - heredoc string containing escape chars for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing heredoc string containing escape chars for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing escape characters --\n";
+$control_char_str = <<<EOD
+Hello, World\n
+Hello\tWorld
+EOD;
+var_dump( strrpos($control_char_str, "\n") );
+var_dump( strrpos($control_char_str, "\t") );
+var_dump( strrpos($control_char_str, "\n", 12) );
+var_dump( strrpos($control_char_str, "\t", 15) );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with heredoc strings ***
+-- With heredoc string containing escape characters --
+int(13)
+int(19)
+int(13)
+int(19)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strrpos_variation6.phpt b/ext/standard/tests/strings/strrpos_variation6.phpt
new file mode 100644
index 000000000..c879a9120
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation6.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test strrpos() function : usage variations - heredoc string containing quotes for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing heredoc string containing quotes for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With heredoc string containing quote & slash chars --\n";
+$quote_char_str = <<<EOD
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOD;
+var_dump( strrpos($quote_char_str, "line") );
+var_dump( strrpos($quote_char_str, 'things') );
+var_dump( strrpos($quote_char_str, 'things', 0) );
+var_dump( strrpos($quote_char_str, "things", 20) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with heredoc strings ***
+-- With heredoc string containing quote & slash chars --
+int(88)
+int(59)
+int(59)
+int(59)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt
new file mode 100644
index 000000000..239dc246b
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation7.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test strrpos() function : usage variations - empty heredoc string for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function by passing empty heredoc string for haystack
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: with heredoc strings ***\n";
+echo "-- With empty heredoc string --\n";
+$empty_string = <<<EOD
+EOD;
+var_dump( strrpos($empty_string, "") );
+var_dump( strrpos($empty_string, "", 1) );
+var_dump( strrpos($empty_string, FALSE) );
+var_dump( strrpos($empty_string, NULL) );
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: with heredoc strings ***
+-- With empty heredoc string --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strrpos_variation8.phpt b/ext/standard/tests/strings/strrpos_variation8.phpt
new file mode 100644
index 000000000..eac7d8ff8
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation8.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Test strrpos() function : usage variations - repetitive chars for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with strings containing multiple occurrences of 'needle' in the 'haystack'
+ * and with various needles & offsets
+*/
+
+echo "*** Testing strrpos() function: strings repetitive chars ***\n";
+$haystack = "ababababAbaBa";
+$needle = "aba";
+
+/* loop through to consider various offsets in getting the position of the needle in haystack string */
+$count = 1;
+for($offset = -1; $offset <= strlen($haystack); $offset++ ) {
+ echo "-- Iteration $count --\n";
+ var_dump( strrpos($haystack, $needle, $offset) );
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function: strings repetitive chars ***
+-- Iteration 1 --
+int(4)
+-- Iteration 2 --
+int(4)
+-- Iteration 3 --
+int(4)
+-- Iteration 4 --
+int(4)
+-- Iteration 5 --
+int(4)
+-- Iteration 6 --
+int(4)
+-- 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)
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strrpos_variation9.phpt b/ext/standard/tests/strings/strrpos_variation9.phpt
new file mode 100644
index 000000000..9b3b8d673
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation9.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test strrpos() function : usage variations - unexpected inputs for 'haystack' argument
+--FILE--
+<?php
+/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
+ * Description: Find position of last occurrence of 'needle' in 'haystack'.
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strrpos() function with unexpected inputs for haystack argument */
+
+echo "*** Testing strrpos() function with unexpected values for haystack ***\n";
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// defining a class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values
+$haystacks = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource";
+
+// loop through each element of the array and check the working of strrpos()
+$counter = 1;
+for($index = 0; $index < count($haystacks); $index ++) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( strrpos($haystacks[$index], $needle) );
+ $counter ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strrpos() function with unexpected values for haystack ***
+
+-- 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: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
+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 --
+
+Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strspn_basic.phpt b/ext/standard/tests/strings/strspn_basic.phpt
new file mode 100644
index 000000000..d9b1a3388
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test strspn() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided, it works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : basic functionality
+*/
+
+echo "*** Testing strspn() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = "this is the test string";
+$mask = "htes ";
+$start = 8;
+$len = 30;
+
+// Calling strspn() with all possible arguments
+var_dump( strspn($str, $mask, $start, $len) );
+
+// Calling strspn() with three arguments and default len argument
+var_dump( strspn($str, $mask, $start) );
+
+// Calling strspn() with default arguments
+var_dump( strspn($str, $mask) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : basic functionality ***
+int(11)
+int(11)
+int(2)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_error.phpt b/ext/standard/tests/strings/strspn_error.phpt
new file mode 100644
index 000000000..caa1f901a
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_error.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test strspn() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Test strspn() : for error conditons
+*/
+
+echo "*** Testing strspn() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing strspn() function with Zero arguments --\n";
+var_dump( strspn() );
+
+//Test strspn with one more than the expected number of arguments
+echo "\n-- Testing strspn() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$mask = 'string_val';
+$start = 2;
+$len = 20;
+
+
+$extra_arg = 10;
+var_dump( strspn($str,$mask,$start,$len, $extra_arg) );
+
+// Testing strspn withone less than the expected number of arguments
+echo "\n-- Testing strspn() function with less than expected no. of arguments --\n";
+$str = 'string_val';
+var_dump( strspn($str) );
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : error conditions ***
+
+-- Testing strspn() function with Zero arguments --
+
+Warning: strspn() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+-- Testing strspn() function with more than expected no. of arguments --
+
+Warning: strspn() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+
+-- Testing strspn() function with less than expected no. of arguments --
+
+Warning: strspn() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strspn_variation1.phpt b/ext/standard/tests/strings/strspn_variation1.phpt
new file mode 100644
index 000000000..513046b62
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation1.phpt
@@ -0,0 +1,275 @@
+--TEST--
+Test strspn() function : usage variations - unexpected values for str argument
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with different unexpected values for str argument
+*/
+
+echo "*** Testing strspn() : with unexpected values for str argument ***\n";
+
+// Initialise function arguments not being substititued (if any)
+$mask = 'abons1234567890';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample,
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for str
+
+foreach($values as $value) {
+ echo "\n-- Iteration with str value as \"$value\" \n";
+ var_dump( strspn($value,$mask) ); // with default args
+ var_dump( strspn($value,$mask,$start) ); // with default len value
+ var_dump( strspn($value,$mask,$start,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with str value as "0"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "1"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "12345"
+int(5)
+int(4)
+int(4)
+
+-- Iteration with str value as "-2345"
+int(0)
+int(4)
+int(4)
+
+-- Iteration with str value as "10.5"
+int(2)
+int(1)
+int(1)
+
+-- Iteration with str value as "-10.5"
+int(0)
+int(2)
+int(2)
+
+-- Iteration with str value as "105000000000"
+int(12)
+int(11)
+int(10)
+
+-- Iteration with str value as "1.06E-9"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "0.5"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as "Array"
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "1"
+int(1)
+int(0)
+int(0)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "object"
+int(2)
+int(1)
+int(1)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as ""
+int(0)
+bool(false)
+bool(false)
+
+-- Iteration with str value as "Resource id #%d"
+
+Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strspn_variation10.phpt b/ext/standard/tests/strings/strspn_variation10.phpt
new file mode 100644
index 000000000..318d16ccf
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation10.phpt
@@ -0,0 +1,274 @@
+--TEST--
+Test strspn() function : usage variations - with varying mask & default start and len args
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with varying mask and default start and len arguments
+*/
+
+echo "*** Testing strspn() : with different mask strings and default start and len arguments ***\n";
+
+// initialing required variables
+// defining different strings
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// define the array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "t\ ",
+ '\telh',
+ "felh\t\ ",
+ " \t",
+ "fhel\t\i\100\xa"
+ );
+
+
+// loop through each element of the array for mask argument
+
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strspn($str,$mask) );
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with different mask strings and default start and len arguments ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+
+-- Iteration 4 --
+int(0)
+int(0)
+int(1)
+int(2)
+int(0)
+int(1)
+int(1)
+int(1)
+int(0)
+int(1)
+
+-- Iteration 5 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 6 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 7 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 8 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 9 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 10 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 11 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 12 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 13 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 14 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 15 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 16 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 17 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+int(4)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation11.phpt b/ext/standard/tests/strings/strspn_variation11.phpt
new file mode 100644
index 000000000..209981e69
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation11.phpt
@@ -0,0 +1,1306 @@
+--TEST--
+Test strspn() function : usage variations - with varying start and default len args
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with varying start and default len arguments
+*/
+
+echo "*** Testing strspn() : with different start and default len values ***\n";
+
+// initialing required variables
+// defining different strings
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
+ );
+
+// define the array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "t\ ",
+ '\telh',
+ "felh\t\ ",
+ " \t",
+ "fhel\t\i\100\xa"
+ );
+
+// defining the array for start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the arrays for str, mask and start argument
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strspn($str,$mask,$start) );
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with different start and default len values ***
+
+-- Iteration 1 --
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 2 --
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(1)
+int(1)
+bool(false)
+int(1)
+
+-- Iteration 4 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(1)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(1)
+
+-- Iteration 5 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(1)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(1)
+int(0)
+bool(false)
+int(4)
+
+-- Iteration 6 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(1)
+int(2)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+
+-- Iteration 7 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 8 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 9 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(1)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(1)
+int(0)
+bool(false)
+int(4)
+
+-- Iteration 10 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+
+-- Iteration 11 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 12 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 13 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(4)
+int(3)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 14 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+
+-- Iteration 15 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+
+-- Iteration 16 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+
+-- Iteration 17 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(1)
+bool(false)
+int(4)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation12.phpt b/ext/standard/tests/strings/strspn_variation12.phpt
new file mode 100644
index 000000000..9e2eaf010
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation12.phpt
@@ -0,0 +1,2878 @@
+--TEST--
+Test strspn() function : usage variations - with varying start and len args
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with varying start and len arguments
+*/
+
+echo "*** Testing strspn() : with different start and len values ***\n";
+
+// initialing required variables
+// defining different strings
+$strings = array(
+ "",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ "1234hello45world\t123",
+ "hello\0world\012",
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ "hello".chr(0)."world",
+ "hello\0\100\xaaaworld",
+ );
+
+// define the array of mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "felh\t\ ",
+ "fhel\t\i\100\xa"
+ );
+
+// defining the array for start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+// defining an array of len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the array for len argument
+$count = 1;
+foreach($strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with different start and len values ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+
+-- Iteration 4 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+
+-- Iteration 5 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 6 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 7 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 8 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 9 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 10 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 11 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation2.phpt b/ext/standard/tests/strings/strspn_variation2.phpt
new file mode 100644
index 000000000..b8891a590
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation2.phpt
@@ -0,0 +1,274 @@
+--TEST--
+Test strspn() function : usage variations - unexpected values for mask argument
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with different unexpected values for mask argument
+*/
+
+echo "*** Testing strspn() : with diferent unexpected values of mask argument ***\n";
+
+$str = 'string_val';
+$start = 1;
+$len = 10;
+
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for mask
+
+foreach($values as $value) {
+ echo "\n-- Iteration with mask value as \"$value\" -- \n";
+ var_dump( strspn($str,$value) ); // with defalut args
+ var_dump( strspn($str,$value,$start) ); // with default len value
+ var_dump( strspn($str,$value,$start,$len) ); // with all args
+};
+
+// close the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with diferent unexpected values of mask argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with mask value as "0" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "1" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "12345" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "-2345" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "10.5" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "-10.5" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "105000000000" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "1.06E-9" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "0.5" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "Array" --
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "Array" --
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, array given in %s on line %d
+NULL
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "1" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "1" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "object" --
+int(0)
+int(1)
+int(1)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "" --
+int(0)
+int(0)
+int(0)
+
+-- Iteration with mask value as "Resource id #%d" --
+
+Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strspn_variation3.phpt b/ext/standard/tests/strings/strspn_variation3.phpt
new file mode 100644
index 000000000..0773bd3ad
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation3.phpt
@@ -0,0 +1,245 @@
+--TEST--
+Test strspn() function : usage variations - unexpected values of start argument
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with unexpected values of start argument
+*/
+
+echo "*** Testing strspn() : with unexpected values of start argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$len = 10;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with start value as \"$value\" --\n";
+ var_dump( strspn($str,$mask,$value) ); // with default len value
+ var_dump( strspn($str,$mask,$value,$len) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with unexpected values of start argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with start value as "10.5" --
+int(0)
+int(0)
+
+-- Iteration with start value as "-10.5" --
+int(2)
+int(2)
+
+-- Iteration with start value as "105000000000" --
+bool(false)
+bool(false)
+
+-- Iteration with start value as "1.06E-9" --
+int(2)
+int(2)
+
+-- Iteration with start value as "0.5" --
+int(2)
+int(2)
+
+-- Iteration with start value as "Array" --
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "Array" --
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+int(2)
+int(2)
+
+-- Iteration with start value as "" --
+int(2)
+int(2)
+
+-- Iteration with start value as "1" --
+int(1)
+int(1)
+
+-- Iteration with start value as "" --
+int(2)
+int(2)
+
+-- Iteration with start value as "1" --
+int(1)
+int(1)
+
+-- Iteration with start value as "" --
+int(2)
+int(2)
+
+-- Iteration with start value as "" --
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "string" --
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "string" --
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with start value as "object" --
+
+Warning: strspn() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+-- Iteration with start value as "" --
+int(2)
+int(2)
+
+-- Iteration with start value as "" --
+int(2)
+int(2)
+
+-- Iteration with start value as "Resource id #%d" --
+
+Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+
+Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strspn_variation4.phpt b/ext/standard/tests/strings/strspn_variation4.phpt
new file mode 100644
index 000000000..dd21a1d0f
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation4.phpt
@@ -0,0 +1,198 @@
+--TEST--
+Test strspn() function : usage variations - unexpected values of len argument
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with unexpected values of len argument
+*/
+
+echo "*** Testing strspn() : with unexpected values of len argument ***\n";
+
+// initialing required variables
+$str = 'string_val';
+$mask = 'soibtFTf1234567890';
+$start = 0;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample {
+ public function __toString() {
+ return "object";
+ }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ $undefined_var,
+
+ // unset data
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+// loop through each element of the array for start
+
+foreach($values as $value) {
+ echo "\n-- Iteration with len value as \"$value\" --\n";
+ var_dump( strspn($str,$mask,$start,$value) ); // with all args
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with unexpected values of len argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration with len value as "10.5" --
+int(2)
+
+-- Iteration with len value as "-10.5" --
+int(0)
+
+-- Iteration with len value as "105000000000" --
+int(2)
+
+-- Iteration with len value as "1.06E-9" --
+int(0)
+
+-- Iteration with len value as "0.5" --
+int(0)
+
+-- Iteration with len value as "Array" --
+
+Warning: strspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "Array" --
+
+Warning: strspn() expects parameter 4 to be long, array given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "1" --
+int(1)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "1" --
+int(1)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+
+Warning: strspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+
+Warning: strspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "string" --
+
+Warning: strspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "string" --
+
+Warning: strspn() expects parameter 4 to be long, string given in %s on line %d
+NULL
+
+-- Iteration with len value as "object" --
+
+Warning: strspn() expects parameter 4 to be long, object given in %s on line %d
+NULL
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "" --
+int(0)
+
+-- Iteration with len value as "Resource id #%d" --
+
+Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strspn_variation5.phpt b/ext/standard/tests/strings/strspn_variation5.phpt
new file mode 100644
index 000000000..514af5531
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strspn_variation6.phpt b/ext/standard/tests/strings/strspn_variation6.phpt
new file mode 100644
index 000000000..3c3c1d8c3
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation6.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test strspn() function : usage variations - with heredoc strings, varying mask & default start and len args
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with heredoc string, varying mask and default start and len arguments
+*/
+
+echo "*** Testing strspn() : with different mask strings ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+// defining array of different heredoc strings
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of different mask strings
+$mask_array = array(
+ "",
+ '',
+ "fh\ne\trlsti \l",
+ 'fieh\n\trlsti \l',
+ "\t",
+ "lt\ ",
+ 'l\t',
+ "fl\t\eh ",
+ "l \te",
+ "lf\the\i\100\xaa"
+ );
+
+
+// loop through each element of the array for different heredoc and mask strings
+
+$count = 1;
+
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ var_dump( strspn($str,$mask) ); // with default start and len value
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with different mask strings ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(0)
+int(8)
+int(11)
+int(0)
+int(0)
+int(0)
+int(1)
+int(0)
+int(2)
+
+-- Iteration 4 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 5 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 6 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+
+-- Iteration 7 --
+int(0)
+int(0)
+int(4)
+int(4)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation7.phpt b/ext/standard/tests/strings/strspn_variation7.phpt
new file mode 100644
index 000000000..d0ebee3c9
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation7.phpt
@@ -0,0 +1,612 @@
+--TEST--
+Test strspn() function : usage variations - with heredoc strings, varying start and default len args
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with heredoc string, varying start and default len arguments
+*/
+
+echo "*** Testing strspn() : with different start values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+// defining array of different heredoc strings
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of different mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\nh\trstie \l",
+ 'f\n\thrstei \l',
+ "\t",
+ "t\ e",
+ '\t',
+ "f\te\h ",
+ " \t",
+ "f\t\ih\100e\xa"
+ );
+
+// defining array of different start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the array for heredoc strings, mask strings and start values
+
+$count = 1;
+
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ var_dump( strspn($str,$mask,$start) ); // with default len value
+ }
+ }
+ $count++;
+}
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with different start values ***
+
+-- Iteration 1 --
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+bool(false)
+bool(false)
+int(0)
+int(0)
+bool(false)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(2)
+bool(false)
+int(2)
+
+-- Iteration 3 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(8)
+int(7)
+int(6)
+int(0)
+int(0)
+bool(false)
+int(8)
+int(11)
+int(10)
+int(9)
+int(0)
+int(1)
+bool(false)
+int(11)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+
+-- Iteration 4 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(1)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+int(2)
+
+-- Iteration 5 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+
+-- Iteration 6 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+
+-- Iteration 7 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(4)
+int(3)
+int(2)
+int(0)
+int(0)
+bool(false)
+int(4)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(0)
+int(2)
+int(1)
+int(0)
+int(0)
+int(0)
+bool(false)
+int(2)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation8.phpt b/ext/standard/tests/strings/strspn_variation8.phpt
new file mode 100644
index 000000000..3e9e9ddd8
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation8.phpt
@@ -0,0 +1,1894 @@
+--TEST--
+Test strspn() function : usage variations - with heredoc strings, varying start and len args
+--FILE--
+<?php
+/* Prototype : proto int strspn(string str, string mask [, int start [, int len]])
+ * Description: Finds length of initial segment consisting entirely of characters found in mask.
+ If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars)
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing strspn() : with heredoc string, varying start and len arguments
+*/
+
+echo "*** Testing strspn() : with different start and len values ***\n";
+
+// initialing required variables
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+// defining array of different heredoc strings
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls,
+ $heredoc_with_hexa_octal
+ );
+
+// defining array of different mask strings
+$mask_array = array(
+ "",
+ '',
+ "f\n\\0htersti \l",
+ "\t",
+ "het\ ",
+ "fel\th\ ",
+ "f\t\hiel\100\xaa"
+ );
+
+// defining array of different start values
+$start_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+// defining array of different len values
+$len_array = array(
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
+ );
+
+
+// loop through each element of the array for heredoc str, mask str , start values and len values
+
+$count = 1;
+
+foreach($heredoc_strings as $str) {
+ echo "\n-- Iteration $count --\n";
+ foreach($mask_array as $mask) {
+ foreach($start_array as $start) {
+ foreach($len_array as $len) {
+ var_dump( strspn($str,$mask,$start,$len) );
+ }
+ }
+ }
+ $count++;
+};
+
+echo "Done"
+?>
+--EXPECTF--
+*** Testing strspn() : with different start and len values ***
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 2 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(1)
+int(2)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 3 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(8)
+int(8)
+int(0)
+int(0)
+int(1)
+int(2)
+int(7)
+int(7)
+int(0)
+int(0)
+int(1)
+int(2)
+int(6)
+int(6)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(8)
+int(8)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+
+-- Iteration 4 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+int(0)
+int(1)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 5 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 6 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 7 --
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+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(0)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+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(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(1)
+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(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+int(0)
+int(1)
+int(2)
+int(3)
+int(3)
+int(0)
+int(0)
+int(1)
+int(2)
+int(2)
+int(2)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(2)
+int(4)
+int(4)
+int(0)
+Done \ No newline at end of file
diff --git a/ext/standard/tests/strings/strspn_variation9.phpt b/ext/standard/tests/strings/strspn_variation9.phpt
new file mode 100644
index 000000000..14af0ca0a
--- /dev/null
+++ b/ext/standard/tests/strings/strspn_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
index fc00ea098..ab10c9efb 100644
--- a/ext/standard/tests/strings/strstr.phpt
+++ b/ext/standard/tests/strings/strstr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtok_basic.phpt b/ext/standard/tests/strings/strtok_basic.phpt
new file mode 100644
index 000000000..6ba48f41e
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_basic.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test strtok() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : basic functionality
+*/
+
+echo "*** Testing strtok() : basic functionality ***\n";
+
+// Initialize all required variables
+$str = 'This testcase test strtok() function.';
+$token = ' ().';
+
+echo "\nThe Input string is:\n\"$str\"\n";
+echo "\nThe token string is:\n\"$token\"\n";
+
+// using strtok() with $str argument
+echo "\n--- Token 1 ---\n";
+var_dump( strtok($str, $token) );
+
+for( $i = 2; $i <=7; $i++ ) {
+ echo "\n--- Token $i ---\n";
+ var_dump( strtok($token) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : basic functionality ***
+
+The Input string is:
+"This testcase test strtok() function."
+
+The token string is:
+" ()."
+
+--- Token 1 ---
+string(4) "This"
+
+--- Token 2 ---
+string(8) "testcase"
+
+--- Token 3 ---
+string(4) "test"
+
+--- Token 4 ---
+string(6) "strtok"
+
+--- Token 5 ---
+string(8) "function"
+
+--- Token 6 ---
+bool(false)
+
+--- Token 7 ---
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strtok_error.phpt b/ext/standard/tests/strings/strtok_error.phpt
new file mode 100644
index 000000000..d83085b0c
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_error.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test strtok() function : error conditions
+--FILE--
+<?php
+/* Prototype : string strtok ( string $str, string $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() for error conditions
+*/
+
+echo "*** Testing strtok() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing strtok() function with Zero arguments --\n";
+var_dump( strtok() );
+
+// More than expected number of arguments
+echo "\n-- Testing strtok() function with more than expected no. of arguments --\n";
+$str = 'sample string';
+$token = ' ';
+$extra_arg = 10;
+
+var_dump( strtok($str, $token, $extra_arg) );
+var_dump( $str );
+
+// Less than expected number of arguments
+echo "\n-- Testing strtok() with less than expected no. of arguments --\n";
+$str = 'string val';
+
+var_dump( strtok($str));
+var_dump( $str );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : error conditions ***
+
+-- Testing strtok() function with Zero arguments --
+
+Warning: Wrong parameter count for strtok() in %s on line %d
+NULL
+
+-- Testing strtok() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for strtok() in %s on line %d
+NULL
+string(13) "sample string"
+
+-- Testing strtok() with less than expected no. of arguments --
+bool(false)
+string(10) "string val"
+Done
diff --git a/ext/standard/tests/strings/strtok_variation1.phpt b/ext/standard/tests/strings/strtok_variation1.phpt
new file mode 100644
index 000000000..3c754c88a
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation1.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test strtok() function : usage variations - first argument as non-string
+--FILE--
+<?php
+/* Prototype : string strtok ( string $str, string $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with first argument as non-string
+*/
+
+echo "*** Testing strtok() : with first argument as non-string ***\n";
+// initialize all required variables
+$token = '-';
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj-ect";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red-color', 'item' => 'pen-color'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+
+// loop through each element of the array and check the working of strtok()
+// when $str arugment is supplied with different values
+
+echo "\n--- Testing strtok() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( strtok($str, $token) );
+
+ $counter ++;
+}
+
+//closing the resource
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with first argument as non-string ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing strtok() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(4) "2345"
+-- Iteration 5 --
+string(4) "10.5"
+-- Iteration 6 --
+string(4) "10.5"
+-- Iteration 7 --
+string(12) "105000000000"
+-- Iteration 8 --
+string(5) "1.06E"
+-- Iteration 9 --
+string(3) "0.5"
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+string(1) "1"
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+string(3) "obj"
+-- 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 --
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/strtok_variation2.phpt b/ext/standard/tests/strings/strtok_variation2.phpt
new file mode 100644
index 000000000..e08005ca7
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation2.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test strtok() function : usage variations - with different token strings
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with different token strings
+*/
+
+echo "*** Testing strtok() : with different token strings ***\n";
+// initialize all required variables
+$str = 'this testcase test strtok() function ';
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// declaring a class
+class sample {
+ public function __toString() {
+ return "obj-ect";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new sample(),
+
+ // empty string
+ "",
+ '',
+
+ // null vlaues
+ NULL,
+ null,
+
+ // undefined variable
+ $undefined_var,
+
+ // unset variable
+ $unset_var,
+
+ // resource
+ $file_handle
+);
+
+
+// loop through each element of the array and check the working of strtok()
+// when $token arugment is supplied with different values
+
+echo "\n--- Testing strtok() by supplying different values for 'token' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $token = $values [$index];
+
+ var_dump( strtok($str, $token) );
+
+ $counter ++;
+}
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with different token strings ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+--- Testing strtok() by supplying different values for 'token' argument ---
+-- Iteration 1 --
+string(37) "this testcase test strtok() function "
+-- Iteration 2 --
+string(37) "this testcase test strtok() function "
+-- Iteration 3 --
+string(37) "this testcase test strtok() function "
+-- Iteration 4 --
+string(37) "this testcase test strtok() function "
+-- Iteration 5 --
+string(37) "this testcase test strtok() function "
+-- Iteration 6 --
+string(37) "this testcase test strtok() function "
+-- Iteration 7 --
+string(37) "this testcase test strtok() function "
+-- Iteration 8 --
+string(37) "this testcase test strtok() function "
+-- Iteration 9 --
+string(37) "this testcase test strtok() function "
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "this testc"
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "this testc"
+-- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "this testc"
+-- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "this testc"
+-- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(10) "this testc"
+-- Iteration 15 --
+string(37) "this testcase test strtok() function "
+-- Iteration 16 --
+string(37) "this testcase test strtok() function "
+-- Iteration 17 --
+string(37) "this testcase test strtok() function "
+-- Iteration 18 --
+string(37) "this testcase test strtok() function "
+-- Iteration 19 --
+string(4) "his "
+-- Iteration 20 --
+string(37) "this testcase test strtok() function "
+-- Iteration 21 --
+string(37) "this testcase test strtok() function "
+-- Iteration 22 --
+string(37) "this testcase test strtok() function "
+-- Iteration 23 --
+string(37) "this testcase test strtok() function "
+-- Iteration 24 --
+string(37) "this testcase test strtok() function "
+-- Iteration 25 --
+string(37) "this testcase test strtok() function "
+-- Iteration 26 --
+string(2) "th"
+Done
diff --git a/ext/standard/tests/strings/strtok_variation3.phpt b/ext/standard/tests/strings/strtok_variation3.phpt
new file mode 100644
index 000000000..3026d86a0
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation3.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test strtok() function : usage variations - with heredoc strings
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with heredoc strings
+*/
+
+echo "*** Testing strtok() : with heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_strings = array(
+ $empty_heredoc,
+ $heredoc_with_newline,
+ $heredoc_with_characters,
+ $heredoc_with_newline_and_tabs,
+ $heredoc_with_alphanumerics,
+ $heredoc_with_embedded_nulls
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string values
+
+$count = 1;
+foreach($heredoc_strings as $string) {
+ echo "\n--- Iteration $count ---\n";
+ var_dump( strtok($string, "5o\0\n\t") );
+ for($counter = 1; $counter <= 10; $counter++) {
+ var_dump( strtok("5o\0\n\t") );
+ }
+ $count++;
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with heredoc strings ***
+
+--- Iteration 1 ---
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 2 ---
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 3 ---
+string(11) "first line "
+string(7) "f hered"
+string(8) "c string"
+string(3) "sec"
+string(8) "nd line "
+string(7) "f hered"
+string(8) "c string"
+string(11) "third line "
+string(7) "f hered"
+string(7) "cstring"
+bool(false)
+
+--- Iteration 4 ---
+string(4) "hell"
+string(1) "w"
+string(3) "rld"
+string(4) "hell"
+string(1) "w"
+string(3) "rld"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 5 ---
+string(4) "hell"
+string(4) "123w"
+string(4) "rld4"
+string(1) "6"
+string(8) "1234hell"
+string(4) "1234"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 6 ---
+string(4) "hell"
+string(1) "w"
+string(3) "rld"
+string(4) "hell"
+string(4) "hell"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strtok_variation4.phpt b/ext/standard/tests/strings/strtok_variation4.phpt
new file mode 100644
index 000000000..6f4fa6621
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation4.phpt
@@ -0,0 +1,110 @@
+--TEST--
+Test strtok() function : usage variations - with embedded nulls in the strings
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with embedded nulls in the strings
+*/
+
+echo "*** Testing strtok() : with embedded nulls in the strings ***\n";
+
+// defining varous strings with embedded nulls
+$strings_with_nulls = array(
+ "\0",
+ '\0',
+ "hello\0world",
+ "\0hel\0lo",
+ "hello\0",
+ "\0\0hello\tworld\0\0",
+ "\\0he\0llo\\0",
+ 'hello\0\0'
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string values
+
+$counter = 1;
+foreach( $strings_with_nulls as $string ) {
+ echo "\n--- Iteration $counter ---\n";
+ var_dump( strtok($string, "\0") );
+ for($count = 1; $count <= 5; $count++) {
+ var_dump( strtok("\0") );
+ }
+ $counter++;
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with embedded nulls in the strings ***
+
+--- Iteration 1 ---
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 2 ---
+string(2) "\0"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 3 ---
+string(5) "hello"
+string(5) "world"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 4 ---
+string(3) "hel"
+string(2) "lo"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 5 ---
+string(5) "hello"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 6 ---
+string(11) "hello world"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 7 ---
+string(4) "\0he"
+string(5) "llo\0"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 8 ---
+string(9) "hello\0\0"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strtok_variation5.phpt b/ext/standard/tests/strings/strtok_variation5.phpt
new file mode 100644
index 000000000..c49f7ded9
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation5.phpt
@@ -0,0 +1,150 @@
+--TEST--
+Test strtok() function : usage variations - miscellaneous inputs
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with miscellaneous combinations of string and token
+*/
+
+echo "*** Testing strtok() : with miscellaneous inputs ***\n";
+
+// defining arrays for input strings and tokens
+$string_array = array(
+ "HELLO WORLD",
+ "hello world",
+ "_HELLO_WORLD_",
+ "/thello/t/wor/ttld",
+ "hel/lo/t/world",
+ "one:$:two:!:three:#:four",
+ "\rhello/r/wor\rrld",
+ chr(0),
+ chr(0).chr(0),
+ chr(0).'hello'.chr(0),
+ 'hello'.chr(0).'world'
+ );
+$token_array = array(
+ "wr",
+ "hello world",
+ "__",
+ "t/",
+ '/t',
+ ":",
+ "\r",
+ "\0",
+ "\0",
+ "\0",
+ "\0",
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string and token values
+
+$counter =1;
+foreach( $string_array as $string ) {
+ echo "\n--- Iteration $counter ---\n";
+ var_dump( strtok($string, $token_array[$counter-1]) );
+ for( $count = 1; $count <=5; $count++ ) {
+ var_dump( strtok($token_array[$counter-1]) );
+ }
+ $counter++;
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with miscellaneous inputs ***
+
+--- Iteration 1 ---
+string(11) "HELLO WORLD"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 2 ---
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 3 ---
+string(5) "HELLO"
+string(5) "WORLD"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 4 ---
+string(5) "hello"
+string(3) "wor"
+string(2) "ld"
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 5 ---
+string(3) "hel"
+string(2) "lo"
+string(5) "world"
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 6 ---
+string(3) "one"
+string(1) "$"
+string(3) "two"
+string(1) "!"
+string(5) "three"
+string(1) "#"
+
+--- Iteration 7 ---
+string(11) "hello/r/wor"
+string(3) "rld"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 8 ---
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 9 ---
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 10 ---
+string(5) "hello"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+
+--- Iteration 11 ---
+string(5) "hello"
+string(5) "world"
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strtok_variation6.phpt b/ext/standard/tests/strings/strtok_variation6.phpt
new file mode 100644
index 000000000..5a77f6f9e
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation6.phpt
@@ -0,0 +1,160 @@
+--TEST--
+Test strtok() function : usage variations - invalid escape sequences as tokens
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : with invalid escape sequences in token
+*/
+
+echo "*** Testing strtok() : with invalid escape sequences in token ***\n";
+
+// defining arrays for input strings and tokens
+$string_array = array(
+ "khellok worldk",
+ "\khello\k world\k",
+ "/khello\k world/k",
+ "/hellok/ world"
+ );
+$token_array = array(
+ "k",
+ "/ ",
+ "/k",
+ "\k",
+ "\\\\\\\k\h\e\l\o\w\r\l\d"
+ );
+
+// loop through each element of the array and check the working of strtok()
+// when supplied with different string and token values
+
+$counter =1;
+foreach( $string_array as $string ) {
+ echo "\n--- Iteration $counter ---\n";
+ foreach( $token_array as $token ) {
+ var_dump( strtok($string, $token) );
+ for( $count = 1; $count <=3; $count++ ) {
+ var_dump( strtok($token) );
+ }
+ echo "\n";
+ }
+ $counter++;
+}
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with invalid escape sequences in token ***
+
+--- Iteration 1 ---
+string(5) "hello"
+string(6) " world"
+bool(false)
+bool(false)
+
+string(7) "khellok"
+string(6) "worldk"
+bool(false)
+bool(false)
+
+string(5) "hello"
+string(6) " world"
+bool(false)
+bool(false)
+
+string(5) "hello"
+string(6) " world"
+bool(false)
+bool(false)
+
+string(1) " "
+string(1) "r"
+bool(false)
+bool(false)
+
+
+--- Iteration 2 ---
+string(1) "\"
+string(6) "hello\"
+string(7) " world\"
+bool(false)
+
+string(9) "\khello\k"
+string(7) "world\k"
+bool(false)
+bool(false)
+
+string(1) "\"
+string(6) "hello\"
+string(7) " world\"
+bool(false)
+
+string(5) "hello"
+string(6) " world"
+bool(false)
+bool(false)
+
+string(1) " "
+string(1) "r"
+bool(false)
+bool(false)
+
+
+--- Iteration 3 ---
+string(1) "/"
+string(6) "hello\"
+string(7) " world/"
+bool(false)
+
+string(8) "khello\k"
+string(5) "world"
+string(1) "k"
+bool(false)
+
+string(6) "hello\"
+string(6) " world"
+bool(false)
+bool(false)
+
+string(1) "/"
+string(5) "hello"
+string(7) " world/"
+bool(false)
+
+string(1) "/"
+string(1) " "
+string(1) "r"
+string(1) "/"
+
+
+--- Iteration 4 ---
+string(6) "/hello"
+string(7) "/ world"
+bool(false)
+bool(false)
+
+string(6) "hellok"
+string(5) "world"
+bool(false)
+bool(false)
+
+string(5) "hello"
+string(6) " world"
+bool(false)
+bool(false)
+
+string(6) "/hello"
+string(7) "/ world"
+bool(false)
+bool(false)
+
+string(1) "/"
+string(2) "/ "
+string(1) "r"
+bool(false)
+
+Done
diff --git a/ext/standard/tests/strings/strtok_variation7.phpt b/ext/standard/tests/strings/strtok_variation7.phpt
new file mode 100644
index 000000000..28cbf7d91
--- /dev/null
+++ b/ext/standard/tests/strings/strtok_variation7.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test strtok() function : usage variations - modifying the input string while tokenising
+--FILE--
+<?php
+/* Prototype : string strtok ( str $str, str $token )
+ * Description: splits a string (str) into smaller strings (tokens), with each token being delimited by any character from token
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Testing strtok() : modifying the input string while it is getting tokenised
+*/
+
+echo "*** Testing strtok() : with modification of input string in between tokenising ***\n";
+
+$str = "this is a sample string";
+$token = " ";
+
+echo "\n*** Testing strtok() when string being tokenised is prefixed with another string in between the process ***\n";
+var_dump( strtok($str, $token) );
+// adding a string to the input string which is being tokenised
+$str = "extra string ".$str;
+for( $count = 1; $count <=6; $count++ ) {
+ echo "\n-- Token $count is --\n";
+ var_dump( strtok($token) );
+ echo "\n-- Input str is \"$str\" --\n";
+}
+
+echo "\n*** Testing strtok() when string being tokenised is suffixed with another string in between the process ***\n";
+var_dump( strtok($str, $token) );
+// adding a string to the input string which is being tokenised
+$str = $str." extra string";
+for( $count = 1; $count <=10; $count++ ) {
+ echo "\n-- Token $count is --\n";
+ var_dump( strtok($token) );
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing strtok() : with modification of input string in between tokenising ***
+
+*** Testing strtok() when string being tokenised is prefixed with another string in between the process ***
+string(4) "this"
+
+-- Token 1 is --
+string(2) "is"
+
+-- Input str is "extra string this is a sample string" --
+
+-- Token 2 is --
+string(1) "a"
+
+-- Input str is "extra string this is a sample string" --
+
+-- Token 3 is --
+string(6) "sample"
+
+-- Input str is "extra string this is a sample string" --
+
+-- Token 4 is --
+string(6) "string"
+
+-- Input str is "extra string this is a sample string" --
+
+-- Token 5 is --
+bool(false)
+
+-- Input str is "extra string this is a sample string" --
+
+-- Token 6 is --
+bool(false)
+
+-- Input str is "extra string this is a sample string" --
+
+*** Testing strtok() when string being tokenised is suffixed with another string in between the process ***
+string(5) "extra"
+
+-- Token 1 is --
+string(6) "string"
+
+-- Token 2 is --
+string(4) "this"
+
+-- Token 3 is --
+string(2) "is"
+
+-- Token 4 is --
+string(1) "a"
+
+-- Token 5 is --
+string(6) "sample"
+
+-- Token 6 is --
+string(6) "string"
+
+-- Token 7 is --
+bool(false)
+
+-- Token 8 is --
+bool(false)
+
+-- Token 9 is --
+bool(false)
+
+-- Token 10 is --
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt
index a59c1c4a5..b22bc19a5 100644
--- a/ext/standard/tests/strings/strtolower.phpt
+++ b/ext/standard/tests/strings/strtolower.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt
index a1948f163..9fb7e47f0 100644
--- a/ext/standard/tests/strings/strtoupper1.phpt
+++ b/ext/standard/tests/strings/strtoupper1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtr_basic.phpt b/ext/standard/tests/strings/strtr_basic.phpt
new file mode 100644
index 000000000..2892ab008
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_basic.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test strtr() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ * Description: Translates characters in str using given translation pairs
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strtr() : basic functionality ***\n";
+//definitions of required input variables
+$trans1_arr = array("t" => "T", "e" => "E", "st" => "ST");
+$trans2_arr = array('t' => 'T', 'e' => 'E', 'st' => 'ST');
+$heredoc_str = <<<EOD
+test strtr
+EOD;
+
+//translating single char
+var_dump( strtr("test strtr", "t", "T") );
+var_dump( strtr('test strtr', 't', 'T') );
+var_dump( strtr($heredoc_str, "t", "T") );
+
+//translating set of chars
+//$from and $to are of same length
+var_dump( strtr("test strtr", "test", "TEST") );
+var_dump( strtr('test strtr', 'test', 'TEST') );
+var_dump( strtr($heredoc_str, "test", "TEST") );
+
+//$from and $to are of different lengths, extra chars in the longer one are ignored
+var_dump( strtr("test strtr", "test", "TESTz") );
+var_dump( strtr('test strtr', 'testz', 'TEST') );
+var_dump( strtr($heredoc_str, "test", "TESTz") );
+
+//by using replace_pairs array
+var_dump( strtr("test strtr", $trans1_arr) );
+var_dump( strtr('test strtr', $trans2_arr) );
+var_dump( strtr($heredoc_str, $trans1_arr) );
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : basic functionality ***
+string(10) "TesT sTrTr"
+string(10) "TesT sTrTr"
+string(10) "TesT sTrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+string(10) "TEST STrTr"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_error.phpt b/ext/standard/tests/strings/strtr_error.phpt
new file mode 100644
index 000000000..8466a9201
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_error.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test strtr() function : error conditions
+--FILE--
+<?php
+/* Prototype : string strtr(string str, string from[, string to])
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing strtr() : error conditions ***\n";
+$str = "string";
+$from = "string";
+$to = "STRING";
+$extra_arg = "extra_argument";
+
+echo "\n-- Testing strtr() function with Zero arguments --";
+var_dump( strtr() );
+
+echo "\n-- Testing strtr() function with less than expected no. of arguments --";
+var_dump( strtr($str) );
+
+echo "\n-- Testing strtr() function with more than expected no. of arguments --";
+var_dump( strtr($str, $from, $to, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing strtr() : error conditions ***
+
+-- Testing strtr() function with Zero arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+
+-- Testing strtr() function with less than expected no. of arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+
+-- Testing strtr() function with more than expected no. of arguments --
+Warning: Wrong parameter count for strtr() in %s on line %d
+NULL
+Done
diff --git a/ext/standard/tests/strings/strtr_variation1.phpt b/ext/standard/tests/strings/strtr_variation1.phpt
new file mode 100644
index 000000000..640194fd4
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation1.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Test strtr() function : usage variations - regular & numeric strings for 'str' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * combination of numeric & regular strings for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : numeric & regular double quoted strings ***\n";
+/* definitions of required input variables */
+$count = 1;
+$heredoc_str = <<<EOD
+123
+abc
+1a2b3c
+EOD;
+//array of string inputs for $str
+$str_arr = array(
+ //double quoted strings
+ "123",
+ "abc",
+ "1a2b3c",
+
+ //single quoted strings
+ '123',
+ 'abc',
+ '1a2b3c',
+
+ //heredoc string
+ $heredoc_str
+);
+$from = "123abc";
+$to = "abc123";
+$replace_pairs = array("1" => "a", "a" => 1, "2b3c" => "b2c3", "b2c3" => "3c2b");
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+ echo "-- Iteration $count --\n";
+
+ $str = $str_arr[$index]; //getting the $str_arr element in $str variable
+
+ //strtr() call in three args syntax form
+ var_dump( strtr($str, $from, $to) );
+
+ //strtr() call in two args syntax form
+ var_dump( strtr($str, $replace_pairs) );
+
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : numeric & regular double quoted strings ***
+-- Iteration 1 --
+string(3) "abc"
+string(3) "a23"
+-- Iteration 2 --
+string(3) "123"
+string(3) "1bc"
+-- Iteration 3 --
+string(6) "a1b2c3"
+string(6) "a1b2c3"
+-- Iteration 4 --
+string(3) "abc"
+string(3) "a23"
+-- Iteration 5 --
+string(3) "123"
+string(3) "1bc"
+-- Iteration 6 --
+string(6) "a1b2c3"
+string(6) "a1b2c3"
+-- Iteration 7 --
+string(14) "abc
+123
+a1b2c3"
+string(14) "a23
+1bc
+a1b2c3"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation2.phpt b/ext/standard/tests/strings/strtr_variation2.phpt
new file mode 100644
index 000000000..5772f01fc
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation2.phpt
@@ -0,0 +1,90 @@
+--TEST--
+Test strtr() function : usage variations - string containing special chars for 'str' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * string containing various special characters for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : string containing special chars for 'str' arg ***\n";
+
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+%
+#$*&
+text & @()
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+ //double quoted strings
+ "%",
+ "#$*",
+ "text & @()",
+
+ //single quoted strings
+ '%',
+ '#$*',
+ 'text & @()',
+
+ //heredoc string
+ $heredoc_str
+);
+
+$from = "%#$*&@()";
+$to = "specials";
+$replace_pairs = array("$" => "%", "%" => "$", "#*&@()" => "()@&*#");
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+ echo "-- Iteration $count --\n";
+
+ $str = $str_arr[$index]; //getting the array element in 'str' variable
+
+ //strtr() call in three args syntax form
+ var_dump( strtr($str, $from, $to) );
+
+ //strtr() call in two args syntax form
+ var_dump( strtr($str, $replace_pairs) );
+
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : string containing special chars for 'str' arg ***
+-- Iteration 1 --
+string(1) "s"
+string(1) "$"
+-- Iteration 2 --
+string(3) "pec"
+string(3) "#%*"
+-- Iteration 3 --
+string(10) "text i als"
+string(10) "text & @()"
+-- Iteration 4 --
+string(1) "s"
+string(1) "$"
+-- Iteration 5 --
+string(3) "pec"
+string(3) "#%*"
+-- Iteration 6 --
+string(10) "text i als"
+string(10) "text & @()"
+-- Iteration 7 --
+string(17) "s
+peci
+text i als"
+string(17) "$
+#%*&
+text & @()"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation3.phpt b/ext/standard/tests/strings/strtr_variation3.phpt
new file mode 100644
index 000000000..fe546dc8c
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation3.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test strtr() function : usage variations - string containing escape sequences for 'str' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * string containing various escape sequences for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : string containing escape sequences for 'str' arg ***\n";
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+\tes\t\\stt\r
+\\test\\\strtr
+\ntest\r\nstrtr
+\$variable
+\"quotes
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+ //double quoted strings
+ "\tes\t\\stt\r",
+ "\\test\\\strtr",
+ "\ntest\r\nstrtr",
+ "\$variable",
+ "\"quotes",
+
+ //single quoted strings
+ '\tes\t\\stt\r',
+ '\\test\\\strtr',
+ '\ntest\r\nstrtr',
+ '\$variable',
+ '\"quotes',
+
+ //heredoc string
+ $heredoc_str
+);
+
+$from = "\n\r\t\\";
+$to = "TEST";
+$replace_pairs = array("\n" => "t", "\r\n" => "T", "\n\r\t\\" => "TEST");
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+ echo "-- Iteration $count --\n";
+
+ $str = $str_arr[$index]; //getting the array element in 'str' variable
+
+ //strtr() call in three args syntax form
+ var_dump( strtr($str, $from, $to) );
+
+ //strtr() call in two args syntax form
+ var_dump( strtr($str, $replace_pairs) );
+
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : string containing escape sequences for 'str' arg ***
+-- Iteration 1 --
+string(9) "SesSTsttE"
+string(9) " es \stt "
+-- Iteration 2 --
+string(12) "TtestTTstrtr"
+string(12) "\test\\strtr"
+-- Iteration 3 --
+string(12) "TtestETstrtr"
+string(11) "ttestTstrtr"
+-- Iteration 4 --
+string(9) "$variable"
+string(9) "$variable"
+-- Iteration 5 --
+string(7) ""quotes"
+string(7) ""quotes"
+-- Iteration 6 --
+string(12) "TtesTtTsttTr"
+string(12) "\tes\t\stt\r"
+-- Iteration 7 --
+string(12) "TtestTTstrtr"
+string(12) "\test\\strtr"
+-- Iteration 8 --
+string(15) "TntestTrTnstrtr"
+string(15) "\ntest\r\nstrtr"
+-- Iteration 9 --
+string(10) "T$variable"
+string(10) "\$variable"
+-- Iteration 10 --
+string(8) "T"quotes"
+string(8) "\"quotes"
+-- Iteration 11 --
+string(54) "SesSTsttETTtestTTstrtrTTtestETstrtrT$variableTT"quotes"
+string(52) " es \sttT\test\\strtrtttestTstrtrt$variablet\"quotes"
+*** Done *** \ No newline at end of file
diff --git a/ext/standard/tests/strings/strtr_variation4.phpt b/ext/standard/tests/strings/strtr_variation4.phpt
new file mode 100644
index 000000000..faec84983
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation4.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test strtr() function : usage variations - empty string & null for 'str' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Testing strtr() function by passing the
+ * empty string & null for 'str' argument and
+ * corresponding translation pair of chars for 'from', 'to' & 'replace_pairs' arguments
+*/
+
+echo "*** Testing strtr() : empty string & null for 'str' arg ***\n";
+/* definitions of required input variables */
+$count = 1;
+
+$heredoc_str = <<<EOD
+
+EOD;
+
+//array of string inputs for $str
+$str_arr = array(
+ "",
+ '',
+ NULL,
+ null,
+ FALSE,
+ false,
+ $heredoc_str
+);
+
+$from = "";
+$to = "TEST";
+$replace_pairs = array("" => "t", '' => "TEST");
+
+
+/* loop through to test strtr() with each element of $str_arr */
+for($index = 0; $index < count($str_arr); $index++) {
+ echo "-- Iteration $count --\n";
+
+ $str = $str_arr[$index]; //getting the array element in 'str' variable
+
+ //strtr() call in three args syntax form
+ var_dump( strtr($str, $from, $to) );
+
+ //strtr() call in two args syntax form
+ var_dump( strtr($str, $replace_pairs) );
+
+ $count++;
+}
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() : empty string & null for 'str' arg ***
+-- Iteration 1 --
+string(0) ""
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+string(0) ""
+-- Iteration 3 --
+string(0) ""
+string(0) ""
+-- Iteration 4 --
+string(0) ""
+string(0) ""
+-- Iteration 5 --
+string(0) ""
+string(0) ""
+-- Iteration 6 --
+string(0) ""
+string(0) ""
+-- Iteration 7 --
+string(0) ""
+string(0) ""
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation5.phpt b/ext/standard/tests/strings/strtr_variation5.phpt
new file mode 100644
index 000000000..7bd170473
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation5.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'str' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'str'
+ * and expected type for 'from' & 'to' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'str' ***\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
+$strings = array (
+
+ // integer values
+ 0,
+ 1,
+ -2,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.5e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+//defining 'from' argument
+$from = "012atm";
+
+//defining 'to' argument
+$to = "atm012";
+
+// loop through with each element of the $strings array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($strings); $index++) {
+ echo "-- Iteration $count --\n";
+ $str = $strings[$index];
+ var_dump( strtr($str, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'str' ***
+-- Iteration 1 --
+string(1) "a"
+-- Iteration 2 --
+string(1) "t"
+-- Iteration 3 --
+string(2) "-m"
+-- Iteration 4 --
+string(4) "ta.5"
+-- Iteration 5 --
+string(5) "-ma.5"
+-- Iteration 6 --
+string(12) "ta5aaaaaaaaa"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Arr0y"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Arr0y"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Arr0y"
+-- Iteration 10 --
+string(1) "t"
+-- Iteration 11 --
+string(0) ""
+-- Iteration 12 --
+string(1) "t"
+-- Iteration 13 --
+string(0) ""
+-- Iteration 14 --
+string(0) ""
+-- Iteration 15 --
+string(0) ""
+-- Iteration 16 --
+string(13) "s02ple objec1"
+-- Iteration 17 --
+string(%d) "Resource id #%d"
+-- Iteration 18 --
+string(0) ""
+-- Iteration 19 --
+string(0) ""
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt
new file mode 100644
index 000000000..2d8ab7183
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation6.phpt
@@ -0,0 +1,137 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'from' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'from'
+ * and expected type for 'str' & 'to' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'from' ***\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");
+
+//defining 'str' argument
+$str = "012atm";
+
+// array of values for 'from'
+$from_arr = array (
+
+ // integer values
+ 0,
+ 1,
+ -2,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.5e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+//defining 'to' argument
+$to = "atm012";
+
+// loop through with each element of the $from array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($from_arr); $index++) {
+ echo "-- Iteration $count --\n";
+ $from = $from_arr[$index];
+ var_dump( strtr($str, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'from' ***
+-- Iteration 1 --
+string(6) "a12atm"
+-- Iteration 2 --
+string(6) "0a2atm"
+-- Iteration 3 --
+string(6) "01tatm"
+-- Iteration 4 --
+string(6) "ta2atm"
+-- Iteration 5 --
+string(6) "m1tatm"
+-- Iteration 6 --
+string(6) "2a2atm"
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "0120tm"
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "0120tm"
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "0120tm"
+-- Iteration 10 --
+string(6) "0a2atm"
+-- Iteration 11 --
+string(6) "012atm"
+-- Iteration 12 --
+string(6) "0a2atm"
+-- Iteration 13 --
+string(6) "012atm"
+-- Iteration 14 --
+string(6) "012atm"
+-- Iteration 15 --
+string(6) "012atm"
+-- Iteration 16 --
+string(6) "012ttm"
+-- Iteration 17 --
+string(6) "012atm"
+-- Iteration 18 --
+string(6) "012atm"
+-- Iteration 19 --
+string(6) "012atm"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation7.phpt b/ext/standard/tests/strings/strtr_variation7.phpt
new file mode 100644
index 000000000..04b742f31
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation7.phpt
@@ -0,0 +1,156 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'to' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'to'
+ * and expected types for 'str' & 'from' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'to' ***\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");
+
+//defining 'str' argument
+$str = "012atm";
+
+//defining 'from' argument
+$from = "atm012";
+
+// array of values for 'to' argument
+$to_arr = array (
+
+ // integer values
+ 0,
+ 1,
+ -2,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.5e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $to array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($to_arr); $index++) {
+ echo "\n-- Iteration $count --\n";
+ $to = $to_arr[$index];
+ var_dump( strtr($str, $from, $to) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'to' ***
+
+-- Iteration 1 --
+string(6) "0120tm"
+
+-- Iteration 2 --
+string(6) "0121tm"
+
+-- Iteration 3 --
+string(6) "012-2m"
+
+-- Iteration 4 --
+string(6) "51210."
+
+-- Iteration 5 --
+string(6) ".52-20"
+
+-- Iteration 6 --
+string(6) "000105"
+
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "ay2Arr"
+
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "ay2Arr"
+
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+string(6) "ay2Arr"
+
+-- Iteration 10 --
+string(6) "0121tm"
+
+-- Iteration 11 --
+string(6) "012atm"
+
+-- Iteration 12 --
+string(6) "0121tm"
+
+-- Iteration 13 --
+string(6) "012atm"
+
+-- Iteration 14 --
+string(6) "012atm"
+
+-- Iteration 15 --
+string(6) "012atm"
+
+-- Iteration 16 --
+string(6) "plesam"
+
+-- Iteration 17 --
+string(6) "ourRes"
+
+-- Iteration 18 --
+string(6) "012atm"
+
+-- Iteration 19 --
+string(6) "012atm"
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt
new file mode 100644
index 000000000..4d2b42b02
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation8.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for 'replace_pairs' argument
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'replace_pairs'
+ * and expected type for 'str' arguments
+*/
+
+echo "*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***\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");
+
+//defining 'str' argument
+$str = "012atm";
+
+// array of inputs for 'replace_pairs' argument
+$replace_pairs_arr = array (
+
+ // integer values
+ 0,
+ 1,
+ -2,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.5e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1, 2),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $replace_pairs array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($replace_pairs_arr); $index++) {
+ echo "\n-- Iteration $count --\n";
+ $replace_pairs = $replace_pairs_arr[$index];
+ var_dump( strtr($str, $replace_pairs) );
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***
+
+-- Iteration 1 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+string(6) "012atm"
+
+-- Iteration 8 --
+string(6) "012atm"
+
+-- Iteration 9 --
+string(6) "122atm"
+
+-- Iteration 10 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/strtr_variation9.phpt b/ext/standard/tests/strings/strtr_variation9.phpt
new file mode 100644
index 000000000..0f5875c72
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_variation9.phpt
@@ -0,0 +1,243 @@
+--TEST--
+Test strtr() function : usage variations - unexpected inputs for all arguments
+--FILE--
+<?php
+/* Prototype : string strtr(string $str, string $from[, string $to]);
+ string strtr(string $str, array $replace_pairs);
+ * Description: Translates characters in str using given translation tables
+ * Source code: ext/standard/string.c
+*/
+
+/* Test strtr() function: with unexpected inputs for 'str', 'from', 'to' & 'replace_pairs' arguments */
+
+echo "*** Testing strtr() function: with unexpected inputs for all arguments ***\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
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ -2,
+
+ // float values
+ 10.5,
+ -20.5,
+ 10.5e10,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // null vlaues
+ NULL,
+ null,
+
+ // objects
+ new sample(),
+
+ // resource
+ $file_handle,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop through with each element of the $values array to test strtr() function
+$count = 1;
+for($index = 0; $index < count($values); $index++) {
+ echo "\n-- Iteration $count --\n";
+ var_dump( strtr($values[$index], $values[$index], $values[$index]) ); //fn call with three args
+ var_dump( strtr($values[$index], $values[$index]) ); //fn call with two args
+ $count ++;
+}
+
+fclose($file_handle); //closing the file handle
+
+echo "*** Done ***";
+?>
+--EXPECTF--
+*** Testing strtr() function: with unexpected inputs for all arguments ***
+
+-- Iteration 1 --
+string(1) "0"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+string(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+string(2) "-2"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+string(4) "10.5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+string(5) "-20.5"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+string(12) "105000000000"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 7 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 8 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 9 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+-- Iteration 12 --
+string(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+string(1) "1"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 18 --
+string(13) "sample object"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 19 --
+string(%d) "Resource id #%d"
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 20 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+string(0) ""
+
+Warning: strtr(): The second argument is not an array in %s on line %d
+bool(false)
+*** Done ***
diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt
index 01d4caa6a..f8284c3a1 100644
--- a/ext/standard/tests/strings/substr_count_error.phpt
+++ b/ext/standard/tests/strings/substr_count_error.phpt
@@ -40,26 +40,26 @@ NULL
Notice: Undefined variable: str in %s on line %d
-Warning: substr_count(): Offset should be greater than or equal to 0. in %s on line %d
+Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d
bool(false)
Notice: Undefined variable: str in %s on line %d
-Warning: substr_count(): Offset value 25 exceeds string length. in %s on line %d
+Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d
bool(false)
Notice: Undefined variable: str in %s on line %d
-Warning: substr_count(): Offset value 5 exceeds string length. in %s on line %d
+Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d
bool(false)
Notice: Undefined variable: str in %s on line %d
-Warning: substr_count(): Length should be greater than 0. in %s on line %d
+Warning: substr_count(): Length should be greater than 0 in %s on line %d
bool(false)
Notice: Undefined variable: str in %s on line %d
-Warning: substr_count(): Length should be greater than 0. in %s on line %d
+Warning: substr_count(): Length should be greater than 0 in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/strings/ucwords_basic.phpt b/ext/standard/tests/strings/ucwords_basic.phpt
new file mode 100644
index 000000000..f34d8e912
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_basic.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Test ucwords() function : basic functionality
+--INI--
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ucwords() : basic functionality ***\n";
+
+// lines with different whitespace charecter
+$str_array = array(
+ "testing ucwords",
+ 'testing ucwords',
+ 'testing\tucwords',
+ "testing\tucwords",
+ "testing\nucwords",
+ 'testing\nucwords',
+ "testing\vucwords",
+ 'testing\vucwords',
+ "testing",
+ 'testing',
+ ' testing',
+ " testing",
+ "testing ucwords",
+ 'testing ucwords',
+ 'testing\rucwords',
+ "testing\rucwords",
+ 'testing\fucwords',
+ "testing\fucwords"
+);
+
+// loop through the $strings array to test ucwords on each element
+$iteration = 1;
+for($index = 0; $index < count($str_array); $index++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( ucwords($str_array[$index]) );
+ $iteration++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : basic functionality ***
+-- Iteration 1 --
+string(15) "Testing Ucwords"
+-- Iteration 2 --
+string(15) "Testing Ucwords"
+-- Iteration 3 --
+string(16) "Testing\tucwords"
+-- Iteration 4 --
+string(15) "Testing Ucwords"
+-- Iteration 5 --
+string(15) "Testing
+Ucwords"
+-- Iteration 6 --
+string(16) "Testing\nucwords"
+-- Iteration 7 --
+string(15) "Testing Ucwords"
+-- Iteration 8 --
+string(16) "Testing\vucwords"
+-- Iteration 9 --
+string(7) "Testing"
+-- Iteration 10 --
+string(7) "Testing"
+-- Iteration 11 --
+string(8) " Testing"
+-- Iteration 12 --
+string(8) " Testing"
+-- Iteration 13 --
+string(16) "Testing Ucwords"
+-- Iteration 14 --
+string(16) "Testing Ucwords"
+-- Iteration 15 --
+string(16) "Testing\rucwords"
+-- Iteration 16 --
+string(15) "Testing Ucwords"
+-- Iteration 17 --
+string(16) "Testing\fucwords"
+-- Iteration 18 --
+string(15) "Testing Ucwords"
+Done
diff --git a/ext/standard/tests/strings/ucwords_error.phpt b/ext/standard/tests/strings/ucwords_error.phpt
new file mode 100644
index 000000000..cd6e7513c
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_error.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test ucwords() function : error conditions
+--INI--
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing ucwords() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing ucwords() function with Zero arguments --\n";
+var_dump( ucwords() );
+
+// More than expected number of arguments
+echo "\n-- Testing ucwords() function with more than expected no. of arguments --\n";
+$str = 'string_val';
+$extra_arg = 10;
+
+var_dump( ucwords($str, $extra_arg) );
+
+// check if there were any changes made to $str
+var_dump($str);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : error conditions ***
+
+-- Testing ucwords() function with Zero arguments --
+
+Warning: Wrong parameter count for ucwords() in %s on line %d
+NULL
+
+-- Testing ucwords() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for ucwords() in %s on line %d
+NULL
+string(10) "string_val"
+Done
diff --git a/ext/standard/tests/strings/ucwords_variation1.phpt b/ext/standard/tests/strings/ucwords_variation1.phpt
new file mode 100644
index 000000000..2a3ceeeb8
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_variation1.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test ucwords() function : usage variations - unexpected input values
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * Test ucwords() by passing different values including scalar and non scalar values
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+// initialize all required variables
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+$fp = fopen(__FILE__, "r");
+
+class my
+{
+ function __toString() {
+ return "myString";
+ }
+}
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // hex values
+ 0x10,
+ 0X20,
+ 0xAA,
+ -0XF5,
+
+ // octal values
+ 0123,
+ -0342,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new my(),
+
+ // empty string
+ "",
+ '',
+
+ //NULL
+ NULL,
+ null,
+
+ // hex in string
+ "0x123",
+ '0x123',
+ "0xFF12",
+ "-0xFF12",
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var,
+
+ // resource variable
+ $fp
+);
+
+// loop through each element of the array and check the working of ucwords()
+// when $str arugment is supplied with different values
+echo "\n--- Testing ucwords() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( ucwords($str) );
+
+ $counter ++;
+}
+
+// close the file handle
+fclose($fp);
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : usage variations ***
+
+--- Testing ucwords() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+-- Iteration 4 --
+string(5) "-2345"
+-- Iteration 5 --
+string(2) "16"
+-- Iteration 6 --
+string(2) "32"
+-- Iteration 7 --
+string(3) "170"
+-- Iteration 8 --
+string(4) "-245"
+-- Iteration 9 --
+string(2) "83"
+-- Iteration 10 --
+string(4) "-226"
+-- Iteration 11 --
+string(4) "10.5"
+-- Iteration 12 --
+string(5) "-10.5"
+-- Iteration 13 --
+string(12) "105000000000"
+-- Iteration 14 --
+string(7) "1.06E-9"
+-- Iteration 15 --
+string(3) "0.5"
+-- Iteration 16 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 17 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+-- Iteration 21 --
+string(1) "1"
+-- Iteration 22 --
+string(0) ""
+-- Iteration 23 --
+string(1) "1"
+-- Iteration 24 --
+string(0) ""
+-- Iteration 25 --
+string(8) "MyString"
+-- Iteration 26 --
+string(0) ""
+-- Iteration 27 --
+string(0) ""
+-- Iteration 28 --
+string(0) ""
+-- Iteration 29 --
+string(0) ""
+-- Iteration 30 --
+string(5) "0x123"
+-- Iteration 31 --
+string(5) "0x123"
+-- Iteration 32 --
+string(6) "0xFF12"
+-- Iteration 33 --
+string(7) "-0xFF12"
+-- Iteration 34 --
+string(0) ""
+-- Iteration 35 --
+string(0) ""
+-- Iteration 36 --
+string(%d) "Resource Id #%d"
+Done
diff --git a/ext/standard/tests/strings/ucwords_variation2.phpt b/ext/standard/tests/strings/ucwords_variation2.phpt
new file mode 100644
index 000000000..ab6eb2f45
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_variation2.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Test ucwords() function : usage variations - heredoc strings
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using heredoc
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// Null here doc string
+$null_string = <<<EOT
+EOT;
+
+// Heredoc string with blank line
+$blank_line = <<<EOT
+
+EOT;
+
+// here doc with multiline string
+$multiline_string = <<<EOT
+testing ucword() with
+multiline string using
+heredoc
+EOT;
+
+// here doc with diferent whitespaces
+$diff_whitespaces = <<<EOT
+testing\rucword(str)\twith
+multiline string\t\tusing
+heredoc\nstring.with\vdifferent\fwhite\vspaces
+EOT;
+
+// here doc with numeric values
+$numeric_string = <<<EOT
+12sting 123string 4567
+string\t123string\r12 test\n5test
+EOT;
+
+// heredoc with quote chars & slash
+$quote_char_string = <<<EOT
+it's bright,but i cann't see it.
+"things in double quote"
+'things in single quote'
+this\line is /with\slashs
+EOT;
+
+$heredoc_strings = array(
+ $null_string,
+ $blank_line,
+ $multiline_string,
+ $diff_whitespaces,
+ $numeric_string,
+ $quote_char_string
+);
+
+// loop through $heredoc_strings element and check the working on ucwords()
+$count = 1;
+for($index =0; $index < count($heredoc_strings); $index ++) {
+ echo "-- Iteration $count --\n";
+ var_dump( ucwords($heredoc_strings[$index]) );
+ $count ++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : usage variations ***
+-- Iteration 1 --
+string(0) ""
+-- Iteration 2 --
+string(0) ""
+-- Iteration 3 --
+string(52) "Testing Ucword() With
+Multiline String Using
+Heredoc"
+-- Iteration 4 --
+string(93) "Testing Ucword(str) With
+Multiline String Using
+Heredoc
+String.with Different White Spaces"
+-- Iteration 5 --
+string(53) "12sting 123string 4567
+String 123string 12 Test
+5test"
+-- Iteration 6 --
+string(108) "It's Bright,but I Cann't See It.
+"things In Double Quote"
+'things In Single Quote'
+This\line Is /with\slashs"
+Done
diff --git a/ext/standard/tests/strings/ucwords_variation3.phpt b/ext/standard/tests/strings/ucwords_variation3.phpt
new file mode 100644
index 000000000..e6f7c405a
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_variation3.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test ucwords() function : usage variations - single quoted string
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using single quote
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// different strings containing regular chars and special chars
+$str_array = array(
+ // multiple spaces
+ 'testing ucwords',
+ 't e s t i n g u c w o r d s ',
+
+ // brackets in sentence
+ 'testing function(ucwords)',
+ '(testing ( function (ucwords) )a )test',
+ '(t)',
+ ' ( t )t',
+
+ // using quote chars in sentence
+ '"testing",ucword,"test"',
+ '"t""t",test, t',
+ '\'t \'t\',test',
+
+ // using other white spaces
+ '\ttesting\ttesting\tucwords',
+ 'testing\rucwords testing ucwords',
+ 'testing\fucwords \f testing \nucwords',
+ '\ntesting\nucwords\n testing \n ucwords',
+ 'using\vvertical\vtab',
+
+ //using special chars in sentence
+ 't@@#$% %test ^test &test *test +test -test',
+ '!test ~test `test` =test= @test@test.com',
+ '/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/',
+
+ //only special chars
+ '!@#$%^&*()_+=-`~'
+);
+
+// loop through the $str_array array to test ucwords on each element
+$iteration = 1;
+for($index = 0; $index < count($str_array); $index++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( ucwords($str_array[$index]) );
+ $iteration++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : usage variations ***
+-- Iteration 1 --
+string(18) "Testing Ucwords"
+-- Iteration 2 --
+string(30) "T E S T I N G U C W O R D S "
+-- Iteration 3 --
+string(25) "Testing Function(ucwords)"
+-- Iteration 4 --
+string(38) "(testing ( Function (ucwords) )a )test"
+-- Iteration 5 --
+string(3) "(t)"
+-- Iteration 6 --
+string(7) " ( T )t"
+-- Iteration 7 --
+string(23) ""testing",ucword,"test""
+-- Iteration 8 --
+string(14) ""t""t",test, T"
+-- Iteration 9 --
+string(11) "'t 't',test"
+-- Iteration 10 --
+string(27) "\ttesting\ttesting\tucwords"
+-- Iteration 11 --
+string(32) "Testing\rucwords Testing Ucwords"
+-- Iteration 12 --
+string(37) "Testing\fucwords \f Testing \nucwords"
+-- Iteration 13 --
+string(39) "\ntesting\nucwords\n Testing \n Ucwords"
+-- Iteration 14 --
+string(20) "Using\vvertical\vtab"
+-- Iteration 15 --
+string(42) "T@@#$% %test ^test &test *test +test -test"
+-- Iteration 16 --
+string(40) "!test ~test `test` =test= @test@test.com"
+-- Iteration 17 --
+string(40) "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/"
+-- Iteration 18 --
+string(16) "!@#$%^&*()_+=-`~"
+Done
diff --git a/ext/standard/tests/strings/ucwords_variation4.phpt b/ext/standard/tests/strings/ucwords_variation4.phpt
new file mode 100644
index 000000000..bed655082
--- /dev/null
+++ b/ext/standard/tests/strings/ucwords_variation4.phpt
@@ -0,0 +1,124 @@
+--TEST--
+Test ucwords() function : usage variations - double quoted string
+--FILE--
+<?php
+/* Prototype : string ucwords ( string $str )
+ * Description: Uppercase the first character of each word in a string
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test ucwords() with different string prepared using double quote
+*/
+
+echo "*** Testing ucwords() : usage variations ***\n";
+
+// different strings containing regular chars and special chars
+$str_array = array(
+ // multiple spaces
+ "testing ucwords",
+ "t e s t i n g u c w o r d s ",
+
+ // brackets in sentence
+ "testing function(ucwords)",
+ "(testing ( function (ucwords) )a )test",
+ "(t)",
+ " ( t )t",
+
+ // using quote chars in sentence
+ "\"testing\",ucwords,\"test\"",
+ "\"t\"\"t\",test, t",
+ "\'t \'t\',test",
+ "Jack's pen",
+ "P't'y 't it's ",
+
+ // using other white spaces
+ "\ttesting\ttesting\tucwords",
+ "\\ttesting\\ttesting\tucwords",
+ "testing\rucwords testing ucwords",
+ "testing\\rucwords testing ucwords",
+ "testing\fucwords \f testing \nucwords",
+ "testing\\fucwords \\f testing \nucwords",
+ "\ntesting\nucwords\n testing \n ucwords",
+ "\\ntesting\\nucwords\\n testing \\n ucwords",
+ "using\vvertical\vtab",
+ "using\\vvertical\\vtab",
+
+ //using special chars in sentence
+ "t@@#$% %test ^test &test *test +test -test",
+ "!test ~test `test` =test= @test@test.com",
+ "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/",
+
+ //only special chars
+ "!@#$%^&*()_+=-`~"
+);
+
+// loop through the $str_array array to test ucwords on each element
+$iteration = 1;
+for($index = 0; $index < count($str_array); $index++) {
+ echo "-- Iteration $iteration --\n";
+ var_dump( ucwords($str_array[$index]) );
+ $iteration++;
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ucwords() : usage variations ***
+-- Iteration 1 --
+string(18) "Testing Ucwords"
+-- Iteration 2 --
+string(30) "T E S T I N G U C W O R D S "
+-- Iteration 3 --
+string(25) "Testing Function(ucwords)"
+-- Iteration 4 --
+string(38) "(testing ( Function (ucwords) )a )test"
+-- Iteration 5 --
+string(3) "(t)"
+-- Iteration 6 --
+string(7) " ( T )t"
+-- Iteration 7 --
+string(24) ""testing",ucwords,"test""
+-- Iteration 8 --
+string(14) ""t""t",test, T"
+-- Iteration 9 --
+string(14) "\'t \'t\',test"
+-- Iteration 10 --
+string(10) "Jack's Pen"
+-- Iteration 11 --
+string(14) "P't'y 't It's "
+-- Iteration 12 --
+string(24) " Testing Testing Ucwords"
+-- Iteration 13 --
+string(26) "\ttesting\ttesting Ucwords"
+-- Iteration 14 --
+string(31) "Testing Ucwords Testing Ucwords"
+-- Iteration 15 --
+string(32) "Testing\rucwords Testing Ucwords"
+-- Iteration 16 --
+string(34) "Testing Ucwords Testing
+Ucwords"
+-- Iteration 17 --
+string(36) "Testing\fucwords \f Testing
+Ucwords"
+-- Iteration 18 --
+string(35) "
+Testing
+Ucwords
+ Testing
+ Ucwords"
+-- Iteration 19 --
+string(39) "\ntesting\nucwords\n Testing \n Ucwords"
+-- Iteration 20 --
+string(18) "Using Vertical Tab"
+-- Iteration 21 --
+string(20) "Using\vvertical\vtab"
+-- Iteration 22 --
+string(42) "T@@#$% %test ^test &test *test +test -test"
+-- Iteration 23 --
+string(40) "!test ~test `test` =test= @test@test.com"
+-- Iteration 24 --
+string(37) "/test/r Est\ucwords \y\y\u \yy\ /uu/"
+-- Iteration 25 --
+string(16) "!@#$%^&*()_+=-`~"
+Done
diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt
index 9c77a5072..3671cd736 100644
--- a/ext/standard/tests/strings/uuencode.phpt
+++ b/ext/standard/tests/strings/uuencode.phpt
@@ -35,6 +35,6 @@ string(36) "6;F]T('9E<GD@<V]P:&ES=&EC871E9```
"
string(22) "not very sophisticated"
-Warning: convert_uudecode(): The given parameter is not a valid uuencoded string. in %s on line %d
+Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/strings/vsprintf_basic1.phpt b/ext/standard/tests/strings/vsprintf_basic1.phpt
new file mode 100644
index 000000000..6639ac3da
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test vsprintf() function : basic functionality - string format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using string format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%s";
+$format2 = "%s %s";
+$format3 = "%s %s %s";
+$arg1 = array("one");
+$arg2 = array("one","two");
+$arg3 = array("one","two","three");
+
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using string format ***
+string(3) "one"
+string(7) "one two"
+string(13) "one two three"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic2.phpt b/ext/standard/tests/strings/vsprintf_basic2.phpt
new file mode 100644
index 000000000..3e78aab76
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic2.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test vsprintf() function : basic functionality - integer format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Testing vsprintf() : basic functionality - using integer format
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using integer format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%d";
+$format2 = "%d %d";
+$format3 = "%d %d %d";
+$arg1 = array(111);
+$arg2 = array(111,222);
+$arg3 = array(111,222,333);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using integer format ***
+string(3) "111"
+string(7) "111 222"
+string(11) "111 222 333"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic3.phpt b/ext/standard/tests/strings/vsprintf_basic3.phpt
new file mode 100644
index 000000000..bbb6a3267
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic3.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test vsprintf() function : basic functionality - float format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using float format ***\n";
+
+// Initialise all required variables
+
+$format = "format";
+$format1 = "%f";
+$format2 = "%f %f";
+$format3 = "%f %f %f";
+
+$format11 = "%F";
+$format22 = "%F %F";
+$format33 = "%F %F %F";
+$arg1 = array(11.11);
+$arg2 = array(11.11,22.22);
+$arg3 = array(11.11,22.22,33.33);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format11,$arg1) );
+
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format22,$arg2) );
+
+var_dump( vsprintf($format3,$arg3) );
+var_dump( vsprintf($format33,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using float format ***
+string(9) "11.110000"
+string(9) "11.110000"
+string(19) "11.110000 22.220000"
+string(19) "11.110000 22.220000"
+string(29) "11.110000 22.220000 33.330000"
+string(29) "11.110000 22.220000 33.330000"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic4.phpt b/ext/standard/tests/strings/vsprintf_basic4.phpt
new file mode 100644
index 000000000..a82df93ad
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic4.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test vsprintf() function : basic functionality - bool format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using bool format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%b";
+$format2 = "%b %b";
+$format3 = "%b %b %b";
+$arg1 = array(TRUE);
+$arg2 = array(TRUE,FALSE);
+$arg3 = array(TRUE,FALSE,TRUE);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using bool format ***
+string(1) "1"
+string(3) "1 0"
+string(5) "1 0 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic5.phpt b/ext/standard/tests/strings/vsprintf_basic5.phpt
new file mode 100644
index 000000000..a4a43d052
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic5.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test vsprintf() function : basic functionality - char format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using char format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%c";
+$format2 = "%c %c";
+$format3 = "%c %c %c";
+$arg1 = array(65);
+$arg2 = array(65,66);
+$arg3 = array(65,66,67);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using char format ***
+string(1) "A"
+string(3) "A B"
+string(5) "A B C"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic6.phpt b/ext/standard/tests/strings/vsprintf_basic6.phpt
new file mode 100644
index 000000000..f6f6ed58a
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic6.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test vsprintf() function : basic functionality - exponential format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using exponential format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%e";
+$format2 = "%e %e";
+$format3 = "%e %e %e";
+$arg1 = array(1000);
+$arg2 = array(1000,2000);
+$arg3 = array(1000,2000,3000);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using exponential format ***
+string(11) "1.000000e+3"
+string(23) "1.000000e+3 2.000000e+3"
+string(35) "1.000000e+3 2.000000e+3 3.000000e+3"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic7.phpt b/ext/standard/tests/strings/vsprintf_basic7.phpt
new file mode 100644
index 000000000..daf514391
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic7.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test vsprintf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , aaray $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using unsigned format ***
+string(10) "4294966185"
+string(21) "4294966185 4293732729"
+string(32) "4294966185 4293732729 4292621864"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt
new file mode 100644
index 000000000..022919ec7
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test vsprintf() function : basic functionality - unsigned format
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , aaray $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using unsigned format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%u";
+$format2 = "%u %u";
+$format3 = "%u %u %u";
+$arg1 = array(-1111);
+$arg2 = array(-1111,-1234567);
+$arg3 = array(-1111,-1234567,-2345432);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using unsigned format ***
+string(20) "18446744073709550505"
+string(41) "18446744073709550505 18446744073708317049"
+string(62) "18446744073709550505 18446744073708317049 18446744073707206184"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic8.phpt b/ext/standard/tests/strings/vsprintf_basic8.phpt
new file mode 100644
index 000000000..59f17b650
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic8.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test vsprintf() function : basic functionality - octal format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using octal format ***\n";
+
+// Initialise all required variables
+$format = "format";
+$format1 = "%o";
+$format2 = "%o %o";
+$format3 = "%o %o %o";
+$arg1 = array(021);
+$arg2 = array(021,0347);
+$arg3 = array(021,0347,05678);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format3,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using octal format ***
+string(2) "21"
+string(6) "21 347"
+string(10) "21 347 567"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_basic9.phpt b/ext/standard/tests/strings/vsprintf_basic9.phpt
new file mode 100644
index 000000000..42012a5c8
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_basic9.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test vsprintf() function : basic functionality - hexadecimal format
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : basic functionality - using hexadecimal format ***\n";
+
+// Initialising different format strings
+$format = "format";
+$format1 = "%x";
+$format2 = "%x %x";
+$format3 = "%x %x %x";
+
+$format11 = "%X";
+$format22 = "%X %X";
+$format33 = "%X %X %X";
+
+$arg1 = array(11);
+$arg2 = array(11,132);
+$arg3 = array(11,132,177);
+
+var_dump( vsprintf($format1,$arg1) );
+var_dump( vsprintf($format11,$arg1) );
+
+var_dump( vsprintf($format2,$arg2) );
+var_dump( vsprintf($format22,$arg2) );
+
+var_dump( vsprintf($format3,$arg3) );
+var_dump( vsprintf($format33,$arg3) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : basic functionality - using hexadecimal format ***
+string(1) "b"
+string(1) "B"
+string(4) "b 84"
+string(4) "B 84"
+string(7) "b 84 b1"
+string(7) "B 84 B1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_error.phpt b/ext/standard/tests/strings/vsprintf_error.phpt
new file mode 100644
index 000000000..0ece4a420
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_error.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test vsprintf() function : error conditions
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+ */
+
+echo "*** Testing vsprintf() : error conditions ***\n";
+
+// initialising the required variables
+$format = "%s";
+$args = array("hello");
+$extra_arg = "extra arg";
+
+// Zero arguments
+echo "\n-- Testing vsprintf() function with Zero arguments --\n";
+var_dump( vsprintf() );
+
+echo "\n-- Testing vsprintf() function with less than expected no. of arguments --\n";
+var_dump( vsprintf($format) );
+
+echo "\n-- testing vsprintf() function with more than expected no. of arguments --\n";
+var_dump( vsprintf($format, $args, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : error conditions ***
+
+-- Testing vsprintf() function with Zero arguments --
+
+Warning: Wrong parameter count for vsprintf() in %s on line %d
+bool(false)
+
+-- Testing vsprintf() function with less than expected no. of arguments --
+
+Warning: Wrong parameter count for vsprintf() in %s on line %d
+bool(false)
+
+-- testing vsprintf() function with more than expected no. of arguments --
+
+Warning: Wrong parameter count for vsprintf() in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation1.phpt b/ext/standard/tests/strings/vsprintf_variation1.phpt
new file mode 100644
index 000000000..eb0284540
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation1.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test vsprintf() function : usage variations - unexpected values for the format argument
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format, array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unexpected format strings are passed to
+ * the '$format' argument of the function
+*/
+
+echo "*** Testing vsprintf() : with unexpected values for format argument ***\n";
+
+// initialising the required variables
+$args = array(1, 2);
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array data
+ array(),
+ array(0),
+ array(1),
+ array(1,2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for format
+
+$counter = 1;
+foreach($values as $value) {
+ echo "\n -- Iteration $counter --\n";
+ var_dump( vsprintf($value,$args) );
+ $counter++;
+
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : with unexpected values for format argument ***
+
+ -- Iteration 1 --
+string(1) "0"
+
+ -- Iteration 2 --
+string(1) "1"
+
+ -- Iteration 3 --
+string(5) "12345"
+
+ -- Iteration 4 --
+string(5) "-2345"
+
+ -- Iteration 5 --
+string(4) "10.5"
+
+ -- Iteration 6 --
+string(5) "-10.5"
+
+ -- Iteration 7 --
+string(12) "105000000000"
+
+ -- Iteration 8 --
+string(7) "1.06E-9"
+
+ -- Iteration 9 --
+string(3) "0.5"
+
+ -- Iteration 10 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+ -- Iteration 11 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+ -- Iteration 12 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+ -- Iteration 13 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+ -- Iteration 14 --
+
+Notice: Array to string conversion in %s on line %d
+string(5) "Array"
+
+ -- Iteration 15 --
+string(0) ""
+
+ -- Iteration 16 --
+string(0) ""
+
+ -- Iteration 17 --
+string(1) "1"
+
+ -- Iteration 18 --
+string(0) ""
+
+ -- Iteration 19 --
+string(1) "1"
+
+ -- Iteration 20 --
+string(0) ""
+
+ -- Iteration 21 --
+string(0) ""
+
+ -- Iteration 22 --
+string(0) ""
+
+ -- Iteration 23 --
+string(6) "object"
+
+ -- Iteration 24 --
+string(0) ""
+
+ -- Iteration 25 --
+string(0) ""
+
+ -- Iteration 26 --
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation10.phpt b/ext/standard/tests/strings/vsprintf_variation10.phpt
new file mode 100644
index 000000000..42ba2679f
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation10.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vsprintf_variation11.phpt b/ext/standard/tests/strings/vsprintf_variation11.phpt
new file mode 100644
index 000000000..e7fe663c4
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation11.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test vsprintf() function : usage variations - octal formats with octal values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+// looping to test vsprintf() with different octal formats from the above $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing vsprintf() : octal formats with octal values ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(14) "37777777777 1 "
+
+-- Iteration 3 --
+string(38) "20000000000 o, 17777777777 20000000001"
+
+-- Iteration 4 --
+string(38) " 37776543211 0000"
+
+-- Iteration 5 --
+string(32) "111 2222 37777444445 37733333334"
+
+-- Iteration 6 --
+string(17) "11073 7653 123 12"
+
+-- Iteration 7 --
+string(6) "% %o o"
+
+-- Iteration 8 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt
new file mode 100644
index 000000000..61327c84b
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test vsprintf() function : usage variations - octal formats with octal values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats with octal values ***\n";
+
+// defining array of octal formats
+$formats = array(
+ "%o",
+ "%+o %-o %O",
+ "%lo %Lo, %4o %-4o",
+ "%10.4o %-10.4o %04o %04.4o",
+ "%'#2o %'2o %'$2o %'_2o",
+ "%o %o %o %o",
+ "%% %%o %10 o%",
+ '%3$o %4$o %1$o %2$o'
+);
+
+// Arrays of octal values for the format defined in $format.
+// Each sub array contains octal values which correspond to each format string in $format
+$args_array = array(
+ array(00),
+ array(-01, 01, +022),
+ array(-020000000000, 020000000000, 017777777777, -017777777777),
+ array(0123456, 012345678, -01234567, 01234567),
+ array(0111, 02222, -0333333, -044444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(01234, 05678, -01234, 02345),
+ array(03, 04, 01, 02)
+
+);
+
+// looping to test vsprintf() with different octal formats from the above $formats array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing vsprintf() : octal formats with octal values ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(25) "1777777777777777777777 1 "
+
+-- Iteration 3 --
+string(60) "1777777777760000000000 o, 17777777777 1777777777760000000001"
+
+-- Iteration 4 --
+string(49) " 1777777777777776543211 0000"
+
+-- Iteration 5 --
+string(54) "111 2222 1777777777777777444445 1777777777777733333334"
+
+-- Iteration 6 --
+string(17) "11073 7653 123 12"
+
+-- Iteration 7 --
+string(6) "% %o o"
+
+-- Iteration 8 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation12.phpt b/ext/standard/tests/strings/vsprintf_variation12.phpt
new file mode 100644
index 000000000..ab67cc82f
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation12.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test vsprintf() function : usage variations - octal formats with non-octal values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different octal formats from the above $format array
+// and with non-octal values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : octal formats and non-octal values ***
+
+-- Iteration 1 --
+string(116) "2 0 12
+ 361100 o 37777775456 2322
+
+ 30071 14 37777777764 37777416700
+ 12 361100 2 0"
+
+-- Iteration 2 --
+string(146) "2 37777777776 2
+ 361100 o 37720715133 57062645
+
+ 57060664 4475347 37721631371 37720717336
+ 2 361100 2 37777777776"
+
+-- Iteration 3 --
+string(88) "0 0 0
+ 173 o 37777777605 173
+
+ 2322 0 $0 _0
+ 0 173 0 0"
+
+-- Iteration 4 --
+string(75) "1 1 1
+ 1 o 1 1
+
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 5 --
+string(75) "1 1 0
+ 1 o 0 1
+
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt
new file mode 100644
index 000000000..530f05b13
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Test vsprintf() function : usage variations - octal formats with non-octal values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different octal formats and non-octal values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
+
+// defining array of octal formats
+$formats =
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
+
+// Arrays of non octal values for the format defined in $format.
+// Each sub array contains non octal values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different octal formats from the above $format array
+// and with non-octal values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : octal formats and non-octal values ***
+
+-- Iteration 1 --
+string(149) "2 0 12
+ 361100 o 1777777777777777775456 2322
+
+ 30071 14 1777777777777777777764 1777777777777777416700
+ 12 361100 2 0"
+
+-- Iteration 2 --
+string(201) "2 1777777777777777777776 2
+ 361100 o 1777777777777720715133 57062645
+
+ 57060664 4475347 1777777777777721631371 1777777777777720717336
+ 2 361100 2 1777777777777777777776"
+
+-- Iteration 3 --
+string(99) "0 0 0
+ 173 o 1777777777777777777605 173
+
+ 2322 0 $0 _0
+ 0 173 0 0"
+
+-- Iteration 4 --
+string(75) "1 1 1
+ 1 o 1 1
+
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 5 --
+string(75) "1 1 0
+ 1 o 0 1
+
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation13.phpt b/ext/standard/tests/strings/vsprintf_variation13.phpt
new file mode 100644
index 000000000..3e89fa350
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation13.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test vsprintf() function : usage variations - hexa formats with hexa values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+// looping to test vsprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing vsprintf() : hexa formats with hexa values ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(13) "ffffffff 1 22"
+
+-- Iteration 3 --
+string(28) "7fffffff x, 7000000 80000000"
+
+-- Iteration 4 --
+string(35) " ffed2979 0000"
+
+-- Iteration 5 --
+string(22) "#1 2222 1b6db bbbbbbbc"
+
+-- Iteration 6 --
+string(12) "123b fab 0 a"
+
+-- Iteration 7 --
+string(5) "%34 x"
+
+-- Iteration 8 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt
new file mode 100644
index 000000000..749a4a858
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test vsprintf() function : usage variations - hexa formats with hexa values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats with hexa values ***\n";
+
+// defining array of different hexa formats
+$formats = array(
+ "%x",
+ "%+x %-x %X",
+ "%lx %Lx, %4x %-4x",
+ "%10.4x %-10.4x %04x %04.4x",
+ "%'#2x %'2x %'$2x %'_2x",
+ "%x %x %x %x",
+ "% %%x x%",
+ '%3$x %4$x %1$x %2$x'
+);
+
+// Arrays of hexa values for the format defined in $format.
+// Each sub array contains hexa values which correspond to each format string in $format
+$args_array = array(
+ array(0x0),
+ array(-0x1, 0x1, +0x22),
+ array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
+ array(123456, 12345678, -1234567, 1234567),
+ array(1, 0x2222, 0333333, -0x44444444),
+ array(0x123b, 0xfAb, "0xaxz", 01293),
+ array(0x1234, 0x34, 0x2ff),
+ array(0x3, 0x4, 0x1, 0x2)
+
+);
+
+// looping to test vsprintf() with different char octal from the above $format array
+// and with octal values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing vsprintf() : hexa formats with hexa values ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(21) "ffffffffffffffff 1 22"
+
+-- Iteration 3 --
+string(36) "7fffffff x, 7000000 ffffffff80000000"
+
+-- Iteration 4 --
+string(43) " ffffffffffed2979 0000"
+
+-- Iteration 5 --
+string(30) "#1 2222 1b6db ffffffffbbbbbbbc"
+
+-- Iteration 6 --
+string(12) "123b fab 0 a"
+
+-- Iteration 7 --
+string(5) "%34 x"
+
+-- Iteration 8 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation14.phpt b/ext/standard/tests/strings/vsprintf_variation14.phpt
new file mode 100644
index 000000000..bfe816ee1
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation14.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test vsprintf() function : usage variations - hexa formats with non-hexa values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different hexa formats from the above $format array
+// and with non-hexa values from the above $args_array array
+
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : hexa formats and non-hexa values ***
+
+-- Iteration 1 --
+string(101) "2 0 a
+ 1e240 x fffffb2e 4d2
+
+ 3039 c fffffff4 fffe1dc0
+ a 1e240 2 0"
+
+-- Iteration 2 --
+string(124) "2 fffffffe 2
+ 1e240 x ff439a5b bc65a5
+
+ bc61b4 127ae7 ff4732f9 ff439ede
+ 2 1e240 2 fffffffe"
+
+-- Iteration 3 --
+string(82) "0 0 0
+ 7b x ffffff85 7b
+
+ 4d2 0 $0 _0
+ 0 7b 0 0"
+
+-- Iteration 4 --
+string(75) "1 1 1
+ 1 x 1 1
+
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 5 --
+string(75) "1 1 0
+ 1 x 0 1
+
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt
new file mode 100644
index 000000000..f1940ef2e
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test vsprintf() function : usage variations - hexa formats with non-hexa values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different hexa formats and non-hexa values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
+
+// defining array of different hexa formats
+$formats =
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
+
+// Arrays of non hexa values for the format defined in $format.
+// Each sub array contains non hexa values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different hexa formats from the above $format array
+// and with non-hexa values from the above $args_array array
+
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : hexa formats and non-hexa values ***
+
+-- Iteration 1 --
+string(125) "2 0 a
+ 1e240 x fffffffffffffb2e 4d2
+
+ 3039 c fffffffffffffff4 fffffffffffe1dc0
+ a 1e240 2 0"
+
+-- Iteration 2 --
+string(164) "2 fffffffffffffffe 2
+ 1e240 x ffffffffff439a5b bc65a5
+
+ bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
+ 2 1e240 2 fffffffffffffffe"
+
+-- Iteration 3 --
+string(90) "0 0 0
+ 7b x ffffffffffffff85 7b
+
+ 4d2 0 $0 _0
+ 0 7b 0 0"
+
+-- Iteration 4 --
+string(75) "1 1 1
+ 1 x 1 1
+
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 5 --
+string(75) "1 1 0
+ 1 x 0 1
+
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation15.phpt b/ext/standard/tests/strings/vsprintf_variation15.phpt
new file mode 100644
index 000000000..cedfe3f0e
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation15.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test vsprintf() function : usage variations - unsigned formats with unsigned values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10e20, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+// looping to test vsprintf() with different unsigned formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : unsigned formats and unsigned values ***
+
+-- Iteration 1 --
+string(16) "1234567 342391 0"
+
+-- Iteration 2 --
+string(23) "3755744308 u 1234 12345"
+
+-- Iteration 3 --
+string(25) " 1234000 0 120"
+
+-- Iteration 4 --
+string(10) "#1 0 $0 10"
+
+-- Iteration 5 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt
new file mode 100644
index 000000000..3af1738e5
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test vsprintf() function : usage variations - unsigned formats with unsigned values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and unsigned values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n";
+
+// defining array of unsigned formats
+$formats = array(
+ '%u %+u %-u',
+ '%lu %Lu %4u %-4u',
+ '%10.4u %-10.4u %.4u',
+ '%\'#2u %\'2u %\'$2u %\'_2u',
+ '%3$u %4$u %1$u %2$u'
+);
+
+// Arrays of unsigned values for the format defined in $format.
+// Each sub array contains unsigned values which correspond to each format string in $format
+$args_array = array(
+ array(1234567, 01234567, 0 ),
+ array(12345678900, 12345678900, 1234, 12345),
+ array("1234000", 10e20, 1.2e2),
+ array(1, 0, 00, "10_"),
+ array(3, 4, 1, 2)
+);
+
+// looping to test vsprintf() with different unsigned formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : unsigned formats and unsigned values ***
+
+-- Iteration 1 --
+string(16) "1234567 342391 0"
+
+-- Iteration 2 --
+string(24) "12345678900 u 1234 12345"
+
+-- Iteration 3 --
+string(25) " 1234000 0 120"
+
+-- Iteration 4 --
+string(10) "#1 0 $0 10"
+
+-- Iteration 5 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation16.phpt b/ext/standard/tests/strings/vsprintf_variation16.phpt
new file mode 100644
index 000000000..01bcc662d
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation16.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test vsprintf() function : usage variations - unsigned formats with signed and other types of values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different unsigned formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : unsigned formats and signed & other types of values ***
+
+-- Iteration 1 --
+string(115) "2 0 10
+ 123456 u 1234 2820130816
+ 2840207360 1177509888 12345
+ 12 4294967284 4294843840 _3
+ 10 123456 2 0"
+
+-- Iteration 2 --
+string(88) "0 0 0
+ 123 u 4294967173 123
+ 0 0 0
+ 1234 0 $0 _0
+ 0 123 0 0"
+
+-- Iteration 3 --
+string(76) "1 1 1
+ 1 u 1 1
+ 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 4 --
+string(76) "1 1 0
+ 1 u 0 1
+ 1 1 0
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt
new file mode 100644
index 000000000..91a69c7e7
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test vsprintf() function : usage variations - unsigned formats with signed and other types of values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unsigned formats and signed values and other types of values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n";
+
+// defining array of unsigned formats
+$formats =
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
+
+// Arrays of signed and other type of values for the format defined in $format.
+// Each sub array contains signed values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(+2.2, +.2, +10.2,
+ +123456.234, +123456.234, +1234.6789,
+ +2e10, +2e12, +22e+12,
+ +12345.780, +12.000000011111, -12.00000111111, -123456.234,
+ +3.33, +4.44, +1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different unsigned formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : unsigned formats and signed & other types of values ***
+
+-- Iteration 1 --
+string(143) "2 0 10
+ 123456 u 1234 20000000000
+ 2000000000000 22000000000000 12345
+ 12 18446744073709551604 18446744073709428160 _3
+ 10 123456 2 0"
+
+-- Iteration 2 --
+string(98) "0 0 0
+ 123 u 18446744073709551493 123
+ 0 0 0
+ 1234 0 $0 _0
+ 0 123 0 0"
+
+-- Iteration 3 --
+string(76) "1 1 1
+ 1 u 1 1
+ 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 4 --
+string(76) "1 1 0
+ 1 u 0 1
+ 1 1 0
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation17.phpt b/ext/standard/tests/strings/vsprintf_variation17.phpt
new file mode 100644
index 000000000..88cacdd49
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation17.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test vsprintf() function : usage variations - scientific formats with scientific values
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different scientific formats and scientific values
+ * are passed to the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : scientific formats and scientific values ***\n";
+
+// defining array of scientific formats
+$formats = array(
+ '%e %+e %-e',
+ '%le %Le %4e %-4e',
+ '%10.4e %-10.4e %.4e',
+ '%\'#20e %\'20e %\'$20e %\'_20e',
+ '%3$e %4$e %1$e %2$e'
+);
+
+// Arrays of scientific values for the format defined in $format.
+// Each sub array contains scientific values which correspond to each format string in $format
+$args_array = array(
+ array(0, 1e0, "10e2" ),
+ array(2.2e2, 10e10, 1000e-2, 1000e7),
+ array(-22e12, 10e20, 1.2e2),
+ array(1e1, +1e2, -1e3, "1e2_"),
+ array(3e3, 4e3, 1e3, 2e3)
+);
+
+// looping to test vsprintf() with different scientific formats from the above $format array
+// and with signed and other types of values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : scientific formats and scientific values ***
+
+-- Iteration 1 --
+string(36) "0.000000e+0 +1.000000e+0 1.000000e+3"
+
+-- Iteration 2 --
+string(38) "2.200000e+2 e 1.000000e+1 1.000000e+10"
+
+-- Iteration 3 --
+string(32) "-2.2000e+13 1.0000e+21 1.2000e+2"
+
+-- Iteration 4 --
+string(74) "#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2"
+
+-- Iteration 5 --
+string(47) "1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation18.phpt b/ext/standard/tests/strings/vsprintf_variation18.phpt
new file mode 100644
index 000000000..3d1aeba33
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation18.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Test vsprintf() function : usage variations - scientific formats with non-scientific values
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different scientific formats and non-scientific values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : scientific formats and non-scientific values ***\n";
+
+// defining array of non-scientific formats
+$formats =
+ '%e %+e %-e
+ %le %Le %4e %-4e
+ %10.4e %-10.4e %04e %04.4e
+ %\'#2e %\'2e %\'$2e %\'_2e
+ %3$e %4$e %1$e %2$e';
+
+// Arrays of non scientific values for the format defined in $format.
+// Each sub array contains non scientific values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 20.00, +212.2, -411000000000, 2212.000000000001,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different scientific formats from the above $format array
+// and with non-scientific values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : scientific formats and non-scientific values ***
+
+-- Iteration 1 --
+string(232) "2.200000e+0 +2.000000e-1 1.020000e+1
+ 1.234562e+5 e -1.234679e+3 1.234679e+3
+ 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3
+ 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5
+ 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1"
+
+-- Iteration 2 --
+string(228) "0.000000e+0 +0.000000e+0 0.000000e+0
+ 1.230000e+2 e -1.230000e+2 1.230000e+2
+ 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0
+ 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0
+ 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0"
+
+-- Iteration 3 --
+string(227) "1.000000e+0 +1.000000e+0 1.000000e+0
+ 1.000000e+0 e 1.000000e+0 1.000000e+0
+ 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0
+ 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
+ 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0"
+
+-- Iteration 4 --
+string(227) "1.000000e+0 +1.000000e+0 0.000000e+0
+ 1.000000e+0 e 0.000000e+0 1.000000e+0
+ 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0
+ 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0
+ 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation19.phpt b/ext/standard/tests/strings/vsprintf_variation19.phpt
new file mode 100644
index 000000000..4ad276a88
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation19.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test vsprintf() function : usage variations - with whitespaces in format strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+$counter = 1;
+foreach($formats as $format) {
+ echo"\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : with white spaces in format strings ***
+
+-- Iteration 1 --
+string(13) "111 222 333"
+
+-- Iteration 2 --
+string(29) "1.100000 0.200000 -0.600000"
+
+-- Iteration 3 --
+string(29) "1.120000 -1.130000 0.230000"
+
+-- Iteration 4 --
+string(9) "1 10 11"
+
+-- Iteration 5 --
+string(7) "A B C"
+
+-- Iteration 6 --
+string(38) "2.000000e+1 2.000000e-1 -2.000000e+1"
+
+-- Iteration 7 --
+string(18) "4294967285 22 33"
+
+-- Iteration 8 --
+string(19) "12 37777777755 23"
+
+-- Iteration 9 --
+string(16) "11 ffffffde 33"
+
+-- Iteration 10 --
+string(16) "11 FFFFFFDE 33"
+
+-- Iteration 11 --
+string(38) "2.000000E+1 2.000000E-1 -2.000000E+1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt
new file mode 100644
index 000000000..6e805feb7
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Test vsprintf() function : usage variations - with whitespaces in format strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string $format , array $args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+echo "*** Testing vsprintf() : with white spaces in format strings ***\n";
+
+// initializing the format array
+$formats = array(
+ "% d % d % d",
+ "% f % f % f",
+ "% F % F % F",
+ "% b % b % b",
+ "% c % c % c",
+ "% e % e % e",
+ "% u % u % u",
+ "% o % o % o",
+ "% x % x % x",
+ "% X % X % X",
+ "% E % E % E"
+);
+
+// initializing the args array
+
+$args_array = array(
+ array(111, 222, 333),
+ array(1.1, .2, -0.6),
+ array(1.12, -1.13, +0.23),
+ array(1, 2, 3),
+ array(65, 66, 67),
+ array(2e1, 2e-1, -2e1),
+ array(-11, +22, 33),
+ array(012, -02394, +02389),
+ array(0x11, -0x22, +0x33),
+ array(0x11, -0x22, +0x33),
+ array(2e1, 2e-1, -2e1)
+);
+
+$counter = 1;
+foreach($formats as $format) {
+ echo"\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : with white spaces in format strings ***
+
+-- Iteration 1 --
+string(13) "111 222 333"
+
+-- Iteration 2 --
+string(29) "1.100000 0.200000 -0.600000"
+
+-- Iteration 3 --
+string(29) "1.120000 -1.130000 0.230000"
+
+-- Iteration 4 --
+string(9) "1 10 11"
+
+-- Iteration 5 --
+string(7) "A B C"
+
+-- Iteration 6 --
+string(38) "2.000000e+1 2.000000e-1 -2.000000e+1"
+
+-- Iteration 7 --
+string(28) "18446744073709551605 22 33"
+
+-- Iteration 8 --
+string(30) "12 1777777777777777777755 23"
+
+-- Iteration 9 --
+string(24) "11 ffffffffffffffde 33"
+
+-- Iteration 10 --
+string(24) "11 FFFFFFFFFFFFFFDE 33"
+
+-- Iteration 11 --
+string(38) "2.000000E+1 2.000000E-1 -2.000000E+1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation2.phpt b/ext/standard/tests/strings/vsprintf_variation2.phpt
new file mode 100644
index 000000000..fbc1e8634
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation2.phpt
@@ -0,0 +1,177 @@
+--TEST--
+Test vsprintf() function : usage variations - unexpected values for args argument
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different unexpected values are passed to
+ * the '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : with unexpected values for args argument ***\n";
+
+// initialising the required variables
+$format = '%s';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring a class
+class sample
+{
+ public function __toString() {
+ return "object";
+ }
+}
+
+// Defining resource
+$file_handle = fopen(__FILE__, 'r');
+
+
+//array of values to iterate over
+$values = array(
+
+ // int data
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // null data
+ NULL,
+ null,
+
+ // boolean data
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+ "",
+ '',
+
+ // string data
+ "string",
+ 'string',
+
+ // object data
+ new sample(),
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource data
+ $file_handle
+);
+
+// loop through each element of the array for args
+$counter = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format,$value) );
+ $counter++;
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : with unexpected values for args argument ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "12345"
+
+-- Iteration 4 --
+string(5) "-2345"
+
+-- Iteration 5 --
+string(4) "10.5"
+
+-- Iteration 6 --
+string(5) "-10.5"
+
+-- Iteration 7 --
+string(12) "105000000000"
+
+-- Iteration 8 --
+string(7) "1.06E-9"
+
+-- Iteration 9 --
+string(3) "0.5"
+
+-- Iteration 10 --
+
+Warning: vsprintf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: vsprintf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+string(1) "1"
+
+-- Iteration 13 --
+string(0) ""
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(0) ""
+
+-- Iteration 16 --
+string(0) ""
+
+-- Iteration 17 --
+string(0) ""
+
+-- Iteration 18 --
+string(6) "string"
+
+-- Iteration 19 --
+string(6) "string"
+
+-- Iteration 20 --
+
+Warning: vsprintf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Iteration 21 --
+
+Warning: vsprintf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Iteration 22 --
+
+Warning: vsprintf(): Too few arguments in %s on line %d
+bool(false)
+
+-- Iteration 23 --
+string(%d) "Resource id #%d"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation3.phpt b/ext/standard/tests/strings/vsprintf_variation3.phpt
new file mode 100644
index 000000000..fff82c803
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation3.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test vsprintf() function : usage variations - int formats with int values
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different int formats and int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats with int values ***\n";
+
+
+// defining array of int formats
+$formats = array(
+ "%d",
+ "%+d %-d %D",
+ "%ld %Ld, %4d %-4d",
+ "%10.4d %-10.4d %04d %04.4d",
+ "%'#2d %'2d %'$2d %'_2d",
+ "%d %d %d %d",
+ "% %%d d%",
+ '%3$d %4$d %1$d %2$d'
+);
+
+// Arrays of int values for the format defined in $format.
+// Each sub array contains int values which correspond to each format string in $format
+$args_array = array(
+ array(0),
+ array(-1, 1, +22),
+ array(2147483647, -2147483648, +2147483640, -2147483640),
+ array(123456, 12345678, -1234567, 1234567),
+ array(111, 2222, 333333, 44444444),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234, -5678, 2345),
+ array(3, 4, 1, 2)
+
+);
+
+// looping to test vsprintf() with different int formats from the above $format array
+// and with int values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing vsprintf() : int formats with int values ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(5) "-1 1 "
+
+-- Iteration 3 --
+string(36) "2147483647 d, 2147483640 -2147483640"
+
+-- Iteration 4 --
+string(38) " 123456 12345678 -1234567 1234567"
+
+-- Iteration 5 --
+string(24) "111 2222 333333 44444444"
+
+-- Iteration 6 --
+string(15) "4667 4011 83 10"
+
+-- Iteration 7 --
+string(8) "%-5678 d"
+
+-- Iteration 8 --
+string(7) "1 2 3 4"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation4.phpt b/ext/standard/tests/strings/vsprintf_variation4.phpt
new file mode 100644
index 000000000..e3e6737b8
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation4.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test vsprintf() function : usage variations - int formats with non-integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different int formats from the above $format array
+// and with non-int values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : int formats and non-integer values ***
+
+-- Iteration 1 --
+string(112) "2 +0 10
+ 123456 d -1234 1234
+ -1474836480 200000 4000 22000000
+ 12345 12 -12 -123456
+ 10 123456 2 0"
+
+-- Iteration 2 --
+string(92) "0 +0 0
+ 123 d -123 123
+ 0 0 123456 0000
+ 1234 0 $0 _0
+ 0 123 0 0"
+
+-- Iteration 3 --
+string(81) "1 +1 1
+ 1 d 1 1
+ 1 1 1 0001
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 4 --
+string(81) "1 +1 0
+ 1 d 0 1
+ 1 0 1 0000
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt
new file mode 100644
index 000000000..c6b6db572
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt
@@ -0,0 +1,104 @@
+--TEST--
+Test vsprintf() function : usage variations - int formats with non-integer values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different int formats and non-int values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
+
+// defining array of int formats
+$formats =
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
+
+// Arrays of non int values for the format defined in $format.
+// Each sub array contains non int values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e5, 4e3, 22e+6,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different int formats from the above $format array
+// and with non-int values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : int formats and non-integer values ***
+
+-- Iteration 1 --
+string(112) "2 +0 10
+ 123456 d -1234 1234
+ 20000000000 200000 4000 22000000
+ 12345 12 -12 -123456
+ 10 123456 2 0"
+
+-- Iteration 2 --
+string(92) "0 +0 0
+ 123 d -123 123
+ 0 0 123456 0000
+ 1234 0 $0 _0
+ 0 123 0 0"
+
+-- Iteration 3 --
+string(81) "1 +1 1
+ 1 d 1 1
+ 1 1 1 0001
+ #1 1 $1 _1
+ 1 1 1 1"
+
+-- Iteration 4 --
+string(81) "1 +1 0
+ 1 d 0 1
+ 1 0 1 0000
+ #0 1 $1 _0
+ 0 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation5.phpt b/ext/standard/tests/strings/vsprintf_variation5.phpt
new file mode 100644
index 000000000..dd356fbbe
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation5.phpt
@@ -0,0 +1,82 @@
+--TEST--
+Test vsprintf() function : usage variations - float formats with float values
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different float formats and float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : int formats with float values ***\n";
+
+
+// defining array of float formats
+$formats = array(
+ "%f",
+ "%+f %-f %F",
+ "%lf %Lf, %4f %-4f",
+ "%10.4f %-10.4F %04f %04.4f",
+ "%'#2f %'2f %'$2f %'_2f",
+ "%f %f %f %f",
+ "% %%f f%",
+ '%3$f %4$f %1$f %2$f'
+);
+
+// Arrays of float values for the format defined in $format.
+// Each sub array contains float values which correspond to each format string in $format
+$args_array = array(
+ array(0.0),
+ array(-0.1, +0.1, +10.0000006),
+ array(2147483649, -2147483647, +2147483640, -2147483640),
+ array(2e5, 2e-5, -2e5, -2e-5),
+ array(0.2E5, -0.2e40, 0.2E-20, 0.2E+20),
+ array(0x123b, 0xfAb, 0123, 01293),
+ array(1234.1234, -5678.5678, 2345.2345),
+ array(3.33, 4.44, 1.11, 2.22)
+
+);
+
+// looping to test vsprintf() with different float formats from the above $format array
+// and with float values from the above $args_array array
+$counter = 1;
+foreach($formats as $format) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($format, $args_array[$counter-1]) );
+ $counter++;
+}
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing vsprintf() : int formats with float values ***
+
+-- Iteration 1 --
+string(8) "0.000000"
+
+-- Iteration 2 --
+string(28) "-0.100000 0.100000 10.000001"
+
+-- Iteration 3 --
+string(57) "2147483649.000000 f, 2147483640.000000 -2147483640.000000"
+
+-- Iteration 4 --
+string(45) "200000.0000 0.0000 -200000.000000 -0.0000"
+
+-- Iteration 5 --
+string(98) "20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000"
+
+-- Iteration 6 --
+string(43) "4667.000000 4011.000000 83.000000 10.000000"
+
+-- Iteration 7 --
+string(15) "%-5678.567800 f"
+
+-- Iteration 8 --
+string(35) "1.110000 2.220000 3.330000 4.440000"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation6.phpt b/ext/standard/tests/strings/vsprintf_variation6.phpt
new file mode 100644
index 000000000..00f9467cf
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation6.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Test vsprintf() function : usage variations - float formats with non-float values
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different float formats and non-float values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : float formats and non-float values ***\n";
+
+// defining array of float formats
+$formats =
+ '%f %+f %-f
+ %lf %Lf %4f %-4f
+ %10.4f %-10.4f %04f %04.4f
+ %\'#2f %\'2f %\'$2f %\'_2f
+ %3$f %4$f %1$f %2$f';
+
+// Arrays of non float values for the format defined in $format.
+// Each sub array contains non float values which correspond to each format in $format
+$args_array = array(
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+ // array of strings
+ array(" ", ' ', 'hello',
+ '123hello', "123hello", '-123hello', '+123hello',
+ "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
+ "1234hello", "hello\0world", "NULL", "true",
+ "3", "4", '1', '2'),
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different float formats from the above $format array
+// and with non-float values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : float formats and non-float values ***
+
+-- Iteration 1 --
+string(244) "2.000000 -2.000000 2.000000
+ 123456.000000 f -12346789.000000 12346789.000000
+ 123200.0000 20000.0000 -40000.000000 22212.0000
+ 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000
+ 2.000000 123456.000000 2.000000 -2.000000"
+
+-- Iteration 2 --
+string(196) "0.000000 +0.000000 0.000000
+ 123.000000 f -123.000000 123.000000
+ 0.0000 0.0000 123456.000000 0.0000
+ 1234.000000 0.000000 0.000000 0.000000
+ 0.000000 123.000000 0.000000 0.000000"
+
+-- Iteration 3 --
+string(179) "1.000000 +1.000000 1.000000
+ 1.000000 f 1.000000 1.000000
+ 1.0000 1.0000 1.000000 1.0000
+ 1.000000 1.000000 1.000000 1.000000
+ 1.000000 1.000000 1.000000 1.000000"
+
+-- Iteration 4 --
+string(179) "1.000000 +1.000000 0.000000
+ 1.000000 f 0.000000 1.000000
+ 1.0000 0.0000 1.000000 0.0000
+ 0.000000 1.000000 1.000000 0.000000
+ 0.000000 1.000000 1.000000 1.000000"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation7.phpt b/ext/standard/tests/strings/vsprintf_variation7.phpt
new file mode 100644
index 000000000..0085138b7
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation7.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vsprintf_variation8.phpt b/ext/standard/tests/strings/vsprintf_variation8.phpt
new file mode 100644
index 000000000..08f218486
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation8.phpt
@@ -0,0 +1,101 @@
+--TEST--
+Test vsprintf() function : usage variations - string formats with non-string values
+--FILE--
+<?php
+/* Prototype : string vsprintf(string format, array args)
+ * Description: Return a formatted string
+ * Source code: ext/standard/formatted_print.c
+*/
+
+/*
+ * Test vsprintf() when different string formats and non-string values are passed to
+ * the '$format' and '$args' arguments of the function
+*/
+
+echo "*** Testing vsprintf() : string formats and non-string values ***\n";
+
+// defining array of string formats
+$formats =
+ '%s %+s %-s
+ %ls %Ls %4s %-4s
+ %10.4s %-10.4s %04s %04.4s
+ %\'#2s %\'2s %\'$2s %\'_2s
+ %3$s %4$s %1$s %2$s';
+
+// Arrays of non string values for the format defined in $format.
+// Each sub array contains non string values which correspond to each format in $format
+$args_array = array(
+
+ // array of float values
+ array(2.2, .2, 10.2,
+ 123456.234, 123456.234, -1234.6789, +1234.6789,
+ 2e10, +2e12, -4e11, 22e+12,
+ 12345.780, 12.000000011111, -12.00000111111, -123456.234,
+ 3.33, +4.44, 1.11,-2.22 ),
+
+ // array of int values
+ array(2, -2, +2,
+ 123456, 123456234, -12346789, +12346789,
+ 123200, +20000, -40000, 22212,
+ 12345780, 1211111, -12111111, -12345634,
+ 3, +4, 1,-2 ),
+
+
+ // different arrays
+ array( array(0), array(1, 2), array(-1, -1),
+ array("123"), array('123'), array('-123'), array("-123"),
+ array(true), array(false), array(TRUE), array(FALSE),
+ array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
+ array("3"), array("4"), array("1"), array("2") ),
+
+ // array of boolean data
+ array( true, TRUE, false,
+ TRUE, 0, FALSE, 1,
+ true, false, TRUE, FALSE,
+ 0, 1, 1, 0,
+ 1, TRUE, 0, FALSE),
+
+);
+
+// looping to test vsprintf() with different string formats from the above $format array
+// and with non-string values from the above $args_array array
+$counter = 1;
+foreach($args_array as $args) {
+ echo "\n-- Iteration $counter --\n";
+ var_dump( vsprintf($formats, $args) );
+ $counter++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing vsprintf() : string formats and non-string values ***
+
+-- Iteration 1 --
+string(177) "2.2 0.2 10.2
+ 123456.234 s -1234.6789 1234.6789
+ 2000 2000 -400000000000 2200
+ 12345.78 12.000000011111 -12.00000111111 -123456.234
+ 10.2 123456.234 2.2 0.2"
+
+-- Iteration 2 --
+string(132) "2 -2 2
+ 123456 s -12346789 12346789
+ 1232 2000 -40000 2221
+ 12345780 1211111 -12111111 -12345634
+ 2 123456 2 -2"
+
+-- Iteration 3 --
+string(131) "Array Array Array
+ Array s Array Array
+ Arra Arra Array Arra
+ Array Array Array Array
+ Array Array Array Array"
+
+-- Iteration 4 --
+string(81) "1 1
+ 1 s 1
+ 1 0001 0000
+ #0 1 $1 _0
+ 1 1 1"
+Done
diff --git a/ext/standard/tests/strings/vsprintf_variation9.phpt b/ext/standard/tests/strings/vsprintf_variation9.phpt
new file mode 100644
index 000000000..2d4663739
--- /dev/null
+++ b/ext/standard/tests/strings/vsprintf_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/wordwrap_basic.phpt b/ext/standard/tests/strings/wordwrap_basic.phpt
new file mode 100644
index 000000000..84a7f7335
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_basic.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test wordwrap() function : basic functionality
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing wordwrap() : basic functionality ***\n";
+
+// Initialize all required variables
+$str = "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy doooooooooooooooooooooog.";
+$width = 80;
+$break = '<br />\n';
+
+// Calling wordwrap() with default arguments
+var_dump( wordwrap($str) );
+
+// Calling wordwrap() with all possible optional arguments
+// with $width arg
+var_dump( wordwrap($str, $width) );
+// with $break arg
+var_dump( wordwrap($str, $width, $break) );
+
+// Calling wordwrap() with all arguments
+// $cut as true
+$width = 10;
+$cut = true;
+var_dump( wordwrap($str, $width, $break, $cut) );
+
+// $cut as false
+$width = 10;
+$cut = false;
+var_dump( wordwrap($str, $width, $break, $cut) );
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : basic functionality ***
+string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
+doooooooooooooooooooooog."
+string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
+doooooooooooooooooooooog."
+string(103) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy<br />\ndoooooooooooooooooooooog."
+string(178) "The quick<br />\nbrown<br />\nfooooooooo<br />\nox<br />\njummmmmmmm<br />\nmmmmped<br />\nover the<br />\nlazzzzzzzz<br />\nzzzy<br />\ndooooooooo<br />\noooooooooo<br />\nooog."
+string(138) "The quick<br />\nbrown<br />\nfoooooooooox<br />\njummmmmmmmmmmmped<br />\nover the<br />\nlazzzzzzzzzzzy<br />\ndoooooooooooooooooooooog."
+Done
diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt
new file mode 100644
index 000000000..98f199abc
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_error.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test wordwrap() function : error conditions
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing wordwrap() : error conditions ***\n";
+
+// Zero argument
+echo "\n-- Testing wordwrap() function with Zero arguments --\n";
+var_dump( wordwrap() );
+
+// More than expected number of arguments
+echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n";
+$str = 'testing wordwrap function';
+$width = 10;
+$break = '<br />\n';
+$cut = true;
+$extra_arg = "extra_arg";
+
+var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) );
+
+// $width arg as negative value
+echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n";
+echo "-- width = 0 & cut = false --\n";
+// width as zero and cut as false
+$width = 0;
+$cut = false;
+var_dump( wordwrap($str, $width, $break, $cut) );
+
+echo "-- width = 0 & cut = true --\n";
+// width as zero and cut as true
+$width = 0;
+$cut = true;
+var_dump( wordwrap($str, $width, $break, $cut) );
+
+echo "-- width = -10 & cut = false --\n";
+// width as -ne and cut as false
+$width = -10;
+$cut = false;
+var_dump( wordwrap($str, $width, $break, $cut) );
+
+echo "-- width = -10 & cut = true --\n";
+// width as -ne and cut as true
+$width = -10;
+$cut = true;
+var_dump( wordwrap($str, $width, $break, $cut) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : error conditions ***
+
+-- Testing wordwrap() function with Zero arguments --
+
+Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing wordwrap() function with more than expected no. of arguments --
+
+Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d
+NULL
+
+-- Testing wordwrap() function with negative/zero value for width argument --
+-- width = 0 & cut = false --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- width = 0 & cut = true --
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- width = -10 & cut = false --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- width = -10 & cut = true --
+string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+Done
diff --git a/ext/standard/tests/strings/wordwrap_variation1.phpt b/ext/standard/tests/strings/wordwrap_variation1.phpt
new file mode 100644
index 000000000..f5a172e9a
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_variation1.phpt
@@ -0,0 +1,335 @@
+--TEST--
+Test wordwrap() function : usage variations - unexpected values for str argument
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * testing wordwrap() by providing different values for str argument
+*/
+
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$width = 3;
+$break = '<br />\n';
+$cut = true;
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new stdclass(),
+
+ // Null
+ NULL,
+ null,
+
+ // empty string
+ "",
+ '',
+
+ // resource variable
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop though each element of the array and check the working of wordwrap()
+// when $str arugment is supplied with different values
+echo "\n--- Testing wordwrap() by supplying different values for 'str' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $str = $values [$index];
+
+ var_dump( wordwrap($str) );
+ var_dump( wordwrap($str, $width) );
+ var_dump( wordwrap($str, $width, $break) );
+
+ // $cut as false
+ $cut = false;
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ // $cut as true
+ $cut = true;
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ $counter ++;
+}
+
+// close the resource
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : usage variations ***
+
+--- Testing wordwrap() by supplying different values for 'str' argument ---
+-- Iteration 1 --
+string(1) "0"
+string(1) "0"
+string(1) "0"
+string(1) "0"
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+-- Iteration 3 --
+string(5) "12345"
+string(5) "12345"
+string(5) "12345"
+string(5) "12345"
+string(13) "123<br />\n45"
+-- Iteration 4 --
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+string(5) "-2345"
+string(13) "-23<br />\n45"
+-- Iteration 5 --
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+string(4) "10.5"
+string(12) "10.<br />\n5"
+-- Iteration 6 --
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+string(5) "-10.5"
+string(13) "-10<br />\n.5"
+-- Iteration 7 --
+string(12) "105000000000"
+string(12) "105000000000"
+string(12) "105000000000"
+string(12) "105000000000"
+string(36) "105<br />\n000<br />\n000<br />\n000"
+-- Iteration 8 --
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+string(7) "1.06E-9"
+string(23) "1.0<br />\n6E-<br />\n9"
+-- Iteration 9 --
+string(3) "0.5"
+string(3) "0.5"
+string(3) "0.5"
+string(3) "0.5"
+string(3) "0.5"
+-- Iteration 10 --
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+-- Iteration 16 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 17 --
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+-- Iteration 18 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 19 --
+
+Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d
+NULL
+-- Iteration 20 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 21 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 22 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 23 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 24 --
+
+Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d
+NULL
+-- Iteration 25 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+-- Iteration 26 --
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+Done
diff --git a/ext/standard/tests/strings/wordwrap_variation2.phpt b/ext/standard/tests/strings/wordwrap_variation2.phpt
new file mode 100644
index 000000000..271879194
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_variation2.phpt
@@ -0,0 +1,340 @@
+--TEST--
+Test wordwrap() function : usage variations - unexpected values for width argument
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test wordwrap by passing different values for width argument
+*/
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$str = 'testing wordwrap function';
+$break = '<br />\n';
+$cut = true;
+
+// resource var
+$fp = fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+
+// array with different values as width
+$values = array (
+ // zerovalue for width
+ 0,
+
+ // -ve value for width
+ -1,
+ -10,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new stdclass(),
+
+ // Null value
+ NULL,
+ null,
+
+ // empty string
+ "",
+ '',
+
+ // resource variable
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+
+// loop though each element of the array and check the working of wordwrap()
+// when $width arugment is supplied with different values
+echo "\n--- Testing wordwrap() by supplying different values for 'width' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $width = $values [$index];
+
+ var_dump( wordwrap($str, $width) );
+ var_dump( wordwrap($str, $width, $break) );
+
+ // cut as false
+ $cut = false;
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ // cut as true
+ $cut = true;
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ $counter ++;
+}
+
+// close the resource
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : usage variations ***
+
+--- Testing wordwrap() by supplying different values for 'width' argument ---
+-- Iteration 1 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- Iteration 2 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 3 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 4 --
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 5 --
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 6 --
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 7 --
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 8 --
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 9 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 10 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- Iteration 11 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(199) "t<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
+-- Iteration 12 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- Iteration 13 --
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 15 --
+
+Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 16 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- Iteration 17 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- Iteration 18 --
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 19 --
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+-- Iteration 21 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+-- Iteration 22 --
+string(25) "testing
+wordwrap
+function"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+
+Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/wordwrap_variation3.phpt b/ext/standard/tests/strings/wordwrap_variation3.phpt
new file mode 100644
index 000000000..0a71944b4
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_variation3.phpt
@@ -0,0 +1,302 @@
+--TEST--
+Test wordwrap() function : usage variations - unexptected values for break argument
+--INI--
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test wordwrap by passing different values for break argument
+*/
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$str = 'testing wordwrap function';
+$width = 10;
+$cut = true;
+
+// resource var
+$fp = fopen(__FILE__, "r");
+
+// get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+
+// array with different values for break arg
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // boolean values
+ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // objects
+ new stdclass(),
+
+ // empty string
+ "",
+ '',
+
+ //Null
+ NULL,
+ null,
+
+ // resource var
+ $fp,
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop though each element of the array and check the working of wordwrap()
+// when $break arugment is supplied with different values
+echo "\n--- Testing wordwrap() by supplying different values for 'break' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $break = $values [$index];
+
+ var_dump( wordwrap($str, $width, $break) );
+
+ // $cut as false
+ $cut = false;
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ // $cut as true
+ $cut = true;
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ $counter ++;
+}
+
+// close the resource used
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : usage variations ***
+
+--- Testing wordwrap() by supplying different values for 'break' argument ---
+-- Iteration 1 --
+string(25) "testing0wordwrap0function"
+string(25) "testing0wordwrap0function"
+string(25) "testing0wordwrap0function"
+-- Iteration 2 --
+string(25) "testing1wordwrap1function"
+string(25) "testing1wordwrap1function"
+string(25) "testing1wordwrap1function"
+-- Iteration 3 --
+string(33) "testing12345wordwrap12345function"
+string(33) "testing12345wordwrap12345function"
+string(33) "testing12345wordwrap12345function"
+-- Iteration 4 --
+string(33) "testing-2345wordwrap-2345function"
+string(33) "testing-2345wordwrap-2345function"
+string(33) "testing-2345wordwrap-2345function"
+-- Iteration 5 --
+string(31) "testing10.5wordwrap10.5function"
+string(31) "testing10.5wordwrap10.5function"
+string(31) "testing10.5wordwrap10.5function"
+-- Iteration 6 --
+string(33) "testing-10.5wordwrap-10.5function"
+string(33) "testing-10.5wordwrap-10.5function"
+string(33) "testing-10.5wordwrap-10.5function"
+-- Iteration 7 --
+string(47) "testing105000000000wordwrap105000000000function"
+string(47) "testing105000000000wordwrap105000000000function"
+string(47) "testing105000000000wordwrap105000000000function"
+-- Iteration 8 --
+string(37) "testing1.06E-9wordwrap1.06E-9function"
+string(37) "testing1.06E-9wordwrap1.06E-9function"
+string(37) "testing1.06E-9wordwrap1.06E-9function"
+-- Iteration 9 --
+string(29) "testing0.5wordwrap0.5function"
+string(29) "testing0.5wordwrap0.5function"
+string(29) "testing0.5wordwrap0.5function"
+-- Iteration 10 --
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(25) "testing1wordwrap1function"
+string(25) "testing1wordwrap1function"
+string(25) "testing1wordwrap1function"
+-- Iteration 16 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 17 --
+string(25) "testing1wordwrap1function"
+string(25) "testing1wordwrap1function"
+string(25) "testing1wordwrap1function"
+-- Iteration 18 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 19 --
+
+Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d
+NULL
+-- Iteration 20 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 21 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 22 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 23 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 24 --
+
+Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+
+Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d
+NULL
+-- Iteration 25 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+-- Iteration 26 --
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+
+Warning: wordwrap(): Break string cannot be empty in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/wordwrap_variation4.phpt b/ext/standard/tests/strings/wordwrap_variation4.phpt
new file mode 100644
index 000000000..440e93740
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_variation4.phpt
@@ -0,0 +1,144 @@
+--TEST--
+Test wordwrap() function : usage variations - unexptected value for cut argument
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ * test wordwrap() by supplying different values for cut argument
+*/
+
+echo "*** Testing wordwrap() : usage variations ***\n";
+// initialize all required variables
+$str = 'testing wordwrap function';
+$width = 10;
+$break = '<br />\n';
+
+// get an unset variable
+$unset_var = true;
+unset($unset_var);
+
+// resource variable
+$fp = fopen(__FILE__, "r");
+
+// array with different values
+$values = array (
+
+ // integer values
+ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float values
+ 10.5,
+ -10.5,
+ 10.5e10,
+ 10.6E-10,
+ .5,
+
+ // array values
+ array(),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
+
+ // string values
+ "string",
+ 'string',
+
+ // objects
+ new stdclass(),
+
+ // empty string
+ "",
+ '',
+
+ // undefined variable
+ @$undefined_var,
+
+ // unset variable
+ @$unset_var
+);
+
+// loop though each element of the array and check the working of wordwrap()
+// when $cut arugment is supplied with different values
+echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n";
+$counter = 1;
+for($index = 0; $index < count($values); $index ++) {
+ echo "-- Iteration $counter --\n";
+ $cut = $values [$index];
+
+ var_dump( wordwrap($str, $width, $break, $cut) );
+
+ $counter ++;
+}
+
+// close the resource
+fclose($fp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : usage variations ***
+
+--- Testing wordwrap() by supplying different values for 'cut' argument ---
+-- Iteration 1 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 2 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 3 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 4 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 5 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 6 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 7 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 8 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 9 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 10 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+-- Iteration 13 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+-- Iteration 14 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d
+NULL
+-- Iteration 15 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 16 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 17 --
+
+Warning: wordwrap() expects parameter 4 to be boolean, object given in %s on line %d
+NULL
+-- Iteration 18 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 19 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 20 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+-- Iteration 21 --
+string(39) "testing<br />\nwordwrap<br />\nfunction"
+Done
diff --git a/ext/standard/tests/strings/wordwrap_variation5.phpt b/ext/standard/tests/strings/wordwrap_variation5.phpt
new file mode 100644
index 000000000..b0911a899
--- /dev/null
+++ b/ext/standard/tests/strings/wordwrap_variation5.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test wordwrap() function : usage variations - valid break arguments(spaces)
+--FILE--
+<?php
+/* Prototype : string wordwrap ( string $str [, int $width [, string $break [, bool $cut]]] )
+ * Description: Wraps buffer to selected number of characters using string break char
+ * Source code: ext/standard/string.c
+*/
+
+/*
+ *test wordwrap() with break arguments as single spaces
+*/
+
+echo "*** Testing wordwrap() : usage variations ***\n";
+
+// Initialize all required variables
+$str = "Testing wordrap function";
+$width = 1;
+$cut = false;
+
+echo "\n-- Testing wordwrap() with default break value and single space as value --\n";
+echo "-- with default break and cut value --\n";
+var_dump( wordwrap($str, $width) ); // default break and cut value
+
+echo "-- with default cut value --\n";
+$break = ' ';
+$break1 = " ";
+var_dump( wordwrap($str, $width, $break) );
+var_dump( wordwrap($str, $width, $break1) );
+
+echo "-- with cut value as false --\n";
+$cut = false;
+var_dump( wordwrap($str, $width, $break, $cut) );
+var_dump( wordwrap($str, $width, $break1, $cut) );
+
+echo "-- with cut value as true --\n";
+$cut = true;
+var_dump( wordwrap($str, $width, $break, $cut) );
+var_dump( wordwrap($str, $width, $break1, $cut) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing wordwrap() : usage variations ***
+
+-- Testing wordwrap() with default break value and single space as value --
+-- with default break and cut value --
+string(24) "Testing
+wordrap
+function"
+-- with default cut value --
+string(24) "Testing wordrap function"
+string(26) "Testing wordrap function"
+-- with cut value as false --
+string(24) "Testing wordrap function"
+string(26) "Testing wordrap function"
+-- with cut value as true --
+string(43) "T e s t i n g w o r d r a p f u n c t i o n"
+string(64) "T e s t i n g w o r d r a p f u n c t i o n"
+Done
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index 93279d30f..ff5b9b2c9 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uniqid.c,v 1.41.2.2.2.2 2007/01/05 15:06:55 iliaa Exp $ */
+/* $Id: uniqid.c,v 1.41.2.2.2.3 2007/10/04 13:31:11 jani Exp $ */
#include "php.h"
@@ -61,7 +61,7 @@ PHP_FUNCTION(uniqid)
#if HAVE_USLEEP && !defined(PHP_WIN32)
if (!more_entropy) {
#if defined(__CYGWIN__)
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must use 'more entropy' under CYGWIN.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must use 'more entropy' under CYGWIN");
RETURN_FALSE;
#else
usleep(1);
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 4fe68f21f..13a6aa592 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: url.c,v 1.86.2.5.2.7 2007/01/01 09:36:09 sebastian Exp $ */
+/* $Id: url.c,v 1.86.2.5.2.8 2007/10/04 13:31:11 jani Exp $ */
#include <stdlib.h>
#include <string.h>
@@ -375,7 +375,7 @@ PHP_FUNCTION(parse_url)
if (resource->fragment != NULL) RETVAL_STRING(resource->fragment, 1);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier %ld.", key);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier %ld", key);
RETVAL_FALSE;
}
goto done;
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 6ccbd5d49..a32429531 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.11.0 on Tue Jun 5 19:51:02 2007 */
+/* Generated by re2c 0.12.1 on Wed Oct 10 12:28:46 2007 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.c,v 1.95.2.4.2.3 2007/06/06 12:27:24 nlopess Exp $ */
+/* $Id: url_scanner_ex.c,v 1.95.2.4.2.5 2007/10/10 09:28:51 jani Exp $ */
#include "php.h"
@@ -108,7 +108,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
scan:
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
@@ -259,16 +259,29 @@ static void handle_form(STD_PARA)
if (ctx->form_app.len > 0) {
switch (ctx->tag.len) {
-
-#define RECOGNIZE(x) do { \
- case sizeof(x)-1: \
- if (strncasecmp(ctx->tag.c, x, sizeof(x)-1) == 0) \
- doit = 1; \
- break; \
-} while (0)
-
- RECOGNIZE("form");
- RECOGNIZE("fieldset");
+ case sizeof("form") - 1:
+ if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) {
+ doit = 1;
+ }
+ if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) {
+ char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len);
+ if (p) {
+ e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p);
+ if (!e) {
+ e = ctx->val.c + ctx->val.len;
+ }
+ if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
+ doit = 0;
+ }
+ }
+ }
+ break;
+
+ case sizeof("fieldset") - 1:
+ if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) {
+ doit = 1;
+ }
+ break;
}
if (doit)
@@ -276,8 +289,6 @@ static void handle_form(STD_PARA)
}
}
-
-
/*
* HANDLE_TAG copies the HTML Tag and checks whether we
* have that tag in our table. If we might modify it,
@@ -339,7 +350,7 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
@@ -398,7 +409,7 @@ yy15:
state_tag:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -472,7 +483,7 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 128, 128, 128, 0, 128, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -561,7 +572,7 @@ yy37:
state_arg:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -629,7 +640,7 @@ yy45:
state_before_val:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -711,7 +722,7 @@ yy55:
state_val:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
248, 248, 248, 248, 248, 248, 248, 248,
248, 160, 160, 248, 248, 160, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248,
diff --git a/ext/standard/url_scanner_ex.c.orig b/ext/standard/url_scanner_ex.c.orig
index 325d8136a..f6e388fb2 100644
--- a/ext/standard/url_scanner_ex.c.orig
+++ b/ext/standard/url_scanner_ex.c.orig
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.11.0 on Tue Jun 5 19:51:02 2007 */
+/* Generated by re2c 0.12.1 on Wed Oct 10 12:28:46 2007 */
#line 1 "ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.c,v 1.95.2.4.2.3 2007/06/06 12:27:24 nlopess Exp $ */
+/* $Id: url_scanner_ex.c,v 1.95.2.4.2.5 2007/10/10 09:28:51 jani Exp $ */
#include "php.h"
@@ -110,7 +110,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
scan:
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
@@ -271,16 +271,29 @@ static void handle_form(STD_PARA)
if (ctx->form_app.len > 0) {
switch (ctx->tag.len) {
-
-#define RECOGNIZE(x) do { \
- case sizeof(x)-1: \
- if (strncasecmp(ctx->tag.c, x, sizeof(x)-1) == 0) \
- doit = 1; \
- break; \
-} while (0)
-
- RECOGNIZE("form");
- RECOGNIZE("fieldset");
+ case sizeof("form") - 1:
+ if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) {
+ doit = 1;
+ }
+ if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) {
+ char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len);
+ if (p) {
+ e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p);
+ if (!e) {
+ e = ctx->val.c + ctx->val.len;
+ }
+ if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
+ doit = 0;
+ }
+ }
+ }
+ break;
+
+ case sizeof("fieldset") - 1:
+ if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) {
+ doit = 1;
+ }
+ break;
}
if (doit)
@@ -288,8 +301,6 @@ static void handle_form(STD_PARA)
}
}
-
-
/*
* HANDLE_TAG copies the HTML Tag and checks whether we
* have that tag in our table. If we might modify it,
@@ -351,7 +362,7 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
@@ -386,7 +397,7 @@ state_plain:
128, 128, 128, 128, 128, 128, 128, 128,
};
-#line 390 "ext/standard/url_scanner_ex.c"
+#line 401 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -395,9 +406,9 @@ state_plain:
goto yy15;
}
++YYCURSOR;
-#line 288 "ext/standard/url_scanner_ex.re"
+#line 299 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
-#line 401 "ext/standard/url_scanner_ex.c"
+#line 412 "ext/standard/url_scanner_ex.c"
yy15:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -405,18 +416,18 @@ yy15:
if(yybm[0+yych] & 128) {
goto yy15;
}
-#line 289 "ext/standard/url_scanner_ex.re"
+#line 300 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain; }
-#line 411 "ext/standard/url_scanner_ex.c"
+#line 422 "ext/standard/url_scanner_ex.c"
}
}
-#line 290 "ext/standard/url_scanner_ex.re"
+#line 301 "ext/standard/url_scanner_ex.re"
state_tag:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -451,7 +462,7 @@ state_tag:
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 455 "ext/standard/url_scanner_ex.c"
+#line 466 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -468,14 +479,14 @@ yy20:
yych = *YYCURSOR;
goto yy25;
yy21:
-#line 295 "ext/standard/url_scanner_ex.re"
+#line 306 "ext/standard/url_scanner_ex.re"
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
-#line 474 "ext/standard/url_scanner_ex.c"
+#line 485 "ext/standard/url_scanner_ex.c"
yy22:
++YYCURSOR;
-#line 296 "ext/standard/url_scanner_ex.re"
+#line 307 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 479 "ext/standard/url_scanner_ex.c"
+#line 490 "ext/standard/url_scanner_ex.c"
yy24:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -487,7 +498,7 @@ yy25:
goto yy21;
}
}
-#line 297 "ext/standard/url_scanner_ex.re"
+#line 308 "ext/standard/url_scanner_ex.re"
state_next_arg_begin:
@@ -496,7 +507,7 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 128, 128, 128, 0, 128, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -531,7 +542,7 @@ state_next_arg:
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 535 "ext/standard/url_scanner_ex.c"
+#line 546 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -557,27 +568,27 @@ state_next_arg:
}
}
++YYCURSOR;
-#line 305 "ext/standard/url_scanner_ex.re"
+#line 316 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
-#line 563 "ext/standard/url_scanner_ex.c"
+#line 574 "ext/standard/url_scanner_ex.c"
yy30:
++YYCURSOR;
yych = *YYCURSOR;
goto yy37;
yy31:
-#line 306 "ext/standard/url_scanner_ex.re"
+#line 317 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg; }
-#line 571 "ext/standard/url_scanner_ex.c"
+#line 582 "ext/standard/url_scanner_ex.c"
yy32:
++YYCURSOR;
-#line 307 "ext/standard/url_scanner_ex.re"
+#line 318 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
-#line 576 "ext/standard/url_scanner_ex.c"
+#line 587 "ext/standard/url_scanner_ex.c"
yy34:
++YYCURSOR;
-#line 308 "ext/standard/url_scanner_ex.re"
+#line 319 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 581 "ext/standard/url_scanner_ex.c"
+#line 592 "ext/standard/url_scanner_ex.c"
yy36:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -589,13 +600,13 @@ yy37:
goto yy31;
}
}
-#line 309 "ext/standard/url_scanner_ex.re"
+#line 320 "ext/standard/url_scanner_ex.re"
state_arg:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -630,7 +641,7 @@ state_arg:
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 634 "ext/standard/url_scanner_ex.c"
+#line 645 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -644,14 +655,14 @@ yy40:
yych = *YYCURSOR;
goto yy45;
yy41:
-#line 314 "ext/standard/url_scanner_ex.re"
+#line 325 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
-#line 650 "ext/standard/url_scanner_ex.c"
+#line 661 "ext/standard/url_scanner_ex.c"
yy42:
++YYCURSOR;
-#line 315 "ext/standard/url_scanner_ex.re"
+#line 326 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
-#line 655 "ext/standard/url_scanner_ex.c"
+#line 666 "ext/standard/url_scanner_ex.c"
yy44:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -663,13 +674,13 @@ yy45:
goto yy41;
}
}
-#line 316 "ext/standard/url_scanner_ex.re"
+#line 327 "ext/standard/url_scanner_ex.re"
state_before_val:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -704,7 +715,7 @@ state_before_val:
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 708 "ext/standard/url_scanner_ex.c"
+#line 719 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -717,17 +728,17 @@ yy48:
if(yych == ' ') goto yy55;
if(yych == '=') goto yy53;
yy49:
-#line 322 "ext/standard/url_scanner_ex.re"
+#line 333 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; goto state_next_arg_begin; }
-#line 723 "ext/standard/url_scanner_ex.c"
+#line 734 "ext/standard/url_scanner_ex.c"
yy50:
++YYCURSOR;
yych = *YYCURSOR;
goto yy54;
yy51:
-#line 321 "ext/standard/url_scanner_ex.re"
+#line 332 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
-#line 731 "ext/standard/url_scanner_ex.c"
+#line 742 "ext/standard/url_scanner_ex.c"
yy52:
yych = *++YYCURSOR;
goto yy49;
@@ -750,14 +761,14 @@ yy55:
goto yy49;
}
}
-#line 323 "ext/standard/url_scanner_ex.re"
+#line 334 "ext/standard/url_scanner_ex.re"
state_val:
start = YYCURSOR;
{
- static unsigned char yybm[] = {
+ static const unsigned char yybm[] = {
248, 248, 248, 248, 248, 248, 248, 248,
248, 160, 160, 248, 248, 160, 248, 248,
248, 248, 248, 248, 248, 248, 248, 248,
@@ -792,7 +803,7 @@ state_val:
248, 248, 248, 248, 248, 248, 248, 248,
};
-#line 796 "ext/standard/url_scanner_ex.c"
+#line 807 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
@@ -819,9 +830,9 @@ state_val:
yych = *(YYMARKER = ++YYCURSOR);
goto yy77;
yy61:
-#line 331 "ext/standard/url_scanner_ex.re"
+#line 342 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
-#line 825 "ext/standard/url_scanner_ex.c"
+#line 836 "ext/standard/url_scanner_ex.c"
yy62:
yych = *(YYMARKER = ++YYCURSOR);
goto yy69;
@@ -830,9 +841,9 @@ yy63:
goto yy67;
yy64:
++YYCURSOR;
-#line 332 "ext/standard/url_scanner_ex.re"
+#line 343 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg_begin; }
-#line 836 "ext/standard/url_scanner_ex.c"
+#line 847 "ext/standard/url_scanner_ex.c"
yy66:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -857,9 +868,9 @@ yy69:
goto yy66;
}
yy71:
-#line 330 "ext/standard/url_scanner_ex.re"
+#line 341 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
-#line 863 "ext/standard/url_scanner_ex.c"
+#line 874 "ext/standard/url_scanner_ex.c"
yy72:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -889,9 +900,9 @@ yy77:
goto yy66;
}
yy79:
-#line 329 "ext/standard/url_scanner_ex.re"
+#line 340 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
-#line 895 "ext/standard/url_scanner_ex.c"
+#line 906 "ext/standard/url_scanner_ex.c"
yy80:
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -905,7 +916,7 @@ yy80:
goto yy79;
}
}
-#line 333 "ext/standard/url_scanner_ex.re"
+#line 344 "ext/standard/url_scanner_ex.re"
stop:
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 0283cae0c..a1bfdc027 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.re,v 1.76.2.2.2.1 2007/06/06 00:00:27 iliaa Exp $ */
+/* $Id: url_scanner_ex.re,v 1.76.2.2.2.2 2007/10/10 00:35:52 iliaa Exp $ */
#include "php.h"
@@ -205,16 +205,29 @@ static void handle_form(STD_PARA)
if (ctx->form_app.len > 0) {
switch (ctx->tag.len) {
-
-#define RECOGNIZE(x) do { \
- case sizeof(x)-1: \
- if (strncasecmp(ctx->tag.c, x, sizeof(x)-1) == 0) \
- doit = 1; \
- break; \
-} while (0)
-
- RECOGNIZE("form");
- RECOGNIZE("fieldset");
+ case sizeof("form") - 1:
+ if (!strncasecmp(ctx->tag.c, "form", sizeof("form") - 1)) {
+ doit = 1;
+ }
+ if (doit && ctx->val.c && ctx->lookup_data && *ctx->lookup_data) {
+ char *e, *p = zend_memnstr(ctx->val.c, "://", sizeof("://") - 1, ctx->val.c + ctx->val.len);
+ if (p) {
+ e = memchr(p, '/', (ctx->val.c + ctx->val.len) - p);
+ if (!e) {
+ e = ctx->val.c + ctx->val.len;
+ }
+ if ((e - p) && strncasecmp(p, ctx->lookup_data, (e - p))) {
+ doit = 0;
+ }
+ }
+ }
+ break;
+
+ case sizeof("fieldset") - 1:
+ if (!strncasecmp(ctx->tag.c, "fieldset", sizeof("fieldset") - 1)) {
+ doit = 1;
+ }
+ break;
}
if (doit)
@@ -222,8 +235,6 @@ static void handle_form(STD_PARA)
}
}
-
-
/*
* HANDLE_TAG copies the HTML Tag and checks whether we
* have that tag in our table. If we might modify it,
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index 98fcc5f6c..0290c1329 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: uuencode.c,v 1.5.2.1.2.4 2007/03/12 20:55:15 tony2001 Exp $ */
+/* $Id: uuencode.c,v 1.5.2.1.2.5 2007/10/04 13:31:11 jani Exp $ */
/*
* Portions of this code are based on Berkeley's uuencode/uudecode
@@ -215,7 +215,7 @@ PHP_FUNCTION(convert_uudecode)
dst_len = php_uudecode(src, src_len, &dst);
if (dst_len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The given parameter is not a valid uuencoded string.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The given parameter is not a valid uuencoded string");
RETURN_FALSE;
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 988a28d1d..d250957b9 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.203.2.7.2.18 2007/06/26 11:51:14 tony2001 Exp $ */
+/* $Id: var.c,v 1.203.2.7.2.19 2007/10/04 13:31:11 jani Exp $ */
@@ -589,7 +589,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt
if (Z_TYPE_PP(name) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
"containing the names of instance-variables to "
- "serialize.");
+ "serialize");
/* we should still add element even if it's not OK,
since we already wrote the length of the array before */
smart_str_appendl(buf,"N;", 2);
@@ -742,7 +742,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var
} else {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
"containing the names of instance-variables to "
- "serialize.");
+ "serialize");
/* we should still add element even if it's not OK,
since we already wrote the length of the array before */
smart_str_appendl(buf,"N;", 2);
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c
index 582e3fbe2..56aa0499d 100644
--- a/ext/sybase/php_sybase_db.c
+++ b/ext/sybase/php_sybase_db.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_db.c,v 1.66.2.5.2.7 2007/08/10 13:24:59 jani Exp $ */
+/* $Id: php_sybase_db.c,v 1.66.2.5.2.8 2007/08/31 07:42:00 jani Exp $ */
#ifdef HAVE_CONFIG_H
@@ -32,6 +32,7 @@
#include "ext/standard/php_standard.h"
#include "ext/standard/info.h"
#include "php_globals.h"
+#include "php_ini.h"
#if HAVE_SYBASE
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index c6e35e7f6..d6c0128c3 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvshm.c,v 1.70.2.2.2.4 2007/02/24 15:44:43 iliaa Exp $ */
+/* $Id: sysvshm.c,v 1.70.2.2.2.5 2007/08/31 07:42:00 jani Exp $ */
/* This has been built and tested on Linux 2.2.14
*
@@ -37,6 +37,7 @@
#include "php_sysvshm.h"
#include "ext/standard/php_var.h"
#include "ext/standard/php_smart_str.h"
+#include "php_ini.h"
/* {{{ sysvshm_functions[]
*/
diff --git a/ext/tidy/tests/029.phpt b/ext/tidy/tests/029.phpt
new file mode 100644
index 000000000..1709cd6f0
--- /dev/null
+++ b/ext/tidy/tests/029.phpt
@@ -0,0 +1,28 @@
+--TEST--
+tidy_get_body() crash
+--SKIPIF--
+<?php if (!extension_loaded('tidy')) die('skip'); ?>
+--FILE--
+<?php
+
+// bug report taken from http://news.php.net/php.notes/130628
+
+$inputs = array(
+ '<frameset > </frameset>',
+ '<html><frameset> </frameset> </html',
+);
+
+
+foreach ($inputs as $input) {
+
+ $t = tidy_parse_string($input);
+ $t->cleanRepair();
+ var_dump(tidy_get_body($t));
+}
+
+echo "Done\n";
+?>
+--EXPECT--
+NULL
+NULL
+Done
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 8621a461e..303457983 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tidy.c,v 1.66.2.8.2.23 2007/05/04 17:11:05 nlopess Exp $ */
+/* $Id: tidy.c,v 1.66.2.8.2.24 2007/09/20 22:25:05 nlopess Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -870,35 +870,41 @@ static void *php_tidy_get_opt_val(PHPTidyDoc *ptdoc, TidyOption opt, TidyOptionT
return NULL;
}
-static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, tidy_base_nodetypes node)
+static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, tidy_base_nodetypes node_type)
{
PHPTidyObj *newobj;
+ TidyNode node;
TIDY_FETCH_OBJECT;
- tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
- newobj = (PHPTidyObj *) zend_object_store_get_object(return_value TSRMLS_CC);
- newobj->type = is_node;
- newobj->ptdoc = obj->ptdoc;
- newobj->ptdoc->ref_count++;
-
- switch(node) {
+ switch (node_type) {
case is_root_node:
- newobj->node = tidyGetRoot(newobj->ptdoc->doc);
+ node = tidyGetRoot(obj->ptdoc->doc);
break;
case is_html_node:
- newobj->node = tidyGetHtml(newobj->ptdoc->doc);
+ node = tidyGetHtml(obj->ptdoc->doc);
break;
case is_head_node:
- newobj->node = tidyGetHead(newobj->ptdoc->doc);
+ node = tidyGetHead(obj->ptdoc->doc);
break;
case is_body_node:
- newobj->node = tidyGetBody(newobj->ptdoc->doc);
+ node = tidyGetBody(obj->ptdoc->doc);
break;
}
+ if (!node) {
+ RETURN_NULL();
+ }
+
+ tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
+ newobj = (PHPTidyObj *) zend_object_store_get_object(return_value TSRMLS_CC);
+ newobj->type = is_node;
+ newobj->ptdoc = obj->ptdoc;
+ newobj->node = node;
+ newobj->ptdoc->ref_count++;
+
tidy_add_default_properties(newobj, is_node TSRMLS_CC);
}
@@ -992,7 +998,7 @@ static PHP_MINFO_FUNCTION(tidy)
php_info_print_table_start();
php_info_print_table_header(2, "Tidy support", "enabled");
php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate());
- php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.8.2.23 2007/05/04 17:11:05 nlopess Exp $)");
+ php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.66.2.8.2.24 2007/09/20 22:25:05 nlopess Exp $)");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 13fd82de6..c31057002 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlreader.c,v 1.13.2.14.2.8 2007/07/26 13:20:21 bjori Exp $ */
+/* $Id: php_xmlreader.c,v 1.13.2.14.2.9 2007/09/20 09:30:45 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1060,7 +1060,7 @@ PHP_METHOD(xmlreader, XML)
long options = 0;
xmlreader_object *intern = NULL;
char *source, *uri = NULL, *encoding = NULL;
- int resolved_path_len;
+ int resolved_path_len, ret = 0;
char *directory=NULL, resolved_path[MAXPATHLEN];
xmlParserInputBufferPtr inputbfr;
xmlTextReaderPtr reader;
@@ -1105,15 +1105,20 @@ PHP_METHOD(xmlreader, XML)
xmlFree(uri);
}
if (reader != NULL) {
- if (id == NULL) {
- object_init_ex(return_value, xmlreader_class_entry);
- intern = (xmlreader_object *)zend_objects_get_address(return_value TSRMLS_CC);
- } else {
- RETVAL_TRUE;
+#if LIBXML_VERSION >= 20628
+ ret = xmlTextReaderSetup(reader, NULL, uri, encoding, options);
+#endif
+ if (ret == 0) {
+ if (id == NULL) {
+ object_init_ex(return_value, xmlreader_class_entry);
+ intern = (xmlreader_object *)zend_objects_get_address(return_value TSRMLS_CC);
+ } else {
+ RETVAL_TRUE;
+ }
+ intern->input = inputbfr;
+ intern->ptr = reader;
+ return;
}
- intern->input = inputbfr;
- intern->ptr = reader;
- return;
}
}
diff --git a/ext/xmlreader/tests/bug42139.phpt b/ext/xmlreader/tests/bug42139.phpt
new file mode 100644
index 000000000..19602f010
--- /dev/null
+++ b/ext/xmlreader/tests/bug42139.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #42139 (XMLReader option constants are broken using XML())
+--SKIPIF--
+<?php if (!extension_loaded("xmlreader")) print "skip";
+if (LIBXML_VERSION < 20628) die("skip: libxml2 2.6.28+ required");
+?>
+--FILE--
+<?php
+
+$xml = <<<XML
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE root [
+<!ELEMENT root ANY>
+<!ENTITY x "y">
+]>
+<root>&x;</root>
+XML;
+
+$reader = new XMLReader;
+$reader->XML( $xml, NULL, LIBXML_NOENT);
+while ( $reader->read() ) {
+ echo "{$reader->nodeType}, {$reader->name}, {$reader->value}\n";
+}
+$reader->close();
+
+?>
+--EXPECT--
+10, root,
+1, root,
+3, #text, y
+15, root,
diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c
index 0bad3ee49..3352a51ff 100644
--- a/ext/xmlrpc/libxmlrpc/encodings.c
+++ b/ext/xmlrpc/libxmlrpc/encodings.c
@@ -41,7 +41,7 @@
#include <stdlib.h>
#endif
-static const char rcsid[] = "#(@) $Id: encodings.c,v 1.7 2004/03/08 23:04:33 abies Exp $";
+static const char rcsid[] = "#(@) $Id: encodings.c,v 1.7.6.1 2007/09/19 00:33:43 stas Exp $";
#include <errno.h>
@@ -53,6 +53,10 @@ static const char rcsid[] = "#(@) $Id: encodings.c,v 1.7 2004/03/08 23:04:33 abi
#include "encodings.h"
+#ifndef ICONV_CSNMAXLEN
+#define ICONV_CSNMAXLEN 64
+#endif
+
static char* convert(const char* src, int src_len, int *new_len, const char* from_enc, const char* to_enc) {
char* outbuf = 0;
@@ -60,9 +64,13 @@ static char* convert(const char* src, int src_len, int *new_len, const char* fro
size_t outlenleft = src_len;
size_t inlenleft = src_len;
int outlen = src_len;
- iconv_t ic = iconv_open(to_enc, from_enc);
+ iconv_t ic;
char* out_ptr = 0;
+ if(strlen(to_enc) >= ICONV_CSNMAXLEN || strlen(from_enc) >= ICONV_CSNMAXLEN) {
+ return NULL;
+ }
+ ic = iconv_open(to_enc, from_enc);
if(ic != (iconv_t)-1) {
size_t st;
outbuf = (char*)malloc(outlen + 1);
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c
index f156400cd..dc5752fd5 100644
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.c
+++ b/ext/xmlrpc/libxmlrpc/xmlrpc.c
@@ -31,7 +31,7 @@
*/
-static const char rcsid[] = "#(@) $Id: xmlrpc.c,v 1.8.4.2 2007/06/07 09:07:36 tony2001 Exp $";
+static const char rcsid[] = "#(@) $Id: xmlrpc.c,v 1.8.4.3 2007/09/18 19:49:53 iliaa Exp $";
/****h* ABOUT/xmlrpc
@@ -43,6 +43,11 @@ static const char rcsid[] = "#(@) $Id: xmlrpc.c,v 1.8.4.2 2007/06/07 09:07:36 to
* 9/1999 - 10/2000
* HISTORY
* $Log: xmlrpc.c,v $
+ * Revision 1.8.4.3 2007/09/18 19:49:53 iliaa
+ *
+ * Fixed bug #42189 (xmlrpc_set_type() crashes php on invalid datetime
+ * values).
+ *
* Revision 1.8.4.2 2007/06/07 09:07:36 tony2001
* MFH: php_localtime_r() checks
*
@@ -176,7 +181,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
}
p++;
}
- text = buf;
+ text = buf;
}
@@ -186,15 +191,19 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
return -1;
}
+#define XMLRPC_IS_NUMBER(x) if (x < '0' || x > '9') return -1;
+
n = 1000;
tm.tm_year = 0;
for(i = 0; i < 4; i++) {
+ XMLRPC_IS_NUMBER(text[i])
tm.tm_year += (text[i]-'0')*n;
n /= 10;
}
n = 10;
tm.tm_mon = 0;
for(i = 0; i < 2; i++) {
+ XMLRPC_IS_NUMBER(text[i])
tm.tm_mon += (text[i+4]-'0')*n;
n /= 10;
}
@@ -203,6 +212,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_mday = 0;
for(i = 0; i < 2; i++) {
+ XMLRPC_IS_NUMBER(text[i])
tm.tm_mday += (text[i+6]-'0')*n;
n /= 10;
}
@@ -210,6 +220,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_hour = 0;
for(i = 0; i < 2; i++) {
+ XMLRPC_IS_NUMBER(text[i])
tm.tm_hour += (text[i+9]-'0')*n;
n /= 10;
}
@@ -217,6 +228,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_min = 0;
for(i = 0; i < 2; i++) {
+ XMLRPC_IS_NUMBER(text[i])
tm.tm_min += (text[i+12]-'0')*n;
n /= 10;
}
@@ -224,6 +236,7 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
n = 10;
tm.tm_sec = 0;
for(i = 0; i < 2; i++) {
+ XMLRPC_IS_NUMBER(text[i])
tm.tm_sec += (text[i+15]-'0')*n;
n /= 10;
}
diff --git a/ext/xmlrpc/tests/bug42189.phpt b/ext/xmlrpc/tests/bug42189.phpt
new file mode 100644
index 000000000..55e726cf6
--- /dev/null
+++ b/ext/xmlrpc/tests/bug42189.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #42189 (xmlrpc_get_type() crashes PHP on invalid dates)
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+$a = '~~~~~~~~~~~~~~~~~~';
+$ok = xmlrpc_set_type($a, 'datetime');
+var_dump($ok);
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(false)
+Done
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 37c06fb59..ca4e417d3 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -51,7 +51,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xmlrpc-epi-php.c,v 1.39.2.5.2.5 2007/01/12 12:32:15 tony2001 Exp $ */
+/* $Id: xmlrpc-epi-php.c,v 1.39.2.5.2.6 2007/09/18 19:49:53 iliaa Exp $ */
/**********************************************************************
* BUGS: *
@@ -1325,9 +1325,13 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype)
if(SUCCESS == zend_hash_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR), (void *) &type, sizeof(zval *), NULL)) {
bSuccess = zend_hash_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR), (void *) &ztimestamp, sizeof(zval *), NULL);
}
- }
+ } else {
+ zval_ptr_dtor(&type);
+ }
XMLRPC_CleanupValue(v);
- }
+ } else {
+ zval_ptr_dtor(&type);
+ }
}
else {
convert_to_object(value);
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index f90ffa7d7..81fdf6225 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xmlwriter.c,v 1.20.2.12.2.15 2007/05/14 09:23:49 pajoye Exp $ */
+/* $Id: php_xmlwriter.c,v 1.20.2.12.2.16 2007/10/24 22:50:19 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -464,6 +464,9 @@ static void php_xmlwriter_end(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_int_t
if (this) {
XMLWRITER_FROM_OBJECT(intern, this);
+ if (ZEND_NUM_ARGS()) {
+ WRONG_PARAM_COUNT;
+ }
} else
#endif
{
diff --git a/ext/xmlwriter/tests/bug41326.phpt b/ext/xmlwriter/tests/bug41326.phpt
index e4eaf79a1..9c154bfd3 100644
--- a/ext/xmlwriter/tests/bug41326.phpt
+++ b/ext/xmlwriter/tests/bug41326.phpt
@@ -17,6 +17,7 @@ $xml->writeElement('foo3');
$xml->startElement('bar');
$xml->endElement('bar');
$xml->endElement();
+$xml->endElement();
print $xml->flush(true);
print "\n";
@@ -36,6 +37,7 @@ $xw->endDocument();
print $xw->flush(true);
?>
--EXPECTF--
+Warning: Wrong parameter count for XMLWriter::endElement() in %s on line %d
<?xml version="1.0"?>
<test>
<foo/>
diff --git a/ext/xsl/xsl_fe.h b/ext/xsl/xsl_fe.h
index c22d23cc2..1b6a30964 100644
--- a/ext/xsl/xsl_fe.h
+++ b/ext/xsl/xsl_fe.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xsl_fe.h,v 1.8.2.1.2.1 2007/01/01 09:36:10 sebastian Exp $ */
+/* $Id: xsl_fe.h,v 1.8.2.1.2.2 2007/10/06 21:35:53 tony2001 Exp $ */
#ifndef XSL_FE_H
#define XSL_FE_H
@@ -34,3 +34,12 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter);
PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support);
PHP_FUNCTION(xsl_xsltprocessor_register_php_functions);
#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: sw=4 ts=4 fdm=marker
+ * vim<600: sw=4 ts=4
+ */
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 8bd89ac4f..c6a1b986e 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xsltprocessor.c,v 1.39.2.2.2.9 2007/07/30 16:33:22 rrichards Exp $ */
+/* $Id: xsltprocessor.c,v 1.39.2.2.2.10 2007/10/06 21:35:53 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -47,7 +47,6 @@ zend_function_entry php_xsl_xsltprocessor_class_functions[] = {
{NULL, NULL, NULL}
};
-/* {{{ attribute protos, not implemented yet */
/* {{{ php_xsl_xslt_string_to_xpathexpr()
Translates a string to a XPath Expression */
static char *php_xsl_xslt_string_to_xpathexpr(const char *str TSRMLS_DC)
@@ -72,7 +71,7 @@ static char *php_xsl_xslt_string_to_xpathexpr(const char *str TSRMLS_DC)
}
return (char *) value;
}
-
+/* }}} */
/* {{{ php_xsl_xslt_make_params()
Translates a PHP array to a libxslt parameters array */
@@ -122,8 +121,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS
}
/* }}} */
-
-static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type)
+static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
{
xsltTransformContextPtr tctxt;
zval **args;
@@ -313,17 +311,19 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
efree(fci.params);
}
}
+/* }}} */
-void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs)
+void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{{ */
{
xsl_ext_function_php(ctxt, nargs, 1);
}
+/* }}} */
-void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs)
+void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs) /* {{{ */
{
xsl_ext_function_php(ctxt, nargs, 2);
}
-
+/* }}} */
/* {{{ proto void xsl_xsltprocessor_import_stylesheet(domdocument doc);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
@@ -412,8 +412,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
}
/* }}} end xsl_xsltprocessor_import_stylesheet */
-
-static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC)
+static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */
{
xmlDocPtr newdocp;
xmlDocPtr doc = NULL;
@@ -495,6 +494,7 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
return newdocp;
}
+/* }}} */
/* {{{ proto domdocument xsl_xsltprocessor_transform_to_doc(domnode doc);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#
@@ -555,7 +555,6 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
}
/* }}} end xsl_xsltprocessor_transform_to_doc */
-
/* {{{ proto int xsl_xsltprocessor_transform_to_uri(domdocument doc, string uri);
*/
PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
@@ -587,7 +586,6 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
}
/* }}} end xsl_xsltprocessor_transform_to_uri */
-
/* {{{ proto string xsl_xsltprocessor_transform_to_xml(domdocument doc);
*/
PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
@@ -626,7 +624,6 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
}
/* }}} end xsl_xsltprocessor_transform_to_xml */
-
/* {{{ proto bool xsl_xsltprocessor_set_parameter(string namespace, mixed name [, string value]);
*/
PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
@@ -784,3 +781,11 @@ PHP_FUNCTION(xsl_xsltprocessor_has_exslt_support)
}
/* }}} end xsl_xsltprocessor_has_exslt_support(); */
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: sw=4 ts=4 fdm=marker
+ * vim<600: sw=4 ts=4
+ */
diff --git a/ext/zlib/tests/005.phpt b/ext/zlib/tests/005.phpt
index 79834b2d3..84fc3b5f1 100644
--- a/ext/zlib/tests/005.phpt
+++ b/ext/zlib/tests/005.phpt
@@ -33,18 +33,18 @@ var_dump(gzuncompress($data2));
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
NULL
Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d
bool(false)
-string(%d) "%s"
-string(%d) "%s"
-string(%d) "%s"
-string(%d) "%s"
-string(%d) "%s"
+string(%d) "%a"
+string(%d) "%a"
+string(%d) "%a"
+string(%d) "%a"
+string(%d) "%a"
Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
NULL
diff --git a/ext/zlib/tests/006.phpt b/ext/zlib/tests/006.phpt
index 1ddb56378..6a4e0f4e6 100644
--- a/ext/zlib/tests/006.phpt
+++ b/ext/zlib/tests/006.phpt
@@ -40,11 +40,11 @@ NULL
Warning: gzdeflate(): compression level (1000) must be within -1..9 in %s on line %d
bool(false)
-string(%d) "%s"
-string(%d) "%s"
-string(%d) "%s"
-string(%d) "%s"
-string(%d) "%s"
+string(%d) "%a"
+string(%d) "%a"
+string(%d) "%a"
+string(%d) "%a"
+string(%d) "%a"
Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
NULL